Skip to content
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

[FEATURE] Calcite Engine Framework: Date/Time/Timestamp type handling #3341

Open
LantaoJin opened this issue Feb 20, 2025 · 0 comments
Open
Labels
bug Something isn't working calcite calcite migration releated

Comments

@LantaoJin
Copy link
Member

LantaoJin commented Feb 20, 2025

Is your feature request related to a problem?
Calcite uses Linq4j enumerator to execute the Java codegen code. The code generated Java code contains Java type factory to map calcite type to Java type, Ref https://github.com/apache/calcite/blob/130c8dcacd2a2e8e44aa37c3832db063af66dd0f/core/src/main/java/org/apache/calcite/jdbc/JavaTypeFactoryImpl.java#L173.

For Date/Time/Timestamp types, the generated Java code is Long. But in OpenSearch Date type, it could contain multiple formats, such as strict_date_time_no_millis || strict_date_optional_time || epoch_millis, ref https://opensearch.org/docs/latest/field-types/supported-field-types/date/#default-format. It means the data fetched from OpenSearch could be "2019-03-23T21:34:46-04:00" or 1553391286000.

Now calcite doesn't provide an interface to override its default JavaTypeFactoryImpl, which leads to any OpenSearch date type data (whatever "2019-03-23T21:34:46-04:00" or 1553391286000) have to cast to Long.

What solution would you like?
There are three options

  1. Add an interface to override the default JavaTypeFactoryImpl in Calcite (PR for Calcite)
  2. Classpath Override (Shadow/Shade)
  3. Convert to string by default and add a custom DateString in plan

What alternatives have you considered?
A clear and concise description of any alternative solutions or features you've considered.

Do you have any additional context?
Add any other context or screenshots about the feature request here.

@LantaoJin LantaoJin added bug Something isn't working calcite calcite migration releated untriaged and removed untriaged labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working calcite calcite migration releated
Projects
None yet
Development

No branches or pull requests

1 participant