feat: example on optimizing with calcite'#776
Open
mbwhite wants to merge 3 commits intosubstrait-io:mainfrom
Open
feat: example on optimizing with calcite'#776mbwhite wants to merge 3 commits intosubstrait-io:mainfrom
mbwhite wants to merge 3 commits intosubstrait-io:mainfrom
Conversation
Signed-off-by: MBWhite <whitemat@uk.ibm.com>
Signed-off-by: MBWhite <whitemat@uk.ibm.com>
nielspardon
reviewed
Apr 14, 2026
| * <p>This example follows the same structure as the "ToSql" example but shows how the | ||
| * ConverterProvider can be subclassed to update the Calcite configuration. | ||
| * | ||
| * <p>This case how the HepPlanner can be used to optimize the plan before it's conversion to SQL. |
Member
There was a problem hiding this comment.
Suggested change
| * <p>This case how the HepPlanner can be used to optimize the plan before it's conversion to SQL. | |
| * <p>This shows how the HepPlanner can be used to optimize the plan before it's conversion to SQL. |
nielspardon
reviewed
Apr 14, 2026
| static final class OptimizingConverterProvider extends ConverterProvider { | ||
|
|
||
| /** | ||
| * Set of calcite rules to use. |
Member
There was a problem hiding this comment.
Suggested change
| * Set of calcite rules to use. | |
| * Set of Calcite rules to use. |
nielspardon
reviewed
Apr 14, 2026
| .addRuleCollection(simplificationRules()); | ||
|
|
||
| final RelOptPlanner hepPlanner = new HepPlanner(programBuilder.build()); | ||
| // convert the substrait to the calcite relation tree |
Member
There was a problem hiding this comment.
Suggested change
| // convert the substrait to the calcite relation tree | |
| // convert the Substrait to the Calcite relation tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An example of how the ConverterProvider can be subclassed to inject custom calcite behaviour. In this case how the Calcite HepPlanner can be used to optimize the query plan before conversion to SQL.
note this is the cleanest way I could find to implement this.