File tree Expand file tree Collapse file tree 7 files changed +7
-111
lines changed
Expand file tree Collapse file tree 7 files changed +7
-111
lines changed Original file line number Diff line number Diff line change 11[submodule "third_party/substrait "]
22 path = third_party/substrait
33 url = https://github.com/substrait-io/substrait
4- [submodule "third_party/substrait-cpp "]
5- path = third_party/substrait-cpp
6- url = https://github.com/substrait-io/substrait-cpp
Original file line number Diff line number Diff line change @@ -136,12 +136,13 @@ relations {
136136```
137137
138138## Load a Substrait Plan from JSON
139- A substrait plan can be loaded from its JSON representation
140- using the `` substrait. json.load_json `` and `` substrait.json.parse_json ``
139+ A substrait plan can be loaded [ from the JSON representation
140+ of the protobuf message ] ( https://protobuf.dev/programming-guides/ json/ ) using the [ ` protobuf ` python library ] ( https://pypi.org/project/protobuf/ ) :
141141functions:
142142
143143```
144- >>> import substrait.json
144+ >>> from substrait.proto import Plan
145+ >>> from google.protobuf import json_format
145146>>> jsontext = """{
146147... "relations":[
147148... {
@@ -182,7 +183,7 @@ functions:
182183... }
183184... ]
184185... }"""
185- >>> substrait.json.parse_json( jsontext)
186+ >>> json_format.Parse(text= jsontext, mesage=Plan() )
186187relations {
187188 root {
188189 input {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11from substrait .sql .sql_to_substrait import convert
22import pyarrow
3- import substrait . json
3+ from google . protobuf import json_format
44import tempfile
55import pyarrow .substrait as pa_substrait
66import pytest
@@ -91,7 +91,7 @@ def duckdb_schema_resolver(name: str):
9191 conn .install_extension ("substrait" , repository = "community" )
9292 conn .load_extension ("substrait" )
9393
94- plan_json = substrait . json . dump_json (plan )
94+ plan_json = json_format . MessageToJson (plan )
9595 sql = f"CALL from_substrait_json('{ plan_json } ')"
9696
9797 substrait_out = conn .sql (sql )
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments