Skip to content

Commit 17a7206

Browse files
authored
Merge branch 'main' into bump-opendal-54.1
2 parents 4729c45 + 9a27184 commit 17a7206

File tree

110 files changed

+3662
-1017
lines changed

Some content is hidden

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

110 files changed

+3662
-1017
lines changed

.github/workflows/reuse.sqllogic.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,14 @@ jobs:
9090
- "${{ inputs.runner_provider }}"
9191
steps:
9292
- uses: actions/checkout@v4
93+
- name: Setup uv
94+
uses: astral-sh/setup-uv@v7
95+
- uses: ./.github/actions/setup_minio
9396
- name: Start UDF Server
97+
working-directory: tests/udf
9498
run: |
95-
docker run -d --name minio -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin quay.io/minio/minio server /data --console-address ":9001"
96-
pip install databend-udf>=0.2.7
97-
python3 tests/udf/udf_server.py &
99+
uv sync
100+
uv run python udf_server.py &
98101
sleep 2
99102
- uses: ./.github/actions/test_sqllogic_standalone_linux
100103
timeout-minutes: 15
@@ -118,10 +121,13 @@ jobs:
118121
- "${{ inputs.runner_provider }}"
119122
steps:
120123
- uses: actions/checkout@v4
124+
- name: Setup uv
125+
uses: astral-sh/setup-uv@v7
121126
- name: Start Cloud Control Server
127+
working-directory: tests/cloud_control_server
122128
run: |
123-
pip install grpcio grpcio-reflection protobuf grpcio-tools
124-
python3 tests/cloud_control_server/simple_server.py &
129+
uv sync
130+
uv run python simple_server.py &
125131
sleep 2
126132
- uses: ./.github/actions/test_cloud_sqllogic_standalone_linux
127133
timeout-minutes: 15

Cargo.lock

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

scripts/ci/ci-setup-chaos-meta.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -ex
66

77
BUILD_PROFILE=${BUILD_PROFILE:-debug}
88

9-
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.6.0 bash
9+
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.8.3 bash
1010
k3d registry create registry.localhost --port 0.0.0.0:5111 -i registry:latest
1111
k3d cluster create --config ./scripts/ci/meta-chaos/k3d.yaml meta-chaos
1212

@@ -16,7 +16,7 @@ if kubectl version --client; then
1616
echo "kubectl client already installed"
1717
else
1818
echo "install kubectl client"
19-
curl -LO "https://dl.k8s.io/release/v1.29.5/bin/linux/amd64/kubectl"
19+
curl -LO "https://dl.k8s.io/release/v1.34.1/bin/linux/amd64/kubectl"
2020
chmod +x kubectl
2121
sudo mv kubectl /usr/local/bin/
2222
fi

scripts/ci/deploy/config/databend-query-node-2.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ definition = "CREATE FUNCTION ping(STRING) RETURNS STRING LANGUAGE python HANDLE
5656
[log]
5757

5858
[log.file]
59-
level = "INFO"
59+
level = "DEBUG"
6060
format = "text"
6161
dir = "./.databend/logs_2"
6262
limit = 12 # 12 files, 1 file per hour

scripts/ci/deploy/config/databend-query-node-3.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ definition = "CREATE FUNCTION ping(STRING) RETURNS STRING LANGUAGE python HANDLE
5757
[log]
5858

5959
[log.file]
60-
level = "INFO"
60+
level = "DEBUG"
6161
format = "text"
6262
limit = 12 # 12 files, 1 file per hour
6363
dir = "./.databend/logs_3"

scripts/ci/meta-chaos/k3d.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Simple
33
metadata:
44
name: single
55
servers: 1
6-
image: rancher/k3s:v1.29.5-k3s1
6+
image: rancher/k3s:v1.34.1-k3s1
77
ports:
88
- port: 8888:80
99
nodeFilters:

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

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ impl Neg for months_days_micros {
440440
}
441441
}
442442

443-
/// The in-memory representation of the MonthDayNano variant of the "Interval" logical type.
444443
#[derive(
445444
Debug,
446445
Copy,
@@ -460,12 +459,12 @@ pub struct timestamp_tz(pub i128);
460459

