Skip to content

Commit 33d3e58

Browse files
committed
chore(query): Set the default value of enable_experimental_virtual_column as true
1 parent 5a68f14 commit 33d3e58

File tree

20 files changed

+502
-376
lines changed

20 files changed

+502
-376
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ backtrace = { git = "https://github.com/rust-lang/backtrace-rs.git", rev = "7226
657657
color-eyre = { git = "https://github.com/eyre-rs/eyre.git", rev = "e5d92c3" }
658658
deltalake = { git = "https://github.com/delta-io/delta-rs", rev = "9954bff" }
659659
display-more = { git = "https://github.com/databendlabs/display-more", tag = "v0.2.0" }
660+
jsonb = { git = "https://github.com/b41sh/jsonb", rev = "ef5482fe9c07d87daa84115b86fd9af55dea277c" }
660661
map-api = { git = "https://github.com/databendlabs/map-api", tag = "v0.4.2" }
661662
openraft = { git = "https://github.com/databendlabs/openraft", tag = "v0.10.0-alpha.9" }
662663
orc-rust = { git = "https://github.com/datafuse-extras/orc-rust", rev = "d82aa6d" }

src/meta/proto-conv/src/schema_from_to_protobuf_impl.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,13 @@ impl FromToProtoEnum for ex::VariantDataType {
484484
variant_data_type::Dt::ArrayT(dt) => {
485485
ex::VariantDataType::Array(Box::new(ex::VariantDataType::from_pb_enum(*dt)?))
486486
}
487+
variant_data_type::Dt::DecimalT(dt) => {
488+
ex::VariantDataType::Decimal(ex::types::decimal::DecimalDataType::from_pb(dt)?)
489+
}
490+
variant_data_type::Dt::BinaryT(_) => ex::VariantDataType::Binary,
491+
variant_data_type::Dt::DateT(_) => ex::VariantDataType::Date,
492+
variant_data_type::Dt::TimestampT(_) => ex::VariantDataType::Timestamp,
493+
variant_data_type::Dt::IntervalT(_) => ex::VariantDataType::Interval,
487494
})
488495
}
489496

@@ -498,6 +505,14 @@ impl FromToProtoEnum for ex::VariantDataType {
498505
VariantDataType::Array(dt) => {
499506
pb::variant_data_type::Dt::ArrayT(Box::new(dt.to_pb_enum()?))
500507
}
508+
VariantDataType::Decimal(n) => {
509+
let x = n.to_pb()?;
510+
pb::variant_data_type::Dt::DecimalT(x)
511+
}
512+
VariantDataType::Binary => pb::variant_data_type::Dt::BinaryT(pb::Empty {}),
513+
VariantDataType::Date => pb::variant_data_type::Dt::DateT(pb::Empty {}),
514+
VariantDataType::Timestamp => pb::variant_data_type::Dt::TimestampT(pb::Empty {}),
515+
VariantDataType::Interval => pb::variant_data_type::Dt::IntervalT(pb::Empty {}),
501516
};
502517

503518
Ok(pb::VariantDataType { dt: Some(dt) })

src/meta/protos/proto/virtual_schema.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ message VariantDataType {
3232
Empty float64_t = 5;
3333
Empty string_t = 6;
3434
VariantDataType array_t = 7;
35+
Decimal decimal_t = 8;
36+
Empty binary_t = 9;
37+
Empty date_t = 10;
38+
Empty timestamp_t = 11;
39+
Empty interval_t = 12;
3540
}
3641
}
3742

