Skip to content

Commit 684c926

Browse files
committed
Overtime events
1 parent b34df60 commit 684c926

File tree

8 files changed

+33
-28
lines changed

8 files changed

+33
-28
lines changed

vortex-datafusion/src/convert/exprs.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -378,18 +378,18 @@ mod tests {
378378
let col_expr = df_expr::Column::new("test_column", 0);
379379
let result = Expression::try_from_df(&col_expr).unwrap();
380380

381-
assert_snapshot!(result.display_tree().to_string(), @r"
382-
GetItem(test_column)
383-
└── Root
384-
");
381+
assert_snapshot!(result.display_tree().to_string(), @r#"
382+
vortex.get_item "test_column"
383+
└── input: vortex.root
384+
"#);
385385
}
386386

387387
#[test]
388388
fn test_expr_from_df_literal() {
389389
let literal_expr = df_expr::Literal::new(ScalarValue::Int32(Some(42)));
390390
let result = Expression::try_from_df(&literal_expr).unwrap();
391391

392-
assert_snapshot!(result.display_tree().to_string(), @"Literal(value: 42i32, dtype: i32)");
392+
assert_snapshot!(result.display_tree().to_string(), @"vortex.literal 42i32");
393393
}
394394

395395
#[test]
@@ -401,12 +401,12 @@ mod tests {
401401

402402
let result = Expression::try_from_df(&binary_expr).unwrap();
403403

404-
assert_snapshot!(result.display_tree().to_string(), @r"
405-
Binary(=)
406-
├── lhs: GetItem(left)
407-
│ └── Root
408-
└── rhs: Literal(value: 42i32, dtype: i32)
409-
");
404+
assert_snapshot!(result.display_tree().to_string(), @r#"
405+
vortex.binary =
406+
├── lhs: vortex.get_item "left"
407+
│ └── input: vortex.root
408+
└── rhs: vortex.literal 42i32
409+
"#);
410410
}
411411

412412
#[rstest]
@@ -425,10 +425,10 @@ mod tests {
425425

426426
insta::allow_duplicates! {
427427
assert_snapshot!(result.display_tree().to_string(), @r#"
428-
Like
429-
├── child: GetItem(text_col)
430-
│ └── Root
431-
└── pattern: Literal(value: "test%", dtype: utf8)
428+
vortex.like LikeOptions { negated: false, case_insensitive: false }
429+
├── child: vortex.get_item "text_col"
430+
│ └── input: vortex.root
431+
└── pattern: vortex.literal "test%"
432432
"#);
433433
}
434434
}
@@ -600,11 +600,11 @@ mod tests {
600600
Arc::new(ConfigOptions::new()),
601601
);
602602
let result = Expression::try_from_df(&get_field_expr).unwrap();
603-
assert_snapshot!(result.display_tree().to_string(), @r"
604-
GetItem(field1)
605-
└── GetItem(my_struct)
606-
└── Root
607-
");
603+
assert_snapshot!(result.display_tree().to_string(), @r#"
604+
vortex.get_item "field1"
605+
└── input: vortex.get_item "my_struct"
606+
└── input: vortex.root
607+
"#);
608608
}
609609

610610
#[test]

vortex-expr/src/display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ mod tests {
9797
use insta::assert_snapshot;
9898

9999
let root_expr = root();
100-
assert_snapshot!(root_expr.display_tree().to_string(), @"Root");
100+
assert_snapshot!(root_expr.display_tree().to_string(), @"vortex.root");
101101

102102
let lit_expr = lit(42);
103103
assert_snapshot!(lit_expr.display_tree().to_string(), @"Literal(value: 42i32, dtype: i32)");

vortex-expr/src/exprs/binary.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use prost::Message;
5-
use std::fmt::{Formatter, Pointer};
5+
use std::fmt::Formatter;
66
use vortex_array::compute::{add, and_kleene, compare, div, mul, or_kleene, sub};
77
use vortex_array::{compute, ArrayRef};
88
use vortex_dtype::DType;
@@ -59,7 +59,7 @@ impl VTable for Binary {
5959
}
6060

6161
fn fmt_data(&self, instance: &Self::Instance, f: &mut Formatter<'_>) -> std::fmt::Result {
62-
write!(f, "{}", instance)
62+
write!(f, "{}", *instance)
6363
}
6464

6565
fn return_dtype(&self, expr: &ExprInstance<Self>, scope: &DType) -> VortexResult<DType> {

vortex-expr/src/exprs/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,6 @@ mod tests {
175175
assert_eq!(expr.to_string(), "cast($.value as i64)");
176176

177177
let expr2 = cast(root(), DType::Bool(Nullability::Nullable));
178-
assert_eq!(expr2.to_string(), "cast($, bool?)");
178+
assert_eq!(expr2.to_string(), "cast($ as bool?)");
179179
}
180180
}

vortex-expr/src/exprs/literal.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ impl VTable for Literal {
5959
write!(f, "{}", expr.data())
6060
}
6161

62+
fn fmt_data(&self, instance: &Self::Instance, f: &mut Formatter<'_>) -> std::fmt::Result {
63+
write!(f, "{}", instance)
64+
}
65+
6266
fn return_dtype(&self, expr: &ExprInstance<Self>, _scope: &DType) -> VortexResult<DType> {
6367
Ok(expr.data().dtype().clone())
6468
}

vortex-expr/src/exprs/select.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ impl VTable for Select {
8181
}
8282

8383
fn fmt_sql(&self, expr: &ExprInstance<Self>, f: &mut Formatter<'_>) -> std::fmt::Result {
84+
expr.child().fmt_sql(f)?;
8485
match expr.data() {
8586
FieldSelection::Include(fields) => {
86-
write!(f, "select({{{}}})", DisplayFieldNames(fields))
87+
write!(f, "{{{}}}", DisplayFieldNames(fields))
8788
}
8889
FieldSelection::Exclude(fields) => {
89-
write!(f, "select(~ {{{}}})", DisplayFieldNames(fields))
90+
write!(f, "{{~ {}}}", DisplayFieldNames(fields))
9091
}
9192
}
9293
}

vortex-expr/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ mod tests {
217217
root()
218218
)
219219
.to_string(),
220-
"$~{col1, col2}"
220+
"${~ col1, col2}"
221221
);
222222

223223
assert_eq!(lit(Scalar::from(0u8)).to_string(), "0u8");

vortex-expr/src/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl<V: VTable> DynExprVTable for VTableAdapter<V> {
251251
let instance = instance
252252
.downcast_ref::<V::Instance>()
253253
.vortex_expect("Failed to downcast expression instance to expected type");
254-
write!(f, "{:?}", instance)
254+
V::fmt_data(&self.0, instance, f)
255255
}
256256

257257
fn return_dtype(&self, expression: &Expression, scope: &DType) -> VortexResult<DType> {

0 commit comments

Comments
 (0)