Skip to content

Support LowCardinality nullability with join_use_nulls - #23237

Merged
vdimir merged 4 commits into
ClickHouse:masterfrom
vdimir:fix-join-lowcard-nullable
Apr 29, 2021
Merged

vdimir merged 4 commits into
ClickHouse:masterfrom
vdimir:fix-join-lowcard-nullable

Conversation

@vdimir

@vdimir vdimir commented Apr 17, 2021

Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Support LowCardinality nullability with join_use_nulls, close #15101

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Apr 17, 2021
@vdimir vdimir changed the title Convert columns to LC(Nullable(T)) in join Support LowCardinality nullability with join_use_nulls Apr 17, 2021
@vdimir

vdimir commented Apr 20, 2021 •

Copy link
Copy Markdown
Member Author

Fuzz reproduced in master, created issue #23351

@Avogar Avogar self-assigned this Apr 26, 2021
Comment thread src/Interpreters/join_common.cpp Outdated
/// Convert nested to nullable, not LowCardinality itself
auto new_col = column.column->cloneEmpty();
new_col->insertRangeFrom(*column.column, 0, column.column->size());
/// How to call non-constant methon on ColumnPtr without a copy?

@Avogar Avogar Apr 26, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column->assumeMutable()-><method_name>(...)
So, we can do just column.column->assumeMutable()->nestedToNullable() here.

@vdimir vdimir Apr 28, 2021 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, changed here fb88547 (#23237)

@Avogar

Avogar commented Apr 28, 2021 •

Copy link
Copy Markdown
Member

@vdimir let's remove coping in convertColumnToNullable and merge it.

@vdimir

vdimir commented Apr 29, 2021 •

Copy link
Copy Markdown
Member Author

Fuzzer (https://clickhouse-test-reports.s3.yandex.net/23237/fb88547a04e3cdc7fe3e032f154fa50c07adc542/fuzzer_debug/report.html#fail1) reproduced on master

DROP TABLE IF EXISTS r;
DROP TABLE IF EXISTS l_lc;

CREATE TABLE r (x UInt32, lc String) ENGINE = Memory;
CREATE TABLE l_lc (x UInt32, lc LowCardinality(String)) ENGINE = Memory;

INSERT INTO r VALUES (0, 'str');
INSERT INTO r_lc VALUES (0, 'str');

SELECT
    l.lc,
    materialize(r.lc),
    l.lc
FROM l_lc AS l
RIGHT JOIN r USING (lc)
;
Logical error: 'Bad cast from type DB::ColumnLowCardinality to DB::ColumnString'

Known issue #23351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

join_use_nulls on LowCardinality type does not work

3 participants