src/query/ee/tests/it/storages/fuse/operations/virtual_columns.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ async fn test_fuse_do_refresh_virtual_column() -> Result<()> {
3434
.default_session()
3535
.get_settings()
3636
.set_data_retention_time_in_days(0)?;
37-
fixture
38-
.default_session()
39-
.get_settings()
40-
.set_enable_experimental_virtual_column(1)?;
4137
fixture.create_default_database().await?;
4238
fixture.create_variant_table().await?;
4339

src/query/ee/tests/it/storages/fuse/operations/virtual_columns_builder.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use std::str::FromStr;
1616

1717
use databend_common_base::base::tokio;
1818
use databend_common_exception::Result;
19+
use databend_common_expression::types::DecimalDataType;
20+
use databend_common_expression::types::DecimalSize;
1921
use databend_common_expression::types::Int32Type;
2022
use databend_common_expression::types::VariantType;
2123
use databend_common_expression::ColumnId;
@@ -32,11 +34,6 @@ use jsonb::OwnedJsonb;
3234
#[tokio::test(flavor = "multi_thread")]
3335
async fn test_virtual_column_builder() -> Result<()> {
3436
let fixture = TestFixture::setup_with_custom(EESetup::new()).await?;
35-
36-
fixture
37-
.default_session()
38-
.get_settings()
39-
.set_enable_experimental_virtual_column(1)?;
4037
fixture.create_default_database().await?;
4138
fixture.create_variant_table().await?;
4239

@@ -247,7 +244,10 @@ async fn test_virtual_column_builder() -> Result<()> {
247244
"['geo']['lat']",
248245
)
249246
.unwrap();
250-
assert_eq!(meta_geo_lat.data_type, VariantDataType::Jsonb);
247+
assert_eq!(
248+
meta_geo_lat.data_type,
249+
VariantDataType::Decimal(DecimalDataType::from(DecimalSize::new_unchecked(18, 1)))
250+
);
251251

252252
let entries = vec![
253253
Int32Type::from_data(vec![1, 2, 3, 4, 5, 6, 7, 8]).into(),
@@ -316,11 +316,6 @@ async fn test_virtual_column_builder() -> Result<()> {
316316
#[tokio::test(flavor = "multi_thread")]
317317
async fn test_virtual_column_builder_stream_write() -> Result<()> {
318318
let fixture = TestFixture::setup_with_custom(EESetup::new()).await?;
319-
320-
fixture
321-
.default_session()
322-
.get_settings()
323-
.set_enable_experimental_virtual_column(1)?;
324319
fixture.create_default_database().await?;
325320
fixture.create_variant_table().await?;
326321

src/query/expression/src/schema.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub struct DataSchema {
149149
pub(crate) metadata: BTreeMap<String, String>,
150150
}
151151

152-
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)]
152+
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
153153
pub enum VariantDataType {
154154
Jsonb,
155155
Boolean,
@@ -158,6 +158,11 @@ pub enum VariantDataType {
158158
Float64,
159159
String,
160160
Array(Box<VariantDataType>),
161+
Decimal(DecimalDataType),
162+
Binary,
163+
Date,
164+
Timestamp,
165+
Interval,
161166
}
162167

163168
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]

src/query/expression/src/types/decimal.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,8 @@ impl Decimal for i256 {
15411541
Copy,
15421542
PartialEq,
15431543
Eq,
1544+
PartialOrd,
1545+
Ord,
15441546
Hash,
15451547
Serialize,
15461548
Deserialize,

src/query/expression/src/utils/display.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,11 @@ impl Display for VariantDataType {
734734
VariantDataType::Float64 => write!(f, "Float64"),
735735
VariantDataType::String => write!(f, "String"),
736736
VariantDataType::Array(inner) => write!(f, "Array({inner})"),
737+
VariantDataType::Decimal(inner) => write!(f, "Decimal({inner})"),
738+
VariantDataType::Binary => write!(f, "Binary"),
739+
VariantDataType::Date => write!(f, "Date"),
740+
VariantDataType::Timestamp => write!(f, "Timestamp"),
741+
VariantDataType::Interval => write!(f, "Interval"),
737742
}
738743
}
739744
}

src/query/settings/src/settings_default.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,13 +1079,6 @@ impl DefaultSettings {
10791079
scope: SettingScope::Both,
10801080
range: Some(SettingRange::String(vec!["None".into(), "LZ4".into(), "ZSTD".into()])),
10811081
}),
1082-
("enable_refresh_virtual_column_after_write", DefaultSettingValue {
1083-
value: UserSettingValue::UInt64(1),
1084-
desc: "Refresh virtual column after new data written",
1085-
mode: SettingMode::Both,
1086-
scope: SettingScope::Both,
1087-
range: Some(SettingRange::Numeric(0..=1)),
1088-
}),
10891082
("enable_refresh_aggregating_index_after_write", DefaultSettingValue {
10901083
value: UserSettingValue::UInt64(1),
10911084
desc: "Refresh aggregating index after new data written",
@@ -1446,7 +1439,7 @@ impl DefaultSettings {
14461439
range: Some(SettingRange::Numeric(1..=1024)),
14471440
}),
14481441
("enable_experimental_virtual_column", DefaultSettingValue {
1449-
value: UserSettingValue::UInt64(0),
1442+
value: UserSettingValue::UInt64(1),
14501443
desc: "Enables experimental virtual column",
14511444
mode: SettingMode::Both,
14521445
scope: SettingScope::Both,

0 commit comments

Comments
 (0)