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

Support timestamp(n) SQL type #13231

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

findepi
Copy link
Member

@findepi findepi commented Nov 2, 2024

Relates to #13230

@github-actions github-actions bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels Nov 2, 2024
@findepi findepi changed the title Support timestamp(n) type Support timestamp(n) SQL type Nov 2, 2024
@@ -466,7 +467,14 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
// Timestamp Without Time zone
None
};
Ok(DataType::Timestamp(TimeUnit::Nanosecond, tz.map(Into::into)))
let precision = match precision {
Copy link
Member

@caicancai caicancai Nov 2, 2024

Choose a reason for hiding this comment

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

Can I assume this is the standard between vector api and precision?

I am currently working on a similar problem in the process of adapting Arrow in the Calcite community.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

This looks great to me -- thank you @findepi -- it will be amazing to be able to specify the timestamp precision via SQL

2020-09-08T13:42:29.190855123

query P rowsort
SELECT CAST(ts AS timestamp(0)) FROM ts_data_nanos;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very cool 👍

Copy link
Member

@caicancai caicancai Nov 3, 2024

Choose a reason for hiding this comment

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

Thanks. The Calcite Arrow adapter will also comply with this standard

@alamb alamb merged commit 49b9351 into apache:main Nov 4, 2024
25 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 4, 2024

Thanks again @findepi

@findepi findepi deleted the findepi/support-timestamp-n-type-a384c2 branch November 4, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants