-
Notifications
You must be signed in to change notification settings - Fork 206
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: infer timestamp constraint for single-timestamp column #1266
feat: infer timestamp constraint for single-timestamp column #1266
Conversation
This commit addresses issue apache#1144. It aims to automatically infer the timestamp column during table creation when possible. Previously, users had to explicitly set a timestamp constraint, adding unnecessary complexity. Now, the system will detect if there is only one timestamp column and set it as the constraint. - Added `build_and_check_timestamp_key_constraint` to check and infer. - Modified `create_table` to call the new function.
- Refactor test cases for `create_table` in `parser.rs` to align with the latest timestamp inference changes made in the previous commit. - Update the expected statements to include unique constraints for timestamp columns, as influenced by the modifications in timestamp inference.
The general implementation looks GOOD to me. 👍 I leave a few minor suggestions, do those make sense to you? |
- Rename from `build_and_check_timestamp_key_constraint` to `build_or_infer_timestamp_key_constraint` - Modify the function's comment
- Added a test case that includes two timestamp columns and explicitly selects the c2 field as the timestamp key. The test passes locally.
Thank you for the review and for your positive feedback! 👍 I've gone ahead and made some additional updates based on our discussion:
Your minor suggestions make complete sense to me, and I've taken them into account. Here's the link to the updated CI results. Please let me know if there's anything else to improve. |
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
Rationale
This PR aims to resolve issue #1144 by simplifying the process of table creation with timestamp constraints. Specifically, the system will automatically infer and set the timestamp constraint under the following conditions:
DataType::Timestamp
).By introducing this automatic inference, we reduce the complexity for users who otherwise would have to manually set this constraint.
Detailed Changes
Automatic Inference of Timestamp Constraint: The system now detects if there is only a single timestamp column during table creation and automatically sets it as the timestamp constraint.
build_and_check_timestamp_key_constraint
for checking and inference.create_table
function to call the new function.Updated Test Expectations for
create_table
:create_table
inparser.rs
to align with the latest timestamp inference changes.Test Plan
Utilized the default CI Action for testing. The result was a pass.
Remarks