Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
bb832f20
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,发现更多精彩内容 >>
未验证
提交
bb832f20
编写于
8月 10, 2020
作者:
T
tavplubix
提交者:
GitHub
8月 10, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13495 from vitlibar/fix-getting-query-settings
Fix getting settings specified in query.
上级
65da9739
3b9f5a82
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
9 deletion
+28
-9
src/Functions/getScalar.cpp
src/Functions/getScalar.cpp
+2
-1
src/Interpreters/ActionsVisitor.cpp
src/Interpreters/ActionsVisitor.cpp
+1
-6
tests/queries/0_stateless/01418_custom_settings.reference
tests/queries/0_stateless/01418_custom_settings.reference
+11
-1
tests/queries/0_stateless/01418_custom_settings.sql
tests/queries/0_stateless/01418_custom_settings.sql
+14
-1
未找到文件。
src/Functions/getScalar.cpp
浏览文件 @
bb832f20
...
...
@@ -44,7 +44,8 @@ public:
if
(
arguments
.
size
()
!=
1
||
!
isString
(
arguments
[
0
].
type
)
||
!
arguments
[
0
].
column
||
!
isColumnConst
(
*
arguments
[
0
].
column
))
throw
Exception
(
"Function "
+
getName
()
+
" accepts one const string argument"
,
ErrorCodes
::
ILLEGAL_TYPE_OF_ARGUMENT
);
auto
scalar_name
=
assert_cast
<
const
ColumnConst
&>
(
*
arguments
[
0
].
column
).
getValue
<
String
>
();
scalar
=
context
.
getScalar
(
scalar_name
).
getByPosition
(
0
);
const
Context
&
query_context
=
context
.
hasQueryContext
()
?
context
.
getQueryContext
()
:
context
;
scalar
=
query_context
.
getScalar
(
scalar_name
).
getByPosition
(
0
);
return
scalar
.
type
;
}
...
...
src/Interpreters/ActionsVisitor.cpp
浏览文件 @
bb832f20
...
...
@@ -586,15 +586,10 @@ void ActionsMatcher::visit(const ASTFunction & node, const ASTPtr & ast, Data &
if
(
AggregateFunctionFactory
::
instance
().
isAggregateFunctionName
(
node
.
name
))
return
;
/// Context object that we pass to function should live during query.
const
Context
&
function_context
=
data
.
context
.
hasQueryContext
()
?
data
.
context
.
getQueryContext
()
:
data
.
context
;
FunctionOverloadResolverPtr
function_builder
;
try
{
function_builder
=
FunctionFactory
::
instance
().
get
(
node
.
name
,
function_
context
);
function_builder
=
FunctionFactory
::
instance
().
get
(
node
.
name
,
data
.
context
);
}
catch
(
DB
::
Exception
&
e
)
{
...
...
tests/queries/0_stateless/01418_custom_settings.reference
浏览文件 @
bb832f20
...
...
@@ -6,6 +6,7 @@ custom_a UInt64_5
custom_b Int64_-177
custom_c Float64_98.11
custom_d \'abc def\'
changed String
\N Nullable(Nothing)
50000 UInt16
...
...
@@ -14,7 +15,16 @@ custom_a \'changed\'
custom_b NULL
custom_c UInt64_50000
custom_d Float64_1.11
0 UInt8
404 UInt16
-0.333 Float64
custom_e Float64_-0.333
404 UInt16
custom_e UInt64_404
word String
custom_f \'word\'
0
test String
custom_compound.identifier.v1 \'test\'
...
...
tests/queries/0_stateless/01418_custom_settings.sql
浏览文件 @
bb832f20
...
...
@@ -8,6 +8,7 @@ SELECT getSetting('custom_c') as v, toTypeName(v);
SELECT
getSetting
(
'custom_d'
)
as
v
,
toTypeName
(
v
);
SELECT
name
,
value
FROM
system
.
settings
WHERE
name
LIKE
'custom_%'
ORDER
BY
name
;
SELECT
''
;
SET
custom_a
=
'changed'
;
SET
custom_b
=
NULL
;
SET
custom_c
=
50000
;
...
...
@@ -18,12 +19,24 @@ SELECT getSetting('custom_c') as v, toTypeName(v);
SELECT
getSetting
(
'custom_d'
)
as
v
,
toTypeName
(
v
);
SELECT
name
,
value
FROM
system
.
settings
WHERE
name
LIKE
'custom_%'
ORDER
BY
name
;
SELECT
''
;
SELECT
getSetting
(
'custom_e'
)
as
v
,
toTypeName
(
v
);
-- { serverError 115 } -- Setting not found.
SET
custom_e
=
0
;
SET
custom_e
=
404
;
SELECT
getSetting
(
'custom_e'
)
as
v
,
toTypeName
(
v
);
SET
invalid_custom
=
8
;
-- { serverError 115 } -- Setting is neither a builtin nor started with one of the registered prefixes for user-defined settings.
SELECT
''
;
SELECT
getSetting
(
'custom_e'
)
as
v
,
toTypeName
(
v
)
SETTINGS
custom_e
=
-
0
.
333
;
SELECT
name
,
value
FROM
system
.
settings
WHERE
name
=
'custom_e'
SETTINGS
custom_e
=
-
0
.
333
;
SELECT
getSetting
(
'custom_e'
)
as
v
,
toTypeName
(
v
);
SELECT
name
,
value
FROM
system
.
settings
WHERE
name
=
'custom_e'
;
SELECT
getSetting
(
'custom_f'
)
as
v
,
toTypeName
(
v
)
SETTINGS
custom_f
=
'word'
;
SELECT
name
,
value
FROM
system
.
settings
WHERE
name
=
'custom_f'
SETTINGS
custom_f
=
'word'
;
SELECT
getSetting
(
'custom_f'
)
as
v
,
toTypeName
(
v
);
-- { serverError 115 } -- Setting not found.
SELECT
COUNT
()
FROM
system
.
settings
WHERE
name
=
'custom_f'
;
SELECT
''
;
SET
custom_compound
.
identifier
.
v1
=
'test'
;
SELECT
getSetting
(
'custom_compound.identifier.v1'
)
as
v
,
toTypeName
(
v
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录