Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
46644aaa
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,发现更多精彩内容 >>
提交
46644aaa
编写于
5月 23, 2017
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Preparations, part 5: table functions are using const Context for execution [#CLICKHOUSE-31].
上级
2b20eca0
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
17 addition
and
16 deletion
+17
-16
dbms/src/TableFunctions/ITableFunction.h
dbms/src/TableFunctions/ITableFunction.h
+1
-1
dbms/src/TableFunctions/TableFunctionFactory.cpp
dbms/src/TableFunctions/TableFunctionFactory.cpp
+3
-3
dbms/src/TableFunctions/TableFunctionMerge.cpp
dbms/src/TableFunctions/TableFunctionMerge.cpp
+1
-1
dbms/src/TableFunctions/TableFunctionMerge.h
dbms/src/TableFunctions/TableFunctionMerge.h
+2
-3
dbms/src/TableFunctions/TableFunctionRemote.cpp
dbms/src/TableFunctions/TableFunctionRemote.cpp
+6
-3
dbms/src/TableFunctions/TableFunctionRemote.h
dbms/src/TableFunctions/TableFunctionRemote.h
+2
-3
dbms/src/TableFunctions/TableFunctionShardByHash.cpp
dbms/src/TableFunctions/TableFunctionShardByHash.cpp
+1
-1
dbms/src/TableFunctions/TableFunctionShardByHash.h
dbms/src/TableFunctions/TableFunctionShardByHash.h
+1
-1
未找到文件。
dbms/src/TableFunctions/ITableFunction.h
浏览文件 @
46644aaa
...
...
@@ -32,7 +32,7 @@ public:
virtual
std
::
string
getName
()
const
=
0
;
/// Create storage according to the query
virtual
StoragePtr
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
=
0
;
virtual
StoragePtr
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
=
0
;
virtual
~
ITableFunction
()
{};
};
...
...
dbms/src/TableFunctions/TableFunctionFactory.cpp
浏览文件 @
46644aaa
...
...
@@ -25,9 +25,9 @@ TableFunctionPtr TableFunctionFactory::get(
if
(
context
.
getSettings
().
limits
.
readonly
==
1
)
/** For example, for readonly = 2 - allowed. */
throw
Exception
(
"Table functions are forbidden in readonly mode"
,
ErrorCodes
::
READONLY
);
if
(
name
==
"merge"
)
return
std
::
make_shared
<
TableFunctionMerge
>
();
else
if
(
name
==
"remote"
)
return
std
::
make_shared
<
TableFunctionRemote
>
();
else
if
(
name
==
"shardByHash"
)
return
std
::
make_shared
<
TableFunctionShardByHash
>
();
if
(
name
==
"merge"
)
return
std
::
make_shared
<
TableFunctionMerge
>
();
else
if
(
name
==
"remote"
)
return
std
::
make_shared
<
TableFunctionRemote
>
();
else
if
(
name
==
"shardByHash"
)
return
std
::
make_shared
<
TableFunctionShardByHash
>
();
else
throw
Exception
(
"Unknown table function "
+
name
,
ErrorCodes
::
UNKNOWN_FUNCTION
);
}
...
...
dbms/src/TableFunctions/TableFunctionMerge.cpp
浏览文件 @
46644aaa
...
...
@@ -53,7 +53,7 @@ static NamesAndTypesList chooseColumns(const String & source_database, const Str
}
StoragePtr
TableFunctionMerge
::
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
StoragePtr
TableFunctionMerge
::
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
{
ASTs
&
args_func
=
typeid_cast
<
ASTFunction
&>
(
*
ast_function
).
children
;
...
...
dbms/src/TableFunctions/TableFunctionMerge.h
浏览文件 @
46644aaa
...
...
@@ -6,8 +6,7 @@
namespace
DB
{
/*
* merge (db_name, tables_regexp) - creates a temporary StorageMerge.
/* merge (db_name, tables_regexp) - creates a temporary StorageMerge.
* The structure of the table is taken from the first table that came up, suitable for regexp.
* If there is no such table, an exception is thrown.
*/
...
...
@@ -15,7 +14,7 @@ class TableFunctionMerge: public ITableFunction
{
public:
std
::
string
getName
()
const
override
{
return
"merge"
;
}
StoragePtr
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
override
;
StoragePtr
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
override
;
};
...
...
dbms/src/TableFunctions/TableFunctionRemote.cpp
浏览文件 @
46644aaa
...
...
@@ -146,7 +146,8 @@ static std::vector<String> parseDescription(const String & description, size_t l
}
buffer
.
push_back
(
cur
);
}
}
else
if
(
have_splitter
)
/// If there is a current delimiter inside, then generate a set of resulting rows
}
else
if
(
have_splitter
)
/// If there is a current delimiter inside, then generate a set of resulting rows
buffer
=
parseDescription
(
description
,
i
+
1
,
m
,
separator
,
max_addresses
);
else
/// Otherwise just copy, spawn will occur when you call with the correct delimiter
buffer
.
push_back
(
description
.
substr
(
i
,
m
-
i
+
1
));
...
...
@@ -168,15 +169,17 @@ static std::vector<String> parseDescription(const String & description, size_t l
append
(
cur
,
buffer
,
max_addresses
);
}
}
res
.
insert
(
res
.
end
(),
cur
.
begin
(),
cur
.
end
());
if
(
res
.
size
()
>
max_addresses
)
throw
Exception
(
"Storage Distributed, first argument generates too many result addresses"
,
ErrorCodes
::
BAD_ARGUMENTS
);
ErrorCodes
::
BAD_ARGUMENTS
);
return
res
;
}
StoragePtr
TableFunctionRemote
::
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
StoragePtr
TableFunctionRemote
::
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
{
ASTs
&
args_func
=
typeid_cast
<
ASTFunction
&>
(
*
ast_function
).
children
;
...
...
dbms/src/TableFunctions/TableFunctionRemote.h
浏览文件 @
46644aaa
...
...
@@ -6,8 +6,7 @@
namespace
DB
{
/*
* remote ('address', db, table) - creates a temporary StorageDistributed.
/* remote ('address', db, table) - creates a temporary StorageDistributed.
* To get the table structure, a DESC TABLE request is made to the remote server.
* For example
* SELECT count() FROM remote('example01-01-1', merge, hits) - go to `example01-01-1`, in the merge database, the hits table.
...
...
@@ -17,7 +16,7 @@ class TableFunctionRemote : public ITableFunction
{
public:
std
::
string
getName
()
const
override
{
return
"remote"
;
}
StoragePtr
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
override
;
StoragePtr
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
override
;
};
}
dbms/src/TableFunctions/TableFunctionShardByHash.cpp
浏览文件 @
46644aaa
...
...
@@ -20,7 +20,7 @@ namespace ErrorCodes
extern
const
int
BAD_ARGUMENTS
;
}
StoragePtr
TableFunctionShardByHash
::
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
StoragePtr
TableFunctionShardByHash
::
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
{
ASTs
&
args_func
=
typeid_cast
<
ASTFunction
&>
(
*
ast_function
).
children
;
...
...
dbms/src/TableFunctions/TableFunctionShardByHash.h
浏览文件 @
46644aaa
...
...
@@ -15,7 +15,7 @@ class TableFunctionShardByHash : public ITableFunction
{
public:
std
::
string
getName
()
const
override
{
return
"shardByHash"
;
}
StoragePtr
execute
(
ASTPtr
ast_function
,
Context
&
context
)
const
override
;
StoragePtr
execute
(
ASTPtr
ast_function
,
const
Context
&
context
)
const
override
;
};
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录