2017-12-26 21:34:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/types.h>
|
2017-12-27 21:45:05 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
2018-07-16 01:02:46 +00:00
|
|
|
#include <Parsers/IdentifierQuotingStyle.h>
|
2020-03-31 10:52:26 +00:00
|
|
|
#include <Storages/SelectQueryInfo.h>
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.h>
|
2017-12-26 21:34:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
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.
|
2021-09-20 22:17:56 +00:00
|
|
|
*
|
|
|
|
* Throws INCORRECT_QUERY if external_table_strict_query (from context settings)
|
|
|
|
* is set and some expression from WHERE is not compatible.
|
2017-12-26 21:34:06 +00:00
|
|
|
*/
|
|
|
|
String transformQueryForExternalDatabase(
|
2020-03-31 10:52:26 +00:00
|
|
|
const SelectQueryInfo & query_info,
|
2017-12-26 21:34:06 +00:00
|
|
|
const NamesAndTypesList & available_columns,
|
2018-07-16 01:02:46 +00:00
|
|
|
IdentifierQuotingStyle identifier_quoting_style,
|
2017-12-26 21:34:06 +00:00
|
|
|
const String & database,
|
|
|
|
const String & table,
|
2021-04-10 23:33:54 +00:00
|
|
|
ContextPtr context);
|
2017-12-26 21:34:06 +00:00
|
|
|
|
|
|
|
}
|