Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
67eefa7b
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,发现更多精彩内容 >>
提交
67eefa7b
编写于
3月 12, 2019
作者:
I
Ivan Lezhankin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert wrong replacements of dynamic_cast.
dynamic_cast to intermediate type is not equivalent to typeid_cast
上级
a3a8b2bb
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
28 addition
and
14 deletion
+28
-14
dbms/programs/client/Client.cpp
dbms/programs/client/Client.cpp
+2
-1
dbms/programs/copier/ClusterCopier.cpp
dbms/programs/copier/ClusterCopier.cpp
+1
-1
dbms/src/Common/typeid_cast.h
dbms/src/Common/typeid_cast.h
+11
-4
dbms/src/Interpreters/InterpreterShowCreateQuery.cpp
dbms/src/Interpreters/InterpreterShowCreateQuery.cpp
+2
-1
dbms/src/Interpreters/SyntaxAnalyzer.cpp
dbms/src/Interpreters/SyntaxAnalyzer.cpp
+2
-3
dbms/src/Interpreters/executeQuery.cpp
dbms/src/Interpreters/executeQuery.cpp
+2
-1
dbms/src/Parsers/ASTQueryWithOutput.cpp
dbms/src/Parsers/ASTQueryWithOutput.cpp
+2
-1
dbms/src/Parsers/ExpressionElementParsers.cpp
dbms/src/Parsers/ExpressionElementParsers.cpp
+2
-1
dbms/src/Parsers/IAST.h
dbms/src/Parsers/IAST.h
+2
-0
dbms/src/Parsers/ParserQueryWithOutput.cpp
dbms/src/Parsers/ParserQueryWithOutput.cpp
+2
-1
未找到文件。
dbms/programs/client/Client.cpp
浏览文件 @
67eefa7b
...
...
@@ -1228,7 +1228,8 @@ private:
String
current_format
=
format
;
/// The query can specify output format or output file.
if
(
const
auto
*
query_with_output
=
parsed_query
->
as
<
ASTQueryWithOutput
>
())
/// FIXME: try to prettify this cast using `as<>()`
if
(
const
auto
*
query_with_output
=
dynamic_cast
<
const
ASTQueryWithOutput
*>
(
parsed_query
.
get
()))
{
if
(
query_with_output
->
out_file
)
{
...
...
dbms/programs/copier/ClusterCopier.cpp
浏览文件 @
67eefa7b
...
...
@@ -501,7 +501,7 @@ static ASTPtr extractPartitionKey(const ASTPtr & storage_ast)
}
ASTPtr
arguments_ast
=
engine
->
arguments
->
clone
();
ASTs
&
arguments
=
arguments_ast
->
as
<
ASTExpressionList
>
()
->
children
;
// FIXME: what' the point of casting?
ASTs
&
arguments
=
arguments_ast
->
children
;
if
(
isExtendedDefinitionStorage
(
storage_ast
))
{
...
...
dbms/src/Common/typeid_cast.h
浏览文件 @
67eefa7b
...
...
@@ -35,8 +35,15 @@ std::enable_if_t<std::is_reference_v<To>, To> typeid_cast(From & from)
template
<
typename
To
,
typename
From
>
To
typeid_cast
(
From
*
from
)
{
if
(
typeid
(
*
from
)
==
typeid
(
std
::
remove_pointer_t
<
To
>
))
return
static_cast
<
To
>
(
from
);
else
return
nullptr
;
try
{
if
(
typeid
(
*
from
)
==
typeid
(
std
::
remove_pointer_t
<
To
>
))
return
static_cast
<
To
>
(
from
);
else
return
nullptr
;
}
catch
(
const
std
::
exception
&
e
)
{
throw
DB
::
Exception
(
e
.
what
(),
DB
::
ErrorCodes
::
BAD_CAST
);
}
}
dbms/src/Interpreters/InterpreterShowCreateQuery.cpp
浏览文件 @
67eefa7b
...
...
@@ -42,7 +42,8 @@ Block InterpreterShowCreateQuery::getSampleBlock()
BlockInputStreamPtr
InterpreterShowCreateQuery
::
executeImpl
()
{
const
auto
*
ast
=
query_ptr
->
as
<
ASTQueryWithTableAndOutput
>
();
/// FIXME: try to prettify this cast using `as<>()`
const
auto
*
ast
=
dynamic_cast
<
const
ASTQueryWithTableAndOutput
*>
(
query_ptr
.
get
());
if
(
ast
->
temporary
&&
!
ast
->
database
.
empty
())
throw
Exception
(
"Temporary databases are not possible."
,
ErrorCodes
::
SYNTAX_ERROR
);
...
...
dbms/src/Interpreters/SyntaxAnalyzer.cpp
浏览文件 @
67eefa7b
...
...
@@ -359,11 +359,10 @@ void optimizeLimitBy(const ASTSelectQuery * select_query)
/// Remove duplicated columns from USING(...).
void
optimizeUsing
(
const
ASTSelectQuery
*
select_query
)
{
const
auto
*
node
=
select_query
->
join
()
->
as
<
ASTTablesInSelectQueryElement
>
();
if
(
!
node
)
if
(
!
select_query
->
join
())
return
;
const
auto
*
table_join
=
node
->
table_join
->
as
<
ASTTableJoin
>
();
const
auto
*
table_join
=
select_query
->
join
()
->
table_join
->
as
<
ASTTableJoin
>
();
if
(
!
(
table_join
&&
table_join
->
using_expression_list
))
return
;
...
...
dbms/src/Interpreters/executeQuery.cpp
浏览文件 @
67eefa7b
...
...
@@ -506,7 +506,8 @@ void executeQuery(
if
(
streams
.
in
)
{
const
auto
*
ast_query_with_output
=
ast
->
as
<
ASTQueryWithOutput
>
();
/// FIXME: try to prettify this cast using `as<>()`
const
auto
*
ast_query_with_output
=
dynamic_cast
<
const
ASTQueryWithOutput
*>
(
ast
.
get
());
WriteBuffer
*
out_buf
=
&
ostr
;
std
::
optional
<
WriteBufferFromFile
>
out_file_buf
;
...
...
dbms/src/Parsers/ASTQueryWithOutput.cpp
浏览文件 @
67eefa7b
...
...
@@ -49,7 +49,8 @@ void ASTQueryWithOutput::formatImpl(const FormatSettings & s, FormatState & stat
bool
ASTQueryWithOutput
::
resetOutputASTIfExist
(
IAST
&
ast
)
{
if
(
auto
*
ast_with_output
=
ast
.
as
<
ASTQueryWithOutput
>
())
/// FIXME: try to prettify this cast using `as<>()`
if
(
auto
*
ast_with_output
=
dynamic_cast
<
ASTQueryWithOutput
*>
(
&
ast
))
{
ast_with_output
->
format
.
reset
();
ast_with_output
->
out_file
.
reset
();
...
...
dbms/src/Parsers/ExpressionElementParsers.cpp
浏览文件 @
67eefa7b
...
...
@@ -1254,7 +1254,8 @@ bool ParserWithOptionalAlias::parseImpl(Pos & pos, ASTPtr & node, Expected & exp
ASTPtr
alias_node
;
if
(
ParserAlias
(
allow_alias_without_as_keyword_now
).
parse
(
pos
,
alias_node
,
expected
))
{
if
(
auto
*
ast_with_alias
=
node
->
as
<
ASTWithAlias
>
())
/// FIXME: try to prettify this cast using `as<>()`
if
(
auto
*
ast_with_alias
=
dynamic_cast
<
ASTWithAlias
*>
(
node
.
get
()))
{
getIdentifierName
(
alias_node
,
ast_with_alias
->
alias
);
ast_with_alias
->
prefer_alias_to_column_name
=
prefer_alias_to_column_name
;
...
...
dbms/src/Parsers/IAST.h
浏览文件 @
67eefa7b
...
...
@@ -45,12 +45,14 @@ public:
template
<
class
Derived
>
Derived
*
as
()
{
// TODO: check, if we downcasting to base type, then just return |this|.
return
typeid_cast
<
Derived
*>
(
this
);
}
template
<
class
Derived
>
const
Derived
*
as
()
const
{
// TODO: check, if we downcasting to base type, then just return |this|.
return
typeid_cast
<
const
Derived
*>
(
this
);
}
...
...
dbms/src/Parsers/ParserQueryWithOutput.cpp
浏览文件 @
67eefa7b
...
...
@@ -62,7 +62,8 @@ bool ParserQueryWithOutput::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
if
(
!
parsed
)
return
false
;
auto
*
query_with_output
=
query
->
as
<
ASTQueryWithOutput
>
();
/// FIXME: try to prettify this cast using `as<>()`
auto
*
query_with_output
=
dynamic_cast
<
ASTQueryWithOutput
*>
(
query
.
get
());
ParserKeyword
s_into_outfile
(
"INTO OUTFILE"
);
if
(
s_into_outfile
.
ignore
(
pos
,
expected
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录