Skip to content

Commit

Permalink
[Fix] time scale (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
IHEII authored Jan 25, 2024
1 parent 4c09a73 commit 5177f36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/test_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ CREATE TABLE test_partition_aggregation (

CREATE TABLE test_time (
`c1` int NOT NULL,
`c2` datetime(6) DEFAULT NULL,
`c2` datetime DEFAULT NULL,
`c3` timestamp DEFAULT NULL,
PRIMARY KEY(`c1`)
);
9 changes: 7 additions & 2 deletions src/serde_obkv/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ impl ObjMeta {
ObjMeta::new(obj_type, CollationLevel::Numeric, CollationType::Binary, -1)
}

/// [`new_time_meta`] is for datetime and timestamp
pub fn new_time_meta(obj_type: ObjType) -> ObjMeta {
ObjMeta::new(obj_type, CollationLevel::Numeric, CollationType::Binary, 6)
}

fn default_obj_meta(t: ObjType) -> ObjMeta {
match t {
ObjType::Null => ObjMeta::new(t, CollationLevel::Ignorable, CollationType::Binary, 10),
Expand All @@ -267,8 +272,8 @@ impl ObjMeta {
ObjType::UDouble => ObjMeta::new_numeric_meta(t),
ObjType::Number => ObjMeta::new_numeric_meta(t),
ObjType::UNumber => ObjMeta::new_numeric_meta(t),
ObjType::DateTime => ObjMeta::new_numeric_meta(t),
ObjType::Timestamp => ObjMeta::new_numeric_meta(t),
ObjType::DateTime => ObjMeta::new_time_meta(t),
ObjType::Timestamp => ObjMeta::new_time_meta(t),
ObjType::Date => ObjMeta::new_numeric_meta(t),
ObjType::Time => ObjMeta::new_numeric_meta(t),
ObjType::Year => ObjMeta::new_numeric_meta(t),
Expand Down

0 comments on commit 5177f36

Please sign in to comment.