Skip to content

Commit d0a444e

Browse files
committed
Remove fmt_sql
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 3bdb376 commit d0a444e

15 files changed

Lines changed: 41 additions & 190 deletions

File tree

vortex-array/public-api.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16176,7 +16176,7 @@ pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::deserialize(&self, _me
1617616176

1617716177
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::execute(&self, _options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1617816178

16179-
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
16179+
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1618016180

1618116181
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1618216182

@@ -16332,7 +16332,7 @@ pub fn vortex_array::scalar_fn::fns::is_null::IsNull::deserialize(&self, _metada
1633216332

1633316333
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::execute(&self, _data: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, _ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1633416334

16335-
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
16335+
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1633616336

1633716337
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1633816338

@@ -16504,7 +16504,7 @@ pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::deserialize(&s
1650416504

1650516505
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::execute(&self, _options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1650616506

16507-
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
16507+
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1650816508

1650916509
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1651016510

@@ -16636,7 +16636,7 @@ pub fn vortex_array::scalar_fn::fns::mask::Mask::deserialize(&self, _metadata: &
1663616636

1663716637
pub fn vortex_array::scalar_fn::fns::mask::Mask::execute(&self, _options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1663816638

16639-
pub fn vortex_array::scalar_fn::fns::mask::Mask::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
16639+
pub fn vortex_array::scalar_fn::fns::mask::Mask::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1664016640

1664116641
pub fn vortex_array::scalar_fn::fns::mask::Mask::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1664216642

@@ -16814,7 +16814,7 @@ pub fn vortex_array::scalar_fn::fns::merge::Merge::deserialize(&self, _metadata:
1681416814

1681516815
pub fn vortex_array::scalar_fn::fns::merge::Merge::execute(&self, options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1681616816

16817-
pub fn vortex_array::scalar_fn::fns::merge::Merge::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
16817+
pub fn vortex_array::scalar_fn::fns::merge::Merge::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1681816818

1681916819
pub fn vortex_array::scalar_fn::fns::merge::Merge::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1682016820

@@ -16860,7 +16860,7 @@ pub fn vortex_array::scalar_fn::fns::not::Not::deserialize(&self, _metadata: &[u
1686016860

1686116861
pub fn vortex_array::scalar_fn::fns::not::Not::execute(&self, _data: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1686216862

16863-
pub fn vortex_array::scalar_fn::fns::not::Not::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
16863+
pub fn vortex_array::scalar_fn::fns::not::Not::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1686416864

1686516865
pub fn vortex_array::scalar_fn::fns::not::Not::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1686616866

@@ -18030,7 +18030,7 @@ pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::deserialize(&self, _me
1803018030

1803118031
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::execute(&self, _options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1803218032

18033-
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
18033+
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1803418034

1803518035
pub fn vortex_array::scalar_fn::fns::fill_null::FillNull::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1803618036

@@ -18106,7 +18106,7 @@ pub fn vortex_array::scalar_fn::fns::is_null::IsNull::deserialize(&self, _metada
1810618106

1810718107
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::execute(&self, _data: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, _ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1810818108

18109-
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
18109+
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1811018110

1811118111
pub fn vortex_array::scalar_fn::fns::is_null::IsNull::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1811218112

@@ -18182,7 +18182,7 @@ pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::deserialize(&s
1818218182

1818318183
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::execute(&self, _options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1818418184

18185-
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
18185+
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1818618186

1818718187
pub fn vortex_array::scalar_fn::fns::list_contains::ListContains::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1818818188

@@ -18258,7 +18258,7 @@ pub fn vortex_array::scalar_fn::fns::mask::Mask::deserialize(&self, _metadata: &
1825818258

1825918259
pub fn vortex_array::scalar_fn::fns::mask::Mask::execute(&self, _options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1826018260

18261-
pub fn vortex_array::scalar_fn::fns::mask::Mask::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
18261+
pub fn vortex_array::scalar_fn::fns::mask::Mask::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1826218262

1826318263
pub fn vortex_array::scalar_fn::fns::mask::Mask::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1826418264

@@ -18296,7 +18296,7 @@ pub fn vortex_array::scalar_fn::fns::merge::Merge::deserialize(&self, _metadata:
1829618296

1829718297
pub fn vortex_array::scalar_fn::fns::merge::Merge::execute(&self, options: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1829818298

18299-
pub fn vortex_array::scalar_fn::fns::merge::Merge::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
18299+
pub fn vortex_array::scalar_fn::fns::merge::Merge::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1830018300

1830118301
pub fn vortex_array::scalar_fn::fns::merge::Merge::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1830218302

@@ -18334,7 +18334,7 @@ pub fn vortex_array::scalar_fn::fns::not::Not::deserialize(&self, _metadata: &[u
1833418334

1833518335
pub fn vortex_array::scalar_fn::fns::not::Not::execute(&self, _data: &Self::Options, args: &dyn vortex_array::scalar_fn::ExecutionArgs, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<vortex_array::ArrayRef>
1833618336

18337-
pub fn vortex_array::scalar_fn::fns::not::Not::fmt_sql(&self, _options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
18337+
pub fn vortex_array::scalar_fn::fns::not::Not::fmt_sql(&self, options: &Self::Options, expr: &vortex_array::expr::Expression, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
1833818338

1833918339
pub fn vortex_array::scalar_fn::fns::not::Not::id(&self) -> vortex_array::scalar_fn::ScalarFnId
1834018340

vortex-array/src/expr/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ mod tests {
207207
"(($.col1 < $.col2) or ($.col1 != $.col2))"
208208
);
209209

210-
assert_eq!(not(col1).to_string(), "not($.col1)");
210+
assert_eq!(not(col1).to_string(), "vortex.not($.col1)");
211211

212212
assert_eq!(
213213
select(vec![FieldName::from("col1")], root()).to_string(),

vortex-array/src/scalar_fn/fns/fill_null/mod.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
mod kernel;
55

6-
use std::fmt::Formatter;
7-
86
pub use kernel::*;
97
use vortex_error::VortexResult;
108
use vortex_error::vortex_bail;
@@ -66,19 +64,6 @@ impl ScalarFnVTable for FillNull {
6664
}
6765
}
6866

69-
fn fmt_sql(
70-
&self,
71-
_options: &Self::Options,
72-
expr: &Expression,
73-
f: &mut Formatter<'_>,
74-
) -> std::fmt::Result {
75-
write!(f, "fill_null(")?;
76-
expr.child(0).fmt_sql(f)?;
77-
write!(f, ", ")?;
78-
expr.child(1).fmt_sql(f)?;
79-
write!(f, ")")
80-
}
81-
8267
fn return_dtype(&self, _options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
8368
vortex_ensure!(
8469
arg_dtypes[0].eq_ignore_nullability(&arg_dtypes[1]),
@@ -265,6 +250,6 @@ mod tests {
265250
#[test]
266251
fn test_display() {
267252
let expr = fill_null(get_item("value", root()), lit(0i32));
268-
assert_eq!(expr.to_string(), "fill_null($.value, 0i32)");
253+
assert_eq!(expr.to_string(), "vortex.fill_null($.value, 0i32)");
269254
}
270255
}

vortex-array/src/scalar_fn/fns/is_null.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use std::fmt::Formatter;
5-
64
use vortex_error::VortexResult;
75
use vortex_session::VortexSession;
86

@@ -60,17 +58,6 @@ impl ScalarFnVTable for IsNull {
6058
}
6159
}
6260

63-
fn fmt_sql(
64-
&self,
65-
_options: &Self::Options,
66-
expr: &Expression,
67-
f: &mut Formatter<'_>,
68-
) -> std::fmt::Result {
69-
write!(f, "is_null(")?;
70-
expr.child(0).fmt_sql(f)?;
71-
write!(f, ")")
72-
}
73-
7461
fn return_dtype(&self, _options: &Self::Options, _arg_dtypes: &[DType]) -> VortexResult<DType> {
7562
Ok(DType::Bool(Nullability::NonNullable))
7663
}
@@ -240,10 +227,10 @@ mod tests {
240227
#[test]
241228
fn test_display() {
242229
let expr = is_null(get_item("name", root()));
243-
assert_eq!(expr.to_string(), "is_null($.name)");
230+
assert_eq!(expr.to_string(), "vortex.is_null($.name)");
244231

245232
let expr2 = is_null(root());
246-
assert_eq!(expr2.to_string(), "is_null($)");
233+
assert_eq!(expr2.to_string(), "vortex.is_null($)");
247234
}
248235

249236
#[test]

vortex-array/src/scalar_fn/fns/list_contains/mod.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
mod kernel;
55

6-
use std::fmt::Formatter;
76
use std::ops::BitOr;
87

98
use arrow_buffer::bit_iterator::BitIndexIterator;
@@ -89,19 +88,6 @@ impl ScalarFnVTable for ListContains {
8988
),
9089
}
9190
}
92-
fn fmt_sql(
93-
&self,
94-
_options: &Self::Options,
95-
expr: &Expression,
96-
f: &mut Formatter<'_>,
97-
) -> std::fmt::Result {
98-
write!(f, "contains(")?;
99-
expr.child(0).fmt_sql(f)?;
100-
write!(f, ", ")?;
101-
expr.child(1).fmt_sql(f)?;
102-
write!(f, ")")
103-
}
104-
10591
fn return_dtype(&self, _options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
10692
let list_dtype = &arg_dtypes[0];
10793
let needle_dtype = &arg_dtypes[1];
@@ -655,10 +641,10 @@ mod tests {
655641
#[test]
656642
pub fn test_display() {
657643
let expr = list_contains(get_item("tags", root()), lit("urgent"));
658-
assert_eq!(expr.to_string(), "contains($.tags, \"urgent\")");
644+
assert_eq!(expr.to_string(), "vortex.list.contains($.tags, \"urgent\")");
659645

660646
let expr2 = list_contains(root(), lit(42));
661-
assert_eq!(expr2.to_string(), "contains($, 42i32)");
647+
assert_eq!(expr2.to_string(), "vortex.list.contains($, 42i32)");
662648
}
663649

664650
#[test]

vortex-array/src/scalar_fn/fns/mask/mod.rs

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

44
mod kernel;
5-
use std::fmt::Formatter;
65

76
pub use kernel::*;
87
use vortex_error::VortexExpect;
@@ -73,19 +72,6 @@ impl ScalarFnVTable for Mask {
7372
}
7473
}
7574

76-
fn fmt_sql(
77-
&self,
78-
_options: &Self::Options,
79-
expr: &Expression,
80-
f: &mut Formatter<'_>,
81-
) -> std::fmt::Result {
82-
write!(f, "mask(")?;
83-
expr.child(0).fmt_sql(f)?;
84-
write!(f, ", ")?;
85-
expr.child(1).fmt_sql(f)?;
86-
write!(f, ")")
87-
}
88-
8975
fn return_dtype(&self, _options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
9076
vortex_ensure!(
9177
arg_dtypes[1] == DType::Bool(Nullability::NonNullable),

vortex-array/src/scalar_fn/fns/merge.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,6 @@ impl ScalarFnVTable for Merge {
8484
ChildName::from(Arc::from(format!("{}", child_idx)))
8585
}
8686

87-
fn fmt_sql(
88-
&self,
89-
_options: &Self::Options,
90-
expr: &Expression,
91-
f: &mut Formatter<'_>,
92-
) -> std::fmt::Result {
93-
write!(f, "merge(")?;
94-
for (i, child) in expr.children().iter().enumerate() {
95-
child.fmt_sql(f)?;
96-
if i + 1 < expr.children().len() {
97-
write!(f, ", ")?;
98-
}
99-
}
100-
write!(f, ")")
101-
}
102-
10387
fn return_dtype(&self, options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
10488
let mut field_names = Vec::new();
10589
let mut arrays = Vec::new();
@@ -540,10 +524,13 @@ mod tests {
540524
#[test]
541525
pub fn test_display() {
542526
let expr = merge([get_item("struct1", root()), get_item("struct2", root())]);
543-
assert_eq!(expr.to_string(), "merge($.struct1, $.struct2)");
527+
assert_eq!(
528+
expr.to_string(),
529+
"vortex.merge($.struct1, $.struct2, opts=Error)"
530+
);
544531

545532
let expr2 = merge(vec![get_item("a", root())]);
546-
assert_eq!(expr2.to_string(), "merge($.a)");
533+
assert_eq!(expr2.to_string(), "vortex.merge($.a, opts=Error)");
547534
}
548535

549536
#[test]

vortex-array/src/scalar_fn/fns/not/mod.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
mod kernel;
55

6-
use std::fmt::Formatter;
7-
86
pub use kernel::*;
97
use vortex_error::VortexResult;
108
use vortex_error::vortex_bail;
@@ -19,7 +17,6 @@ use crate::arrays::ConstantArray;
1917
use crate::arrays::bool::BoolArrayExt;
2018
use crate::builtins::ArrayBuiltins;
2119
use crate::dtype::DType;
22-
use crate::expr::Expression;
2320
use crate::scalar::Scalar;
2421
use crate::scalar_fn::Arity;
2522
use crate::scalar_fn::ChildName;
@@ -62,17 +59,6 @@ impl ScalarFnVTable for Not {
6259
}
6360
}
6461

65-
fn fmt_sql(
66-
&self,
67-
_options: &Self::Options,
68-
expr: &Expression,
69-
f: &mut Formatter<'_>,
70-
) -> std::fmt::Result {
71-
write!(f, "not(")?;
72-
expr.child(0).fmt_sql(f)?;
73-
write!(f, ")")
74-
}
75-
7662
fn return_dtype(&self, _options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
7763
let child_dtype = &arg_dtypes[0];
7864
if !matches!(child_dtype, DType::Bool(_)) {
@@ -155,8 +141,8 @@ mod tests {
155141
let a = not(get_item("a", root()));
156142
let b = get_item("a", not(root()));
157143
assert_ne!(a.to_string(), b.to_string());
158-
assert_eq!(a.to_string(), "not($.a)");
159-
assert_eq!(b.to_string(), "not($).a");
144+
assert_eq!(a.to_string(), "vortex.not($.a)");
145+
assert_eq!(b.to_string(), "vortex.not($).a");
160146
}
161147

162148
#[test]

vortex-array/src/scalar_fn/vtable.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use crate::dtype::DType;
2222
use crate::expr::Expression;
2323
use crate::expr::StatsCatalog;
2424
use crate::expr::stats::Stat;
25+
use crate::expr::traversal::Node;
2526
use crate::scalar_fn::ScalarFn;
2627
use crate::scalar_fn::ScalarFnId;
2728
use crate::scalar_fn::ScalarFnRef;
@@ -77,7 +78,21 @@ pub trait ScalarFnVTable: 'static + Sized + Clone + Send + Sync {
7778
options: &Self::Options,
7879
expr: &Expression,
7980
f: &mut Formatter<'_>,
80-
) -> fmt::Result;
81+
) -> fmt::Result {
82+
write!(f, "{}(", self.id())?;
83+
let nchildren = expr.children_count();
84+
for (i, child) in expr.children().iter().enumerate() {
85+
child.fmt_sql(f)?;
86+
if i + 1 < nchildren {
87+
write!(f, ", ")?;
88+
}
89+
}
90+
let opts = format!("{}", options);
91+
if !opts.is_empty() {
92+
write!(f, ", opts={}", opts)?;
93+
}
94+
write!(f, ")")
95+
}
8196

8297
/// Coerce the arguments of this function.
8398
///

0 commit comments

Comments
 (0)