mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
9c20519f33
Sometimes it is undesirable to remove any expressions from WHERE, since this may lead to reading the whole table, and this is pretty heavy job for MySQL and PostgreSQL (even if you read only one column). So external_table_strict_query had been introduced to prohibit this and fail the query instead.
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <common/types.h>
|
|
#include <Core/NamesAndTypes.h>
|
|
#include <Parsers/IdentifierQuotingStyle.h>
|
|
#include <Storages/SelectQueryInfo.h>
|
|
#include <Interpreters/Context_fwd.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class IAST;
|
|
|
|
/** For given ClickHouse query,
|
|
* creates another query in a form of
|
|
*
|
|
* SELECT columns... FROM db.table WHERE ...
|
|
*
|
|
* where 'columns' are all required columns to read from "left" table of original query,
|
|
* and WHERE contains subset of (AND-ed) conditions from original query,
|
|
* that contain only compatible expressions.
|
|
*
|
|
* Compatible expressions are comparisons of identifiers, constants, and logical operations on them.
|
|
*
|
|
* Throws INCORRECT_QUERY if external_table_strict_query (from context settings)
|
|
* is set and some expression from WHERE is not compatible.
|
|
*/
|
|
String transformQueryForExternalDatabase(
|
|
const SelectQueryInfo & query_info,
|
|
const NamesAndTypesList & available_columns,
|
|
IdentifierQuotingStyle identifier_quoting_style,
|
|
const String & database,
|
|
const String & table,
|
|
ContextPtr context);
|
|
|
|
}
|