Skip to content

Conversation

@LantaoJin
Copy link
Member

@LantaoJin LantaoJin commented Feb 11, 2025

Description

This PR includes 5 changes:

  1. Introduce OpenSearchTypeSystem (partial code) to address the type mismatch issue in Agg
  2. Using AccessController to workaround the CI failures caused by java security.
  3. Add parameters to enable calcite codegen and debug, ref https://janino-compiler.github.io/janino/#debugging
  4. Refactor Calcite integration tests, now we have both integration test CalcitePPL*IT and unit test CalcitePPL*Test for each command.
  5. Fix bugs in OpenSearchIndexEnumerator

Related Issues

Partially Resolves #3308

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: Lantao Jin <ltjin@amazon.com>
@LantaoJin
Copy link
Member Author

LantaoJin commented Feb 12, 2025

Ping @qianheng-aws. We may merge PR to dev branch ASAP to unblock peer's tasks. cc @penghuo @dai-chen , you can review and comment regardless of whether PR is merged or not. We will address them in followups.

@LantaoJin LantaoJin changed the title Make basic aggregation working (partial) Make basic aggregation working (part 1) Feb 12, 2025
@penghuo penghuo added the calcite calcite migration releated label Feb 13, 2025
return typeFactory.createSqlType(SqlTypeName.DOUBLE);

default:
return super.deriveSumType(typeFactory, argumentType);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why default to deriveSumType instead of deriveAvgAggType?

Comment on lines +21 to +23
case INTEGER:
case BIGINT:
return typeFactory.createSqlType(SqlTypeName.DOUBLE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it a bug in Calcite? if the argumentType is INTEGER, deriveAvgAggType is INTEGER?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, for example table1:

id
1
2
3
4

select avg(id) from table1 returns 2 instead of 2.5.

Not sure it is a bug or by designed. From semantic purpose, query avg on an id column is semantic wrong. The column which could be applied avg should be designed as decimal number. Will open a Calcite issue for checking.

@LantaoJin LantaoJin merged commit e7188da into opensearch-project:feature/calcite-engine Feb 13, 2025
9 of 14 checks passed
penghuo pushed a commit to penghuo/os-sql that referenced this pull request Mar 12, 2025
* Make basic aggregation working (partial)

Signed-off-by: Lantao Jin <ltjin@amazon.com>

* add a settings to enable calcite

Signed-off-by: Lantao Jin <ltjin@amazon.com>

* add more UTs

Signed-off-by: Lantao Jin <ltjin@amazon.com>

---------

Signed-off-by: Lantao Jin <ltjin@amazon.com>
penghuo pushed a commit that referenced this pull request Jun 16, 2025
* Make basic aggregation working (partial)

Signed-off-by: Lantao Jin <ltjin@amazon.com>

* add a settings to enable calcite

Signed-off-by: Lantao Jin <ltjin@amazon.com>

* add more UTs

Signed-off-by: Lantao Jin <ltjin@amazon.com>

---------

Signed-off-by: Lantao Jin <ltjin@amazon.com>
Signed-off-by: xinyual <xinyual@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

calcite calcite migration releated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants