Closed killme2008 closed 1 week ago
The changes introduce functionality for handling column default values across various modules. This includes adding fields for column defaults in structs, implementing methods to manage these defaults, and testing the integration of column defaults in SQL operations. These modifications address a bug in the GreptimeDB query engine related to handling TIMESTAMP
columns with default values during data insertion.
File(s) | Change Summary |
---|---|
src/datatypes/Cargo.toml |
Added datafusion-expr.workspace = true . |
src/datatypes/src/schema.rs |
Introduced column_defaults in Schema struct, methods for retrieving defaults, and related tests. |
src/query/src/dummy_catalog.rs |
Added get_column_default method to TableProvider trait. |
src/table/Cargo.toml , tests-integration/Cargo.toml |
Added new dependencies (lazy_static , common-time.workspace ). |
src/table/src/table.rs |
Enhanced Table struct with column_defaults , added methods, helper functions for column defaults, and tests. |
tests-integration/tests/sql.rs |
Modified test_mysql_crud function to include default column values in table creation and test insertion. |
src/script/src/python/rspython/builtins/test.rs |
Corrected typo in comments for better clarity. |
Objective (Issue #4244) | Addressed | Explanation |
---|---|---|
Support data insertion without specifying ts column |
✅ | |
Ensure proper handling of default values for TIMESTAMP columns |
✅ | |
Verify functionality with placeholder ? in SQL operations |
✅ | |
Validate changes with relevant tests | ✅ |
In the world of code so bright and new, Default columns join the crew. Timestamps rise with no delay, Handling values, come what may. Insertions fly without a fear, The rabbits cheer, the path is clear! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 98.48485%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 84.69%. Comparing base (
ee9a5d7
) to head (6035c5a
). Report is 13 commits behind head on main.
@evenyag @waynexia PTAL
Remove the get_column_default
in DummyTableProvider
, looks like it's unnecessary.
Cache the column_defaults
in Table
and use Expr::ScalarFunction
for now
, and current_timestamp
default constraints.
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
Close #4244 , cc @zyy17
What's changed and what's your intention?
TableProvider#get_column_default
for adapters, which returns the column default value if available.column_defaults
field intoTable
, which is collected fromcolumn_schemas
when building table.Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores
Cargo.toml
files to include new workspace requirements.