Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
a4e857a8
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,发现更多精彩内容 >>
提交
a4e857a8
编写于
1月 28, 2021
作者:
R
robot-clickhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Backport #19617 to 20.12: Fix function neighbor for LowCardinality argument.
上级
de933777
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
62 addition
and
0 deletion
+62
-0
src/Functions/neighbor.cpp
src/Functions/neighbor.cpp
+4
-0
tests/queries/0_stateless/01670_neighbor_lc_bug.reference
tests/queries/0_stateless/01670_neighbor_lc_bug.reference
+15
-0
tests/queries/0_stateless/01670_neighbor_lc_bug.sql
tests/queries/0_stateless/01670_neighbor_lc_bug.sql
+43
-0
未找到文件。
src/Functions/neighbor.cpp
浏览文件 @
a4e857a8
...
...
@@ -50,6 +50,10 @@ public:
bool
useDefaultImplementationForConstants
()
const
override
{
return
false
;
}
/// We do not use default implementation for LowCardinality because this is not a pure function.
/// If used, optimization for LC may execute function only for dictionary, which gives wrong result.
bool
useDefaultImplementationForLowCardinalityColumns
()
const
override
{
return
false
;
}
DataTypePtr
getReturnTypeImpl
(
const
DataTypes
&
arguments
)
const
override
{
size_t
number_of_arguments
=
arguments
.
size
();
...
...
tests/queries/0_stateless/01670_neighbor_lc_bug.reference
0 → 100644
浏览文件 @
a4e857a8
0
0
0 0 0
1 1 1
2 2 2
3 3 3
4 4 4
0 0 0
1 1 1
2 2 2
┌─[1mrowNr[0m─┬─[1mval_string[0m─┬─[1mstr_m1[0m───┬─[1mstr_p1[0m───┬─[1mval_low[0m──┬─[1mlow_m1[0m───┬─[1mlow_p1[0m───┐
│ 1 │ String 1 │ │ String 1 │ String 1 │ │ String 1 │
│ 2 │ String 1 │ String 1 │ String 2 │ String 1 │ String 1 │ String 2 │
│ 3 │ String 2 │ String 1 │ │ String 2 │ String 1 │ │
└───────┴────────────┴──────────┴──────────┴──────────┴──────────┴──────────┘
tests/queries/0_stateless/01670_neighbor_lc_bug.sql
0 → 100644
浏览文件 @
a4e857a8
SELECT
neighbor
(
n
,
-
2
)
AS
int
,
neighbor
(
s
,
-
2
)
AS
str
,
neighbor
(
lcs
,
-
2
)
AS
lowCstr
FROM
(
SELECT
number
%
5
AS
n
,
toString
(
n
)
AS
s
,
CAST
(
s
,
'LowCardinality(String)'
)
AS
lcs
FROM
numbers
(
10
)
);
drop
table
if
exists
neighbor_test
;
CREATE
TABLE
neighbor_test
(
`rowNr`
UInt8
,
`val_string`
String
,
`val_low`
LowCardinality
(
String
)
)
ENGINE
=
MergeTree
PARTITION
BY
tuple
()
ORDER
BY
rowNr
;
INSERT
INTO
neighbor_test
VALUES
(
1
,
'String 1'
,
'String 1'
),
(
2
,
'String 1'
,
'String 1'
),
(
3
,
'String 2'
,
'String 2'
);
SELECT
rowNr
,
val_string
,
neighbor
(
val_string
,
-
1
)
AS
str_m1
,
neighbor
(
val_string
,
1
)
AS
str_p1
,
val_low
,
neighbor
(
val_low
,
-
1
)
AS
low_m1
,
neighbor
(
val_low
,
1
)
AS
low_p1
FROM
(
SELECT
*
FROM
neighbor_test
ORDER
BY
val_string
ASC
)
format
PrettyCompact
;
drop
table
if
exists
neighbor_test
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录