-
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
Distributed request to tables with Object Storage Engines #615
base: antalya
Are you sure you want to change the base?
Changes from 1 commit
c22bf24
3a11374
dfd14d0
fb3e1b6
28d6c5c
78261d3
ac37da6
db44166
3fafe6f
cfc74ec
df462de
508e4ba
9dbd209
5b923c9
293ac83
5bc11ee
a4943e2
d5d3073
09321d3
17c53f4
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 |
---|---|---|
|
@@ -108,6 +108,13 @@ void StorageObjectStorageCluster::updateQueryForDistributedEngineIfNeeded(ASTPtr | |
return; | ||
|
||
auto * tables = select_query->tables()->as<ASTTablesInSelectQuery>(); | ||
|
||
if (tables->children.empty()) | ||
throw Exception( | ||
ErrorCodes::LOGICAL_ERROR, | ||
"Expected SELECT query from table with engine {}, got '{}'", | ||
configuration->getEngineName(), queryToString(query)); | ||
|
||
auto * table_expression = tables->children[0]->as<ASTTablesInSelectQueryElement>()->table_expression->as<ASTTableExpression>(); | ||
arthurpassos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (!table_expression->database_and_table_name) | ||
return; | ||
|
@@ -116,7 +123,7 @@ void StorageObjectStorageCluster::updateQueryForDistributedEngineIfNeeded(ASTPtr | |
|
||
auto table_alias = table_identifier_typed.tryGetAlias(); | ||
|
||
std::unordered_map<std::string, std::string> engine_to_function = { | ||
static std::unordered_map<std::string, std::string> engine_to_function = { | ||
{"S3", "s3"}, | ||
{"Azure", "azureBlobStorage"}, | ||
{"HDFS", "hdfs"}, | ||
|
@@ -153,7 +160,7 @@ void StorageObjectStorageCluster::updateQueryForDistributedEngineIfNeeded(ASTPtr | |
queryToString(query)); | ||
} | ||
|
||
configuration->setFunctionArgs(arguments->children); | ||
configuration->getTableFunctionArguments(arguments->children); | ||
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. In #615 (comment), I suggested the arguments to be created inside If there is one, I am fine with this approach 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. Just to avoid copying after function call. 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. I am not sure I follow. On line 155, you do: Then you are passing children as a reference on 167 and populating it inside the On line 169, you read the values. What I am suggesting is that you create the arguments list inside the What am I missing? 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. Changes not in 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. As discussed on slack, let's make the function return it as suggested in the original comment |
||
|
||
function_ast->arguments = arguments; | ||
function_ast->children.push_back(arguments); | ||
|
@@ -163,7 +170,7 @@ void StorageObjectStorageCluster::updateQueryForDistributedEngineIfNeeded(ASTPtr | |
|
||
table_expression->database_and_table_name = nullptr; | ||
table_expression->table_function = function_ast_ptr; | ||
table_expression->children[0].swap(function_ast_ptr); | ||
table_expression->children[0] = function_ast_ptr; | ||
|
||
auto settings = select_query->settings(); | ||
if (settings) | ||
|
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.
I would just remove this comment
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.
Actually, if you implement this function in the way I suggested in #615 (comment), perhaps this whole if statement is no longer necessary?