Skip to content

Commit 1fb23a4

Browse files
authored
Merge pull request #9217 from lichuang/issue_9162
fix: fix ConstColumn(String) cast to StringColumn bug
2 parents 95a5c93 + 6a13610 commit 1fb23a4

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/query/datavalues/src/columns/column.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use crate::TypeID;
3131
pub type ColumnRef = Arc<dyn Column>;
3232
pub trait Column: Send + Sync {
3333
fn as_any(&self) -> &dyn Any;
34+
3435
/// Type of data that column contains. It's an underlying physical type:
3536
/// Int32 for Date, Int64 for Timestamp, so on.
3637
fn data_type_id(&self) -> TypeID {

src/query/datavalues/src/columns/const_/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,15 @@ impl Column for ConstColumn {
143143
self.column.serialize(vec, 0);
144144
}
145145
}
146+
147+
impl std::fmt::Debug for ConstColumn {
148+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
149+
write!(
150+
f,
151+
"ConstColumn \t typeid: {:?}\t len: {}\t data: [{:?}]",
152+
self.data_type_id(),
153+
self.len(),
154+
self.column,
155+
)
156+
}
157+
}

src/query/functions/src/scalars/comparisons/comparison.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,16 @@ impl<T: StringSearchImpl> ComparisonExpression for ComparisonStringImpl<T> {
555555
T::vector_const(lhs, &r, self.op)
556556
}
557557
false => {
558-
let lhs: &StringColumn = Series::check_get(&lhs)?;
559-
let rhs: &StringColumn = Series::check_get(&rhs)?;
558+
let full_lhs = lhs.convert_full_column();
559+
let lhs: &StringColumn = match Series::check_get(&lhs) {
560+
Ok(lhs) => lhs,
561+
Err(_) => Series::check_get(&full_lhs)?,
562+
};
563+
let full_rhs = rhs.convert_full_column();
564+
let rhs: &StringColumn = match Series::check_get(&rhs) {
565+
Ok(lhs) => lhs,
566+
Err(_) => Series::check_get(&full_rhs)?,
567+
};
560568
T::vector_vector(lhs, rhs, self.op)
561569
}
562570
};

0 commit comments

Comments
 (0)