-
Notifications
You must be signed in to change notification settings - Fork 94
feat(isthmus) support calcite 1.39.0 #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2ce9d6f to
1894fb1
Compare
isthmus/src/main/java/io/substrait/isthmus/SubstraitToCalcite.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/SqlConverterBase.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java
Outdated
Show resolved
Hide resolved
isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java
Outdated
Show resolved
Hide resolved
isthmus/src/test/java/io/substrait/isthmus/api/TestIsthmusEndToEnd.java
Outdated
Show resolved
Hide resolved
isthmus/src/test/java/io/substrait/isthmus/api/TestIsthmusEndToEnd.java
Outdated
Show resolved
Hide resolved
isthmus/src/test/java/io/substrait/isthmus/api/TestIsthmusEndToEnd.java
Outdated
Show resolved
Hide resolved
| public void substraitToSqlViaCalcite() throws IOException { | ||
|
|
||
| // create the protobuf substarit plan | ||
| byte[] planProtobuf = Resources.toByteArray(Resources.getResource("substrait_sql_003.plan")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other tests are using SubstraitBuilder to provide a Substrait plan for test cases which I think is more reliable than relying on a binary file in the tests resources which might have been encoded in an older version of the Substrait spec and which might break with future Substrait spec changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair point; will look at using that builder.
Signed-off-by: MBWhite <[email protected]> Update isthmus/src/test/java/io/substrait/isthmus/api/TestIsthmusEndToEnd.java Co-authored-by: Niels Pardon <[email protected]> Update isthmus/src/test/java/io/substrait/isthmus/api/TestIsthmusEndToEnd.java Co-authored-by: Niels Pardon <[email protected]> Update isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java Co-authored-by: Niels Pardon <[email protected]> Update isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java Co-authored-by: Niels Pardon <[email protected]> Update isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java Co-authored-by: Niels Pardon <[email protected]> Update isthmus/src/test/java/io/substrait/isthmus/api/TestIsthmusEndToEnd.java Co-authored-by: Niels Pardon <[email protected]> Update isthmus/src/main/java/io/substrait/isthmus/SubstraitCalciteSchema.java Co-authored-by: Niels Pardon <[email protected]>
|
How urgent is the 1.39 upgrade for you? If deprecating / removing the TableLookupAPI simplifies this, I'd be open to doing that first. I can take a look at that this week as I have some other changes around SQL handling that might simplify this as well. |
Not urgent - our 'version checker' wanted to bump the calcite version up, therefore this came up. No other reason to move to calcite version; just pre-empting a problem! No problem with dropping the lookup first; in fact I was thinking of adding an API to accept the Calcite 1.39 loopup API instead.. The function of a dynamic schema is still present; Interesting to see other SQL updates - there was one I was thinking of to make For reference it's this API that triggers the complexity public RelNode substraitRelToCalciteRel(
Rel relRoot, Function<List<String>, NamedStruct> tableLookup) |
|
#363 has been merged in. Hopefully it can simplify this update. |
|
replaced with PR #380 |
As a result of an (accidental) upgrade Calcite 1.39; conversions via Isthmus started to report that table names where unknown;
Isthmus has an external API that allows tables to be lookup via calls to a function - dynamic or 'lazy' lookup. A special subclass of the CalciteSimpleSchema was created to support this. This special subclass had to be in the same package as the CalciteSimpleSchema as it took advantage of being able to override a number of protected methods.
Calcite 1.39.0 introduced similar support for 'lazy' table lookups; that implementation, though changed the protected methods sufficiently Isthmus now failed (indeed rebuilding the code fails to compile).
This PR removes the special subclass, and allows Ishtmus to work as before; One complexity is how namespace tables are handled with the original Isthmus API, and Calcite new lookup API.
This does make the code a lot more complex; for future releases, a suggestion would be to deprecate this function interface and replace it with accepting the same Calcite lookup API.
SubstraitCalciteSchemais the replacement class; this is not an external but used internally; it's now using the Calcite lookup API