-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix remote call of s3Cluster function #583
base: project-antalya-24.12.2
Are you sure you want to change the base?
Changes from 7 commits
fbe0882
32cb53d
5e209e1
2691811
e2f670e
2ec5804
44ed61f
8b6064f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2702,8 +2702,11 @@ void Context::setCurrentQueryId(const String & query_id) | |
|
||
client_info.current_query_id = query_id_to_set; | ||
|
||
if (client_info.query_kind == ClientInfo::QueryKind::INITIAL_QUERY) | ||
if (client_info.query_kind == ClientInfo::QueryKind::INITIAL_QUERY | ||
&& (getApplicationType() != ApplicationType::SERVER || client_info.initial_query_id.empty())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the comment in ClientInfo.h There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically it must be some new kind, something like |
||
{ | ||
client_info.initial_query_id = client_info.current_query_id; | ||
} | ||
} | ||
|
||
void Context::setBackgroundOperationTypeForContext(ClientInfo::BackgroundOperationType background_operation) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,7 +360,7 @@ def test_parallel_distributed_insert_select_with_schema_inference(started_cluste | |
node.query( | ||
""" | ||
CREATE TABLE parallel_insert_select ON CLUSTER 'first_shard' (a String, b UInt64) | ||
ENGINE=ReplicatedMergeTree('/clickhouse/tables/{shard}/insert_select_with_replicated', '{replica}') | ||
ENGINE=ReplicatedMergeTree('/clickhouse/tables/{shard}/parallel_insert_select', '{replica}') | ||
ORDER BY (a, b); | ||
""" | ||
) | ||
|
@@ -508,3 +508,57 @@ def test_cluster_default_expression(started_cluster): | |
) | ||
|
||
assert result == expected_result | ||
|
||
|
||
def test_remote_hedged(started_cluster): | ||
node = started_cluster.instances["s0_0_0"] | ||
pure_s3 = node.query( | ||
""" | ||
SELECT * from s3( | ||
'http://minio1:9001/root/data/{clickhouse,database}/*', | ||
'minio', 'minio123', 'CSV', | ||
'name String, value UInt32, polygon Array(Array(Tuple(Float64, Float64)))') | ||
ORDER BY (name, value, polygon) | ||
LIMIT 1 | ||
""" | ||
) | ||
s3_distributed = node.query( | ||
""" | ||
SELECT * from remote('s0_0_1', s3Cluster( | ||
'cluster_simple', | ||
'http://minio1:9001/root/data/{clickhouse,database}/*', 'minio', 'minio123', 'CSV', | ||
'name String, value UInt32, polygon Array(Array(Tuple(Float64, Float64)))')) | ||
ORDER BY (name, value, polygon) | ||
LIMIT 1 | ||
SETTINGS use_hedged_requests=True | ||
""" | ||
) | ||
|
||
assert TSV(pure_s3) == TSV(s3_distributed) | ||
|
||
|
||
def test_remote_no_hedged(started_cluster): | ||
node = started_cluster.instances["s0_0_0"] | ||
pure_s3 = node.query( | ||
""" | ||
SELECT * from s3( | ||
'http://minio1:9001/root/data/{clickhouse,database}/*', | ||
'minio', 'minio123', 'CSV', | ||
'name String, value UInt32, polygon Array(Array(Tuple(Float64, Float64)))') | ||
ORDER BY (name, value, polygon) | ||
LIMIT 1 | ||
""" | ||
) | ||
s3_distributed = node.query( | ||
""" | ||
SELECT * from remote('s0_0_1', s3Cluster( | ||
'cluster_simple', | ||
'http://minio1:9001/root/data/{clickhouse,database}/*', 'minio', 'minio123', 'CSV', | ||
'name String, value UInt32, polygon Array(Array(Tuple(Float64, Float64)))')) | ||
ORDER BY (name, value, polygon) | ||
LIMIT 1 | ||
SETTINGS use_hedged_requests=False | ||
""" | ||
) | ||
|
||
assert TSV(pure_s3) == TSV(s3_distributed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the PR really s3Cluster specific? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, affects all *Cluster object storage functions. Suggest to make test for others? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about new tests, may be. Depends on your feeling how probably is to break something that worked before or accidentally create a "bridge" that e.g. bypasses security. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added test for iceberg, most actual for us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me, "setIsRemoteFunction" is slightly more natural.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed