Skip to content

Fix fuzzer found error (with totals)#16613

Merged
nikitamikhaylov merged 5 commits intoClickHouse:masterfrom
nikitamikhaylov:with_totals_having_assert
Nov 6, 2020
Merged

Fix fuzzer found error (with totals)#16613
nikitamikhaylov merged 5 commits intoClickHouse:masterfrom
nikitamikhaylov:with_totals_having_assert

Conversation

@nikitamikhaylov
Copy link
Copy Markdown
Member

@nikitamikhaylov nikitamikhaylov commented Nov 2, 2020

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

Changelog category (leave one):

  • Bug Fix

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

Detailed description / Documentation draft:
Forbid arrayJoin's in HAVING clause.

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Nov 2, 2020
@alexey-milovidov alexey-milovidov self-assigned this Nov 4, 2020
@alexey-milovidov
Copy link
Copy Markdown
Member

One test has to be updated.

@alexey-milovidov
Copy link
Copy Markdown
Member

arrayJoin of Array(Nothing) can be allowed (and was allowed) as soon as no value of type Nothing appears in the result.
It was already working in some scenarios.

The issue is when joining with empty array appears during the calculation of WITH TOTALS.

But in this case there is nothing special about Array(Nothing) comparing to Arrays of other types.

Please check the following query:

SELECT * FROM numbers(4) GROUP BY number WITH TOTALS HAVING sum(number) <= arrayJoin(CAST([] AS Array(UInt8)))

Maybe you did not really fix the issue and the "kludge" is irrelevant.

@alexey-milovidov
Copy link
Copy Markdown
Member

Also look at the #14500

It appears that it's just @KochetovNicolai has not completed the fix :)

Copy link
Copy Markdown
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

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

.

@alexey-milovidov
Copy link
Copy Markdown
Member

@KochetovNicolai You forgot to test the case #14500 (review)

Totals should simply disappear when joining with empty arrays.

@nikitamikhaylov nikitamikhaylov force-pushed the with_totals_having_assert branch from 98e5538 to aceb82a Compare November 5, 2020 16:00
@nikitamikhaylov
Copy link
Copy Markdown
Member Author

Stress test (undefined) broken in master.

@alexey-milovidov
Copy link
Copy Markdown
Member

@nikitamikhaylov Bad changelog.

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.

WITH TOTALS HAVING arrayJoin: Assertion `(n >= (static_cast<ssize_t>(pad_left_) ? -1 : 0)) ... failed

3 participants