461460
impl Hash for timestamp_tz {
462461
fn hash<H: Hasher>(&self, state: &mut H) {
463-
self.total_micros().hash(state)
462+
self.timestamp().hash(state)
464463
}
465464
}
466465
impl PartialEq for timestamp_tz {
467466
fn eq(&self, other: &Self) -> bool {
468-
self.total_micros() == other.total_micros()
467+
self.timestamp() == other.timestamp()
469468
}
470469
}
471470
impl PartialOrd for timestamp_tz {
@@ -476,17 +475,18 @@ impl PartialOrd for timestamp_tz {
476475

477476
impl Ord for timestamp_tz {
478477
fn cmp(&self, other: &Self) -> Ordering {
479-
let total_micros = self.total_micros();
480-
let other_micros = other.total_micros();
481-
total_micros.cmp(&other_micros)
478+
let timestamp = self.timestamp();
479+
let other_micros = other.timestamp();
480+
timestamp.cmp(&other_micros)
482481
}
483482
}
484483

485484
impl timestamp_tz {
486485
pub const MICROS_PER_SECOND: i64 = 1_000_000;
487486

487+
#[inline]
488488
pub fn new(timestamp: i64, offset: i32) -> Self {
489-
let ts = timestamp as u64 as i128; // <- 中间加一次 u64 屏蔽符号位
489+
let ts = timestamp as u64 as i128;
490490
let off = (offset as i128) << 64;
491491
Self(off | ts)
492492
}
@@ -507,32 +507,19 @@ impl timestamp_tz {
507507
}
508508

509509
#[inline]
510-
pub fn hours_offset(&self) -> i8 {
511-
(self.seconds_offset() / 3600) as i8
510+
pub fn micros_offset_inner(seconds: i64) -> Option<i64> {
511+
seconds.checked_mul(Self::MICROS_PER_SECOND)
512512
}
513513

514514
#[inline]
515-
pub fn total_micros(&self) -> i64 {
516-
self.try_total_micros().unwrap_or_else(|| {
517-
error!(
518-
"interval is out of range: timestamp={}, offset={}",
519-
self.timestamp(),
520-
self.seconds_offset()
521-
);
522-
0
523-
})
524-
}
525-
526-
#[inline]
527-
pub fn try_total_micros(&self) -> Option<i64> {
528-
let offset_micros = self.micros_offset()?;
529-
self.timestamp().checked_sub(offset_micros)
515+
pub fn hours_offset(&self) -> i8 {
516+
(self.seconds_offset() / 3600) as i8
530517
}
531518
}
532519

533520
impl Display for timestamp_tz {
534521
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
535-
let timestamp = Timestamp::from_microsecond(self.total_micros()).unwrap();
522+
let timestamp = Timestamp::from_microsecond(self.timestamp()).unwrap();
536523

537524
let offset = tz::Offset::from_seconds(self.seconds_offset()).unwrap();
538525
let string = strtime::format(

src/meta/api/src/data_mask_api_impl.rs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use databend_common_meta_app::data_mask::MaskPolicyTableIdListIdent;
2525
use databend_common_meta_app::data_mask::MaskpolicyTableIdList;
2626
use databend_common_meta_app::id_generator::IdGenerator;
2727
use databend_common_meta_app::row_access_policy::RowAccessPolicyNameIdent;
28-
use databend_common_meta_app::schema::CreateOption;
2928
use databend_common_meta_app::tenant::Tenant;
3029
use databend_common_meta_app::tenant_key::errors::ExistError;
3130
use databend_common_meta_app::KeyWithTenant;
@@ -71,31 +70,6 @@ impl<KV: kvapi::KVApi<Error = MetaError>> DatamaskApi for KV {
7170

7271
let mut txn = TxnRequest::default();
7372

74-
let res = self.get_id_and_value(name_ident).await?;
75-
debug!(res :? = res, name_key :? =(name_ident); "create_data_mask");
76-
77-
let mut curr_seq = 0;
78-
79-
if let Some((seq_id, seq_meta)) = res {
80-
match req.create_option {
81-
CreateOption::Create => {
82-
return Ok(Err(
83-
name_ident.exist_error(format!("{} already exists", req.name))
84-
));
85-
}
86-
CreateOption::CreateIfNotExists => {
87-
return Ok(Ok(CreateDatamaskReply { id: *seq_id.data }));
88-
}
89-
CreateOption::CreateOrReplace => {
90-
let id_ident = seq_id.data.into_t_ident(name_ident.tenant());
91-
92-
txn_delete_exact(&mut txn, &id_ident, seq_meta.seq);
93-
94-
curr_seq = seq_id.seq;
95-
}
96-
};
97-
}
98-
9973
// Create data mask by inserting these record:
10074
// name -> id
10175
// id -> policy
@@ -114,7 +88,7 @@ impl<KV: kvapi::KVApi<Error = MetaError>> DatamaskApi for KV {
11488
{
11589
let meta: DatamaskMeta = req.data_mask_meta.clone();
11690
let id_list = MaskpolicyTableIdList::default();
117-
txn.condition.push(txn_cond_eq_seq(name_ident, curr_seq));
91+
txn.condition.push(txn_cond_eq_seq(name_ident, 0));
11892
txn.condition
11993
.push(txn_cond_eq_seq(&row_access_name_ident, 0));
12094
txn.if_then.extend(vec![

src/meta/api/src/row_access_policy_api_impl.rs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,6 @@ impl<KV: kvapi::KVApi<Error = MetaError>> RowAccessPolicyApi for KV {
7070
let policy_id = RowAccessPolicyId::new(row_access_id);
7171
let mut txn = TxnRequest::default();
7272

73-
let res = self.get_id_and_value(name_ident).await?;
74-
debug!(res :? = res, name_key :? =(name_ident); "create_row_access");
75-
76-
let mut curr_seq = 0;
77-
78-
if let Some((seq_id, seq_meta)) = res {
79-
if req.can_replace {
80-
let id_ident = seq_id.data.into_t_ident(name_ident.tenant());
81-
82-
txn_delete_exact(&mut txn, &id_ident, seq_meta.seq);
83-
84-
// TODO(eason): need to remove row policy from table meta
85-
86-
curr_seq = seq_id.seq;
87-
} else {
88-
return Ok(Err(name_ident.exist_error(func_name!())));
89-
}
90-
}
91-
9273
// Create row policy by inserting these record:
9374
// name -> id
9475
// id -> policy
@@ -103,7 +84,7 @@ impl<KV: kvapi::KVApi<Error = MetaError>> RowAccessPolicyApi for KV {
10384

10485
{
10586
let meta: RowAccessPolicyMeta = req.row_access_policy_meta.clone();
106-
txn.condition.push(txn_cond_eq_seq(name_ident, curr_seq));
87+
txn.condition.push(txn_cond_eq_seq(name_ident, 0));
10788
txn.condition.push(txn_cond_eq_seq(&mask_name_ident, 0));
10889
txn.if_then.extend(vec![
10990
txn_op_put_pb(name_ident, &policy_id, None)?, // name -> policy_id

src/meta/api/src/schema_api_test_suite.rs

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use databend_common_expression::VIRTUAL_COLUMNS_LIMIT;
3737
use databend_common_expression::VIRTUAL_COLUMN_ID_START;
3838
use databend_common_meta_app::app_error::AppError;
3939
use databend_common_meta_app::data_mask::CreateDatamaskReq;
40-
use databend_common_meta_app::data_mask::DataMaskIdIdent;
4140
use databend_common_meta_app::data_mask::DataMaskNameIdent;
4241
use databend_common_meta_app::data_mask::DatamaskMeta;
4342
use databend_common_meta_app::data_mask::MaskPolicyIdTableId;
@@ -3184,7 +3183,6 @@ impl SchemaApiTestSuite {
31843183
let mask2_id;
31853184
{
31863185
let req = CreateDatamaskReq {
3187-
create_option: CreateOption::CreateIfNotExists,
31883186
name: DataMaskNameIdent::new(tenant.clone(), mask_name_1.to_string()),
31893187
data_mask_meta: DatamaskMeta {
31903188
args: vec![],
@@ -3201,7 +3199,6 @@ impl SchemaApiTestSuite {
32013199
mask1_id = get_kv_u64_data(mt, &mask1_name_ident).await?;
32023200

32033201
let req = CreateDatamaskReq {
3204-
create_option: CreateOption::CreateIfNotExists,
32053202
name: DataMaskNameIdent::new(tenant.clone(), mask_name_2.to_string()),
32063203
data_mask_meta: DatamaskMeta {
32073204
args: vec![],
@@ -3457,57 +3454,6 @@ impl SchemaApiTestSuite {
34573454
assert!(res.is_none());
34583455
}
34593456

3460-
info!("--- create or replace mask policy");
3461-
{
3462-
let mask_name = "replace_mask";
3463-
let name = DataMaskNameIdent::new(tenant.clone(), mask_name);
3464-
let req = CreateDatamaskReq {
3465-
create_option: CreateOption::CreateIfNotExists,
3466-
name: name.clone(),
3467-
data_mask_meta: DatamaskMeta {
3468-
args: vec![],
3469-
return_type: "".to_string(),
3470-
body: "".to_string(),
3471-
comment: Some("before".to_string()),
3472-
create_on: created_on,
3473-
update_on: None,
3474-
},
3475-
};
3476-
mt.create_data_mask(req).await??;
3477-
let old_id: u64 = get_kv_u64_data(mt, &name).await?;
3478-
3479-
let id_key = DataMaskIdIdent::new(&tenant, old_id);
3480-
3481-
let meta: DatamaskMeta = get_kv_data(mt, &id_key).await?;
3482-
assert_eq!(meta.comment, Some("before".to_string()));
3483-
3484-
let req = CreateDatamaskReq {
3485-
create_option: CreateOption::CreateOrReplace,
3486-
name: name.clone(),
3487-
data_mask_meta: DatamaskMeta {
3488-
args: vec![],
3489-
return_type: "".to_string(),
3490-
body: "".to_string(),
3491-
comment: Some("after".to_string()),
3492-
create_on: created_on,
3493-
update_on: None,
3494-
},
3495-
};
3496-
mt.create_data_mask(req).await??;
3497-
3498-
// assert old id key has been deleted
3499-
let meta: Result<DatamaskMeta, KVAppError> = get_kv_data(mt, &id_key).await;
3500-
assert!(meta.is_err());
3501-
3502-
let id: u64 = get_kv_u64_data(mt, &name).await?;
3503-
assert_ne!(old_id, id);
3504-
3505-
let id_key = DataMaskIdIdent::new(&tenant, id);
3506-
3507-
let meta: DatamaskMeta = get_kv_data(mt, &id_key).await?;
3508-
assert_eq!(meta.comment, Some("after".to_string()));
3509-
}
3510-
35113457
Ok(())
35123458
}
35133459

@@ -3549,7 +3495,6 @@ impl SchemaApiTestSuite {
35493495
info!("--- create row access policy");
35503496

35513497
let req = CreateRowAccessPolicyReq {
3552-
can_replace: false,
35533498
name: RowAccessPolicyNameIdent::new(tenant.clone(), policy1.to_string()),
35543499
row_access_policy_meta: RowAccessPolicyMeta {
35553500
args: vec![("number".to_string(), "UInt64".to_string())],
@@ -3566,7 +3511,6 @@ impl SchemaApiTestSuite {
35663511
let policy1_id = res.0.data;
35673512

35683513
let req = CreateRowAccessPolicyReq {
3569-
can_replace: false,
35703514
name: RowAccessPolicyNameIdent::new(tenant.clone(), policy2.to_string()),
35713515
row_access_policy_meta: RowAccessPolicyMeta {
35723516
args: vec![("number".to_string(), "UInt64".to_string())],
@@ -3887,7 +3831,6 @@ impl SchemaApiTestSuite {
38873831
let mask_cleanup_ident =
38883832
DataMaskNameIdent::new(tenant.clone(), mask_cleanup_name.to_string());
38893833
mt.create_data_mask(CreateDatamaskReq {
3890-
create_option: CreateOption::Create,
38913834
name: mask_cleanup_ident.clone(),
38923835
data_mask_meta: DatamaskMeta {
38933836
args: vec![],
@@ -3950,7 +3893,6 @@ impl SchemaApiTestSuite {
39503893
// Create another masking policy and bind it.
39513894
let mask_guard_ident = DataMaskNameIdent::new(tenant.clone(), mask_guard_name.to_string());
39523895
mt.create_data_mask(CreateDatamaskReq {
3953-
create_option: CreateOption::Create,
39543896
name: mask_guard_ident.clone(),
39553897
data_mask_meta: DatamaskMeta {
39563898
args: vec![],
@@ -4043,7 +3985,6 @@ impl SchemaApiTestSuite {
40433985
let policy_cleanup_ident =
40443986
RowAccessPolicyNameIdent::new(tenant.clone(), policy_cleanup_name.to_string());
40453987
mt.create_row_access_policy(CreateRowAccessPolicyReq {
4046-
can_replace: false,
40473988
name: policy_cleanup_ident.clone(),
40483989
row_access_policy_meta: RowAccessPolicyMeta {
40493990
args: vec![("number".to_string(), "UInt64".to_string())],
@@ -4117,7 +4058,6 @@ impl SchemaApiTestSuite {
41174058
let policy_guard_ident =
41184059
RowAccessPolicyNameIdent::new(tenant.clone(), policy_guard_name.to_string());
41194060
mt.create_row_access_policy(CreateRowAccessPolicyReq {
4120-
can_replace: false,
41214061
name: policy_guard_ident.clone(),
41224062
row_access_policy_meta: RowAccessPolicyMeta {
41234063
args: vec![("number".to_string(), "UInt64".to_string())],

0 commit comments

Comments
 (0)