Skip to content

Commit a3429ab

Browse files
committed
Remove extra level of python path that is no longer required
1 parent 27e4f30 commit a3429ab

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

examples/substrait.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
from datafusion import SessionContext
1919
from datafusion import substrait as ss
2020

21+
# TODO add user changing interface note to PR that datafusion.substrait.substrait is simplified to datafusion.substrait
2122

2223
# Create a DataFusion context
2324
ctx = SessionContext()
2425

2526
# Register table with context
2627
ctx.register_csv("aggregate_test_data", "./testing/data/csv/aggregate_test_100.csv")
2728

28-
substrait_plan = ss.substrait.serde.serialize_to_plan(
29-
"SELECT * FROM aggregate_test_data", ctx
30-
)
29+
substrait_plan = ss.serde.serialize_to_plan("SELECT * FROM aggregate_test_data", ctx)
3130
# type(substrait_plan) -> <class 'datafusion.substrait.plan'>
3231

3332
# Encode it to bytes
@@ -38,17 +37,15 @@
3837
# Alternative serialization approaches
3938
# type(substrait_bytes) -> <class 'bytes'>, at this point the bytes can be distributed to file, network, etc safely
4039
# where they could subsequently be deserialized on the receiving end.
41-
substrait_bytes = ss.substrait.serde.serialize_bytes(
42-
"SELECT * FROM aggregate_test_data", ctx
43-
)
40+
substrait_bytes = ss.serde.serialize_bytes("SELECT * FROM aggregate_test_data", ctx)
4441

4542
# Imagine here bytes would be read from network, file, etc ... for example brevity this is omitted and variable is simply reused
4643
# type(substrait_plan) -> <class 'datafusion.substrait.plan'>
47-
substrait_plan = ss.substrait.serde.deserialize_bytes(substrait_bytes)
44+
substrait_plan = ss.serde.deserialize_bytes(substrait_bytes)
4845

4946
# type(df_logical_plan) -> <class 'substrait.LogicalPlan'>
50-
df_logical_plan = ss.substrait.consumer.from_substrait_plan(ctx, substrait_plan)
47+
df_logical_plan = ss.consumer.from_substrait_plan(ctx, substrait_plan)
5148

5249
# Back to Substrait Plan just for demonstration purposes
5350
# type(substrait_plan) -> <class 'datafusion.substrait.plan'>
54-
substrait_plan = ss.substrait.producer.to_substrait_plan(df_logical_plan)
51+
substrait_plan = ss.producer.to_substrait_plan(df_logical_plan)

0 commit comments

Comments
 (0)