-
Couldn't load subscription status.
- Fork 176
[POC] Make PPL execute successfully on Calcite engine #3258
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
[POC] Make PPL execute successfully on Calcite engine #3258
Conversation
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.
@qianheng-aws is this PR plan for review?
Signed-off-by: Heng Qian <qianheng@amazon.com>
148b79c to
cf34fab
Compare
Yeah, but it should only be merged to the feature branch |
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.
This PR ensure CalciteStandaloneIT passes?
- Could u refine the PR description? Make Calcite execute is generic.
- Could u enable CalciteStandaloneIT, and disable other PPL ITs. we expected IT should passed.
| RelNode rel, CalcitePlanContext context, ResponseListener<QueryResponse> listener) { | ||
| try (PreparedStatement statement = RelRunners.run(rel)) { | ||
| Connection connection = context.connection; | ||
| final RelShuttle shuttle = new RelHomogeneousShuttle(); |
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.
does it required?
| @Override | ||
| public Table get(Object key) { | ||
| if (!super.containsKey(key)) { | ||
| registerTable((String) key); |
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.
could we do registerTable(new QualifiedName((String)key)) instead?
| try { | ||
| this.statement = connection.createStatement().unwrap(CalciteServerStatement.class); | ||
| } catch (Exception e) { | ||
| throw new RuntimeException("create statement failed", e); | ||
| } | ||
| this.prepare = new CalcitePrepareImpl(); | ||
| this.relBuilder = prepare.perform(statement, config, | ||
| (cluster, relOptSchema, rootSchema, statement) -> new OSRelBuilder(config.getContext(), | ||
| cluster, relOptSchema)); |
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.
could u help explain the purpose this statement?
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.
It aims to construct a relBuilder with the same logic as RelBuilder.create(config) while reusing the same statement created by connection.
I've removed this change because I realized that I just need to reuse the schema of connection and I've set that schema into the config by my second commit.
…ble when visitRelation. Signed-off-by: Heng Qian <qianheng@amazon.com>
Signed-off-by: Heng Qian <qianheng@amazon.com>
cf34fab to
8ad5251
Compare
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.
LGTM except a less comments
| this.connection = connection; | ||
| try { | ||
| this.statement = connection.createStatement().unwrap(CalciteServerStatement.class); | ||
| } catch (Exception e) { |
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.
minor: this try-catch is for unwrap or createStatement failure, better to separate the NPE out, or else mass of UT will go through via NPE here.
if (connection != null) {
// try-catch block
}
| } | ||
|
|
||
| public abstract Enumerable<ExprValue> search(); | ||
| public abstract Enumerable<Object> search(); |
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.
What's reason to replace ExprValue?
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.
It will throw exception and says that ExprValue is loaded in app classloader while Object is loaded in bootstrap classloader.
Signed-off-by: Heng Qian <qianheng@amazon.com>
1314a31
into
opensearch-project:feature/calcite-engine
…ject#3258) * [POC] Make Calcite execute successfully Signed-off-by: Heng Qian <qianheng@amazon.com> * [POC] Change caching schema to simple schema and avoid registering table when visitRelation. Signed-off-by: Heng Qian <qianheng@amazon.com> * spotlessApply Signed-off-by: Heng Qian <qianheng@amazon.com> * address comments Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com>
* [POC] Make Calcite execute successfully Signed-off-by: Heng Qian <qianheng@amazon.com> * [POC] Change caching schema to simple schema and avoid registering table when visitRelation. Signed-off-by: Heng Qian <qianheng@amazon.com> * spotlessApply Signed-off-by: Heng Qian <qianheng@amazon.com> * address comments Signed-off-by: Heng Qian <qianheng@amazon.com> --------- Signed-off-by: Heng Qian <qianheng@amazon.com> Signed-off-by: xinyual <xinyual@amazon.com>
Description
Before this PR, PPL plan will fail executing on calcite engine and fallback to the original v2 engine. This PR aims to make the plan execute successfully on calcite engine.
The changes includes:
Related Issues
Resolves #3307
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.