Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
d6e7ab59
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,发现更多精彩内容 >>
提交
d6e7ab59
编写于
7月 13, 2020
作者:
A
Alexander Kuzmenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fuzzing-related fixes
上级
028abb9d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
4 deletion
+35
-4
programs/client/Client.cpp
programs/client/Client.cpp
+6
-0
src/Functions/FunctionBinaryArithmetic.h
src/Functions/FunctionBinaryArithmetic.h
+14
-3
src/Parsers/ASTNameTypePair.cpp
src/Parsers/ASTNameTypePair.cpp
+1
-1
src/Storages/StorageBuffer.cpp
src/Storages/StorageBuffer.cpp
+14
-0
未找到文件。
programs/client/Client.cpp
浏览文件 @
d6e7ab59
...
...
@@ -1054,6 +1054,10 @@ private:
auto
base_before_fuzz
=
fuzz_base
->
formatForErrorMessage
();
ast_to_process
=
fuzz_base
->
clone
();
std
::
stringstream
dump_of_cloned_ast
;
ast_to_process
->
dumpTree
(
dump_of_cloned_ast
);
fuzzer
.
fuzzMain
(
ast_to_process
);
auto
base_after_fuzz
=
fuzz_base
->
formatForErrorMessage
();
...
...
@@ -1066,6 +1070,8 @@ private:
base_after_fuzz
.
c_str
());
fprintf
(
stderr
,
"dump before fuzz:
\n
%s
\n
"
,
dump_before_fuzz
.
str
().
c_str
());
fprintf
(
stderr
,
"dump of cloned ast:
\n
%s
\n
"
,
dump_of_cloned_ast
.
str
().
c_str
());
fprintf
(
stderr
,
"dump after fuzz:
\n
"
);
fuzz_base
->
dumpTree
(
std
::
cerr
);
assert
(
false
);
...
...
src/Functions/FunctionBinaryArithmetic.h
浏览文件 @
d6e7ab59
...
...
@@ -1096,8 +1096,10 @@ public:
return
;
}
auto
*
left_generic
=
block
.
getByPosition
(
arguments
[
0
]).
type
.
get
();
auto
*
right_generic
=
block
.
getByPosition
(
arguments
[
1
]).
type
.
get
();
const
auto
&
left_argument
=
block
.
getByPosition
(
arguments
[
0
]);
const
auto
&
right_argument
=
block
.
getByPosition
(
arguments
[
1
]);
auto
*
left_generic
=
left_argument
.
type
.
get
();
auto
*
right_generic
=
right_argument
.
type
.
get
();
bool
valid
=
castBothTypes
(
left_generic
,
right_generic
,
[
&
](
const
auto
&
left
,
const
auto
&
right
)
{
using
LeftDataType
=
std
::
decay_t
<
decltype
(
left
)
>
;
...
...
@@ -1112,8 +1114,17 @@ public:
else
return
executeNumeric
(
block
,
arguments
,
result
,
left
,
right
);
});
if
(
!
valid
)
throw
Exception
(
getName
()
+
"'s arguments do not match the expected data types"
,
ErrorCodes
::
LOGICAL_ERROR
);
{
// This is a logical error, because the types should have been checked
// by getReturnTypeImpl().
throw
Exception
(
ErrorCodes
::
LOGICAL_ERROR
,
"Arguments of '{}' have incorrect data types: '{}' of type '{}',"
" '{}' of type '{}'"
,
getName
(),
left_argument
.
name
,
left_argument
.
type
->
getName
(),
right_argument
.
name
,
right_argument
.
type
->
getName
());
}
}
#if USE_EMBEDDED_COMPILER
...
...
src/Parsers/ASTNameTypePair.cpp
浏览文件 @
d6e7ab59
...
...
@@ -12,7 +12,7 @@ ASTPtr ASTNameTypePair::clone() const
if
(
type
)
{
res
->
type
=
type
;
res
->
type
=
type
->
clone
()
;
res
->
children
.
push_back
(
res
->
type
);
}
...
...
src/Storages/StorageBuffer.cpp
浏览文件 @
d6e7ab59
...
...
@@ -50,6 +50,7 @@ namespace DB
namespace
ErrorCodes
{
extern
const
int
BAD_ARGUMENTS
;
extern
const
int
NOT_IMPLEMENTED
;
extern
const
int
LOGICAL_ERROR
;
extern
const
int
INFINITE_LOOP
;
...
...
@@ -842,9 +843,22 @@ void registerStorageBuffer(StorageFactory & factory)
" destination_database, destination_table, num_buckets, min_time, max_time, min_rows, max_rows, min_bytes, max_bytes."
,
ErrorCodes
::
NUMBER_OF_ARGUMENTS_DOESNT_MATCH
);
// Table and database name arguments accept expressions, evaluate them.
engine_args
[
0
]
=
evaluateConstantExpressionForDatabaseName
(
engine_args
[
0
],
args
.
local_context
);
engine_args
[
1
]
=
evaluateConstantExpressionOrIdentifierAsLiteral
(
engine_args
[
1
],
args
.
local_context
);
// After we evaluated all expressions, check that all arguments are
// literals.
for
(
size_t
i
=
0
;
i
<
9
;
i
++
)
{
if
(
!
typeid_cast
<
ASTLiteral
*>
(
engine_args
[
i
].
get
()))
{
throw
Exception
(
ErrorCodes
::
BAD_ARGUMENTS
,
"Storae Buffer expects a literal as an argument #{}, got '{}'"
" instead"
,
i
,
engine_args
[
i
]
->
formatForErrorMessage
());
}
}
String
destination_database
=
engine_args
[
0
]
->
as
<
ASTLiteral
&>
().
value
.
safeGet
<
String
>
();
String
destination_table
=
engine_args
[
1
]
->
as
<
ASTLiteral
&>
().
value
.
safeGet
<
String
>
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录