Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix INSERT SELECT incorrectly fills MATERIALIZED column based of Nullable column #30189

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

azat
Copy link
Collaborator

@azat azat commented Oct 14, 2021

Changelog category (leave one):

  • Bug Fix (user-visible misbehaviour in official stable or prestable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix INSERT SELECT incorrectly fills MATERIALIZED column based of Nullable column

Detailed description / Documentation draft:
Required columns of the default expression should not be converted to NULL,
since this map value to default and MATERIALIZED values will not work.

Consider the following structure:

  • A Nullable(Int64)
  • X Int64 materialized coalesce(A, -1)

With recursive_null_as_default=true you will get:

_CAST(coalesce(A, -1), 'Int64') AS X, NULL AS A

And this will ignore default expression.

Fixes: #23524 (Cc: @kssenii)
Fixes: #29729 (Cc: @tavplubix)
Backport: 21.7+

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Oct 14, 2021
@azat
Copy link
Collaborator Author

azat commented Oct 14, 2021

Marker check — 5 checks failed (max 5)

I wish this PR has force test label (there was few flaky tests that had been fixed recently), but let's do a rebase (since fixes had been merged already).

…able column

Required columns of the default expression should not be converted to NULL,
since this map value to default and MATERIALIZED values will not work.

Consider the following structure:
- A Nullable(Int64)
- X Int64 materialized coalesce(A, -1)

With recursive_null_as_default=true you will get:

    _CAST(coalesce(A, -1), 'Int64') AS X, NULL AS A

And this will ignore default expression.

Fixes: ClickHouse#23524 (Cc: @kssenii)
Fixes: ClickHouse#29729 (Cc: @tavplubix)
Backport: 21.7+
@azat azat force-pushed the fix-INSERT-SELECT-MATERIALIZED branch from 2f5134c to a063097 Compare October 14, 2021 22:36
@azat
Copy link
Collaborator Author

azat commented Oct 15, 2021

ClickHouse special build check — 6/7 builds are OK

Functional stateless tests (release) — fail: 1, passed: 3463

Functional stateless tests (thread) — Timeout, fail: 3, passed: 928, skipped: 3, unknown: 9

@kssenii kssenii self-assigned this Oct 15, 2021
@kssenii kssenii merged commit 0e228a2 into ClickHouse:master Oct 15, 2021
robot-clickhouse pushed a commit that referenced this pull request Oct 15, 2021
robot-clickhouse pushed a commit that referenced this pull request Oct 15, 2021
robot-clickhouse pushed a commit that referenced this pull request Oct 15, 2021
robot-clickhouse pushed a commit that referenced this pull request Oct 15, 2021
@azat azat deleted the fix-INSERT-SELECT-MATERIALIZED branch October 15, 2021 21:41
alexey-milovidov added a commit that referenced this pull request Oct 16, 2021
Backport #30189 to 21.10: Fix INSERT SELECT incorrectly fills MATERIALIZED column based of Nullable column
kssenii added a commit that referenced this pull request Oct 20, 2021
Backport #30189 to 21.8: Fix INSERT SELECT incorrectly fills MATERIALIZED column based of Nullable column
kssenii added a commit that referenced this pull request Oct 20, 2021
Backport #30189 to 21.9: Fix INSERT SELECT incorrectly fills MATERIALIZED column based of Nullable column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Pull request with bugfix, not backported by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

INSERT SELECT incorrectly fills MATERIALIZED column
3 participants