Skip to content

Commit 2a35711

Browse files
committed
Support Interval DataType
:) select to_interval('02:01'), to_interval('1 year 1 day 1 hour'); ┌───────────────────────────────────────────────────────────┐ │ to_interval('02:01') │ to_interval('1 year 1 day 1 hour') │ │ Interval │ Interval │ ├──────────────────────┼────────────────────────────────────┤ │ 2:01:00 │ 1year 1day 1:00:00 │ └───────────────────────────────────────────────────────────┘
1 parent 35c1c24 commit 2a35711

File tree

50 files changed

+1304
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1304
-13
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/column/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ column-default = [
2121
]
2222

2323
[dependencies]
24-
24+
borsh = { workspace = true, features = ["derive"] }
2525
databend-common-base = { workspace = true }
2626
databend-common-exception = { workspace = true }
2727

src/common/column/src/types/native.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ use std::convert::TryFrom;
1717
use std::ops::Neg;
1818
use std::panic::RefUnwindSafe;
1919

20+
use borsh::BorshDeserialize;
21+
use borsh::BorshSerialize;
2022
use bytemuck::Pod;
2123
use bytemuck::Zeroable;
2224
use databend_common_base::base::OrderedFloat;
25+
use serde_derive::Deserialize;
26+
use serde_derive::Serialize;
2327

2428
use super::PrimitiveType;
2529

@@ -243,7 +247,22 @@ impl NativeType for days_ms {
243247
}
244248

245249
/// The in-memory representation of the MonthDayNano variant of the "Interval" logical type.
246-
#[derive(Debug, Copy, Clone, Default, PartialEq, Eq, Hash, Zeroable, Pod)]
250+
#[derive(
251+
Debug,
252+
Copy,
253+
Clone,
254+
Default,
255+
PartialEq,
256+
PartialOrd,
257+
Eq,
258+
Hash,
259+
Zeroable,
260+
Pod,
261+
Serialize,
262+
Deserialize,
263+
BorshSerialize,
264+
BorshDeserialize,
265+
)]
247266
#[allow(non_camel_case_types)]
248267
#[repr(C)]
249268
pub struct months_days_ns(pub i32, pub i32, pub i64);

0 commit comments

Comments
 (0)