Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
e5682e81
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5682e81
编写于
6月 04, 2018
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Slightly better (preparation) [#CLICKHOUSE-3]
上级
df11490b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
20 deletion
+25
-20
dbms/src/Storages/MergeTree/KeyCondition.cpp
dbms/src/Storages/MergeTree/KeyCondition.cpp
+3
-3
dbms/src/Storages/MergeTree/KeyCondition.h
dbms/src/Storages/MergeTree/KeyCondition.h
+22
-17
未找到文件。
dbms/src/Storages/MergeTree/KeyCondition.cpp
浏览文件 @
e5682e81
...
...
@@ -535,7 +535,7 @@ bool KeyCondition::isKeyPossiblyWrappedByMonotonicFunctions(
const
Context
&
context
,
size_t
&
out_key_column_num
,
DataTypePtr
&
out_key_res_column_type
,
RPNElement
::
MonotonicFunctionsChain
&
out_functions_chain
)
MonotonicFunctionsChain
&
out_functions_chain
)
{
std
::
vector
<
const
ASTFunction
*>
chain_not_tested_for_monotonicity
;
DataTypePtr
key_column_type
;
...
...
@@ -637,7 +637,7 @@ bool KeyCondition::atomFromAST(const ASTPtr & node, const Context & context, Blo
DataTypePtr
key_expr_type
;
/// Type of expression containing key column
size_t
key_arg_pos
;
/// Position of argument with key column (non-const argument)
size_t
key_column_num
;
/// Number of a key column (inside sort_descr array)
RPNElement
::
MonotonicFunctionsChain
chain
;
MonotonicFunctionsChain
chain
;
bool
is_set_const
=
false
;
bool
is_constant_transformed
=
false
;
...
...
@@ -934,7 +934,7 @@ bool KeyCondition::mayBeTrueInRange(
std
::
optional
<
Range
>
KeyCondition
::
applyMonotonicFunctionsChainToRange
(
Range
key_range
,
RPNElement
::
MonotonicFunctionsChain
&
functions
,
MonotonicFunctionsChain
&
functions
,
DataTypePtr
current_type
)
{
...
...
dbms/src/Storages/MergeTree/KeyCondition.h
浏览文件 @
e5682e81
...
...
@@ -257,6 +257,22 @@ public:
String
toString
()
const
;
/** A chain of possibly monotone functions.
* If the key column is wrapped in functions that can be monotonous in some value ranges
* (for example: -toFloat64(toDayOfWeek(date))), then here the functions will be located: toDayOfWeek, toFloat64, negate.
*/
using
MonotonicFunctionsChain
=
std
::
vector
<
FunctionBasePtr
>
;
static
Block
getBlockWithConstants
(
const
ASTPtr
&
query
,
const
Context
&
context
,
const
NamesAndTypesList
&
all_columns
);
static
std
::
optional
<
Range
>
applyMonotonicFunctionsChainToRange
(
Range
key_range
,
MonotonicFunctionsChain
&
functions
,
DataTypePtr
current_type
);
private:
/// The expression is stored as Reverse Polish Notation.
struct
RPNElement
{
...
...
@@ -289,34 +305,23 @@ public:
/// For FUNCTION_IN_RANGE and FUNCTION_NOT_IN_RANGE.
Range
range
;
size_t
key_column
;
size_t
key_column
=
0
;
/// For FUNCTION_IN_SET, FUNCTION_NOT_IN_SET
ASTPtr
in_function
;
using
MergeTreeSetIndexPtr
=
std
::
shared_ptr
<
MergeTreeSetIndex
>
;
MergeTreeSetIndexPtr
set_index
;
/** A chain of possibly monotone functions.
* If the key column is wrapped in functions that can be monotonous in some value ranges
* (for example: -toFloat64(toDayOfWeek(date))), then here the functions will be located: toDayOfWeek, toFloat64, negate.
*/
using
MonotonicFunctionsChain
=
std
::
vector
<
FunctionBasePtr
>
;
mutable
MonotonicFunctionsChain
monotonic_functions_chain
;
/// The function execution does not violate the constancy.
};
static
Block
getBlockWithConstants
(
const
ASTPtr
&
query
,
const
Context
&
context
,
const
NamesAndTypesList
&
all_columns
)
;
using
RPN
=
std
::
vector
<
RPNElement
>
;
using
ColumnIndices
=
std
::
map
<
String
,
size_t
>
;
using
AtomMap
=
std
::
unordered_map
<
std
::
string
,
bool
(
*
)(
RPNElement
&
out
,
const
Field
&
value
,
const
ASTPtr
&
node
)
>
;
static
const
AtomMap
atom_map
;
static
std
::
optional
<
Range
>
applyMonotonicFunctionsChainToRange
(
Range
key_range
,
RPNElement
::
MonotonicFunctionsChain
&
functions
,
DataTypePtr
current_type
);
public:
static
const
AtomMap
atom_map
;
private:
using
RPN
=
std
::
vector
<
RPNElement
>
;
using
ColumnIndices
=
std
::
map
<
String
,
size_t
>
;
bool
mayBeTrueInRange
(
size_t
used_key_size
,
...
...
@@ -342,7 +347,7 @@ private:
const
Context
&
context
,
size_t
&
out_key_column_num
,
DataTypePtr
&
out_key_res_column_type
,
RPNElement
::
MonotonicFunctionsChain
&
out_functions_chain
);
MonotonicFunctionsChain
&
out_functions_chain
);
bool
isKeyPossiblyWrappedByMonotonicFunctionsImpl
(
const
ASTPtr
&
node
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录