Skip to content

Commit f2a4550

Browse files
committed
fix: make changes in examples
1 parent c0b9f6e commit f2a4550

File tree

4 files changed

+13
-24
lines changed

4 files changed

+13
-24
lines changed

examples/adbc_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def read_adbc_named_table(name: str, conn):
4545
table = filter(
4646
table,
4747
expression=scalar_function(
48-
"functions_comparison.yaml",
49-
"gte",
48+
"functions_comparison.yaml:gte",
5049
expressions=[column("ints"), literal(3, i64())],
5150
),
5251
)

examples/builder_example.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def basic_example():
2929
table = filter(
3030
table,
3131
expression=scalar_function(
32-
"functions_comparison.yaml",
33-
"lt",
32+
"functions_comparison.yaml:lt",
3433
expressions=[column("id"), literal(100, i64())],
3534
),
3635
)
@@ -168,8 +167,7 @@ def advanced_example():
168167
table = filter(
169168
table,
170169
expression=scalar_function(
171-
"functions_comparison.yaml",
172-
"lt",
170+
"functions_comparison.yaml:lt",
173171
expressions=[column("id"), literal(100, i64())],
174172
),
175173
)
@@ -200,8 +198,7 @@ def advanced_example():
200198
adult_users = filter(
201199
users,
202200
expression=scalar_function(
203-
"functions_comparison.yaml",
204-
"gt",
201+
"functions_comparison.yaml:gt",
205202
expressions=[column("age"), literal(25, i64())],
206203
),
207204
)
@@ -216,8 +213,7 @@ def advanced_example():
216213
column("salary"),
217214
# Add a calculated field (this would show function options if available)
218215
scalar_function(
219-
"functions_arithmetic.yaml",
220-
"multiply",
216+
"functions_arithmetic.yaml:multiply",
221217
expressions=[column("salary"), literal(1.1, fp64())],
222218
alias="salary_with_bonus",
223219
),
@@ -248,8 +244,7 @@ def advanced_example():
248244
high_value_orders = filter(
249245
orders,
250246
expression=scalar_function(
251-
"functions_comparison.yaml",
252-
"gt",
247+
"functions_comparison.yaml:gt",
253248
expressions=[column("amount"), literal(50.0, fp64())],
254249
),
255250
)
@@ -280,17 +275,14 @@ def expression_only_example():
280275
print("=== Expression-Only Example ===")
281276
# Show complex expression structure
282277
complex_expr = scalar_function(
283-
"functions_arithmetic.yaml",
284-
"multiply",
278+
"functions_arithmetic.yaml:multiply",
285279
expressions=[
286280
scalar_function(
287-
"functions_arithmetic.yaml",
288-
"add",
281+
"functions_arithmetic.yaml:add",
289282
expressions=[
290283
column("base_salary"),
291284
scalar_function(
292-
"functions_arithmetic.yaml",
293-
"multiply",
285+
"functions_arithmetic.yaml:multiply",
294286
expressions=[
295287
column("base_salary"),
296288
literal(0.15, fp64()), # 15% bonus
@@ -299,8 +291,7 @@ def expression_only_example():
299291
],
300292
),
301293
scalar_function(
302-
"functions_arithmetic.yaml",
303-
"subtract",
294+
"functions_arithmetic.yaml:subtract",
304295
expressions=[
305296
literal(1.0, fp64()),
306297
literal(0.25, fp64()), # 25% tax rate

examples/duckdb_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def read_duckdb_named_table(name: str, conn):
4242
table = filter(
4343
table,
4444
expression=scalar_function(
45-
"functions_comparison.yaml",
46-
"equal",
45+
"functions_comparison.yaml:equal",
4746
expressions=[column("c_nationkey"), literal(3, i32())],
4847
),
4948
)

src/substrait/utils/display.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def _stream_literal_value(
722722
)
723723
elif literal.HasField("string"):
724724
stream.write(
725-
f"{indent}{self._color('string', Colors.BLUE)}: {self._color(f'"{literal.string}"', Colors.GREEN)}\n"
725+
f"{indent}{self._color('string', Colors.BLUE)}: {self._color(literal.string, Colors.GREEN)}\n"
726726
)
727727
elif literal.HasField("date"):
728728
stream.write(
@@ -783,7 +783,7 @@ def _stream_struct_literal(
783783
)
784784
elif field.HasField("string"):
785785
stream.write(
786-
f"{self._get_indent_with_arrow(depth + 2)}{self._color('string', Colors.BLUE)}: {self._color(f'"{field.string}"', Colors.GREEN)}\n"
786+
f"{self._get_indent_with_arrow(depth + 2)}{self._color('string', Colors.BLUE)}: {self._color(field.string, Colors.GREEN)}\n"
787787
)
788788
elif field.HasField("boolean"):
789789
stream.write(

0 commit comments

Comments
 (0)