Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
2a514eae
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,发现更多精彩内容 >>
未验证
提交
2a514eae
编写于
8月 29, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
8月 29, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14223 from nikitamikhaylov/update-permutaiton-bug-fix
Fixed incorrect sorting order if LowCardinality column.
上级
2d33a402
fc84d125
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
75 addition
and
3 deletion
+75
-3
src/Columns/ColumnLowCardinality.cpp
src/Columns/ColumnLowCardinality.cpp
+3
-3
tests/queries/0_stateless/01456_low_cardinality_sorting_bugfix.reference
..._stateless/01456_low_cardinality_sorting_bugfix.reference
+31
-0
tests/queries/0_stateless/01456_low_cardinality_sorting_bugfix.sql
...ries/0_stateless/01456_low_cardinality_sorting_bugfix.sql
+41
-0
未找到文件。
src/Columns/ColumnLowCardinality.cpp
浏览文件 @
2a514eae
...
...
@@ -352,7 +352,7 @@ void ColumnLowCardinality::updatePermutation(bool reverse, size_t limit, int nan
auto
new_first
=
first
;
for
(
auto
j
=
first
+
1
;
j
<
last
;
++
j
)
{
if
(
compareAt
(
new_first
,
j
,
*
this
,
nan_direction_hint
)
!=
0
)
if
(
compareAt
(
res
[
new_first
],
res
[
j
]
,
*
this
,
nan_direction_hint
)
!=
0
)
{
if
(
j
-
new_first
>
1
)
new_ranges
.
emplace_back
(
new_first
,
j
);
...
...
@@ -376,7 +376,7 @@ void ColumnLowCardinality::updatePermutation(bool reverse, size_t limit, int nan
auto
new_first
=
first
;
for
(
auto
j
=
first
+
1
;
j
<
limit
;
++
j
)
{
if
(
getDictionary
().
compareAt
(
getIndexes
().
getUInt
(
new_first
),
getIndexes
().
getUInt
(
j
),
getDictionary
(),
nan_direction_hint
)
!=
0
)
if
(
getDictionary
().
compareAt
(
getIndexes
().
getUInt
(
res
[
new_first
]),
getIndexes
().
getUInt
(
res
[
j
]
),
getDictionary
(),
nan_direction_hint
)
!=
0
)
{
if
(
j
-
new_first
>
1
)
new_ranges
.
emplace_back
(
new_first
,
j
);
...
...
@@ -387,7 +387,7 @@ void ColumnLowCardinality::updatePermutation(bool reverse, size_t limit, int nan
auto
new_last
=
limit
;
for
(
auto
j
=
limit
;
j
<
last
;
++
j
)
{
if
(
getDictionary
().
compareAt
(
getIndexes
().
getUInt
(
new_first
),
getIndexes
().
getUInt
(
j
),
getDictionary
(),
nan_direction_hint
)
==
0
)
if
(
getDictionary
().
compareAt
(
getIndexes
().
getUInt
(
res
[
new_first
]),
getIndexes
().
getUInt
(
res
[
j
]
),
getDictionary
(),
nan_direction_hint
)
==
0
)
{
std
::
swap
(
res
[
new_last
],
res
[
j
]);
++
new_last
;
...
...
tests/queries/0_stateless/01456_low_cardinality_sorting_bugfix.reference
0 → 100644
浏览文件 @
2a514eae
green 2020-08-21 18:46:08
green 2020-08-21 18:46:07
green 2020-08-21 18:46:06
red 2020-08-21 18:46:08
red 2020-08-21 18:46:07
red 2020-08-21 18:46:06
green 2020-08-21 18:46:08.000
green 2020-08-21 18:46:07.000
green 2020-08-21 18:46:06.000
red 2020-08-21 18:46:08.000
red 2020-08-21 18:46:07.000
red 2020-08-21 18:46:06.000
------cast to String----
green 2020-08-21 18:46:08
green 2020-08-21 18:46:07
green 2020-08-21 18:46:06
red 2020-08-21 18:46:08
red 2020-08-21 18:46:07
red 2020-08-21 18:46:06
green 2020-08-21 18:46:08.000
green 2020-08-21 18:46:07.000
green 2020-08-21 18:46:06.000
red 2020-08-21 18:46:08.000
red 2020-08-21 18:46:07.000
red 2020-08-21 18:46:06.000
tests/queries/0_stateless/01456_low_cardinality_sorting_bugfix.sql
0 → 100644
浏览文件 @
2a514eae
drop
table
if
exists
order_test1
;
create
table
order_test1
(
timestamp
DateTime64
(
3
),
color
LowCardinality
(
String
)
)
engine
=
MergeTree
()
ORDER
BY
tuple
();
insert
into
order_test1
values
(
'2020-08-21 18:46:08.000'
,
'red'
)(
'2020-08-21 18:46:08.000'
,
'green'
);
insert
into
order_test1
values
(
'2020-08-21 18:46:07.000'
,
'red'
)(
'2020-08-21 18:46:07.000'
,
'green'
);
insert
into
order_test1
values
(
'2020-08-21 18:46:06.000'
,
'red'
)(
'2020-08-21 18:46:06.000'
,
'green'
);
SELECT
color
,
toDateTime
(
timestamp
)
AS
second
FROM
order_test1
GROUP
BY
color
,
second
ORDER
BY
color
ASC
,
second
DESC
;
select
''
;
select
''
;
SELECT
color
,
timestamp
FROM
order_test1
GROUP
BY
color
,
timestamp
ORDER
BY
color
ASC
,
timestamp
DESC
;
select
''
;
select
'------cast to String----'
;
select
''
;
SELECT
cast
(
color
,
'String'
)
color
,
toDateTime
(
timestamp
)
AS
second
FROM
order_test1
GROUP
BY
color
,
second
ORDER
BY
color
ASC
,
second
DESC
;
select
''
;
select
''
;
SELECT
cast
(
color
,
'String'
)
color
,
timestamp
FROM
order_test1
GROUP
BY
color
,
timestamp
ORDER
BY
color
ASC
,
timestamp
DESC
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录