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

feat(datatype): datatype timestamp with precision #4997

Merged
merged 2 commits into from
Apr 22, 2022

Conversation

Veeupup
Copy link
Contributor

@Veeupup Veeupup commented Apr 22, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

  • alias datatype timestamp alias to datetime and timestamp(n) can have precision like datetime(n)
  • default timestamp precision is 6.

Changelog

  • New Feature

Related Issues

Fixes #4994

Signed-off-by: Veeupup <code@tanweime.com>
Signed-off-by: Veeupup <code@tanweime.com>
@vercel
Copy link

vercel bot commented Apr 22, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Apr 22, 2022 at 3:59AM (UTC)

@Veeupup Veeupup requested review from sundy-li and b41sh April 22, 2022 03:59
@mergify
Copy link
Contributor

mergify bot commented Apr 22, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Apr 22, 2022
@BohuTANG
Copy link
Member

Cool.
It would be great to add some datetime cast or bound check in the file(it's empty now):
https://github.com/datafuselabs/databend/blob/main/tests/suites/0_stateless/11_data_type/11_0001_data_type_date_time.sql

@Veeupup
Copy link
Contributor Author

Veeupup commented Apr 22, 2022

Cool.
It would be great to add some datetime cast or bound check in the file(it's empty now):

https://github.com/datafuselabs/databend/blob/main/tests/suites/0_stateless/11_data_type/[11_0001_data_type_date_time.sql
]

(#4874)
Maybe this can be fixed with this issue

@BohuTANG
Copy link
Member

Cool.
It would be great to add some datetime cast or bound check in the file(it's empty now):

[https://github.com/datafuselabs/databend/blob/main/tests/suites/0_stateless/11_data_type/11_0001_data_type_date_time.sql ]

(#4874) Maybe this can be fixed with this issue

Ok, let's merge :D

@BohuTANG BohuTANG merged commit a5832f5 into databendlabs:main Apr 22, 2022
@b41sh
Copy link
Member

b41sh commented Apr 22, 2022

@Veeupup The default precision of datetime has changed, so the documentation also needs to be modified.
https://github.com/datafuselabs/databend/blob/main/docs/doc/30-reference/10-data-types/20-data-type-time-date-types.md

@BohuTANG
Copy link
Member

@Veeupup The default precision of datetime has changed, so the documentation also needs to be modified. https://github.com/datafuselabs/databend/blob/main/docs/doc/30-reference/10-data-types/20-data-type-time-date-types.md

I will do that, not only the datatype also some examples.

@BohuTANG
Copy link
Member

BohuTANG commented Apr 23, 2022

DATETIME should be an alias for TIMESTAMP, now databend TIMESTAMP is an alias for DATETIME.

mysql> create table t2(a timestamp);
Query OK, 0 rows affected (0.07 sec)
Read 0 rows, 0 B in 0.019 sec., 0 rows/sec., 0 B/sec.

mysql> desc t2;
+-------+-------------+------+---------+-------+
| Field | Type        | Null | Default | Extra |
+-------+-------------+------+---------+-------+
| a     | DATETIME(6) | NO   | 0       |       |
+-------+-------------+------+---------+-------+

See:
https://docs.snowflake.com/en/sql-reference/data-types-datetime.html#datetime
https://duckdb.org/docs/sql/data_types/timestamp
https://www.cockroachlabs.com/docs/stable/timestamp.html (CRDB has no DATETIME type)

cc @Veeupup @sundy-li

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What will the datetime data type
5 participants