Skip to content

Do not optimize any(arrayJoin()) -> arrayJoin() under optimize_move_functions_out_of_any#13681

Merged
alexey-milovidov merged 1 commit intoClickHouse:masterfrom
azat:optimize_move_functions_out_of_any-arrayJoin
Aug 14, 2020
Merged

Do not optimize any(arrayJoin()) -> arrayJoin() under optimize_move_functions_out_of_any#13681
alexey-milovidov merged 1 commit intoClickHouse:masterfrom
azat:optimize_move_functions_out_of_any-arrayJoin

Conversation

@azat
Copy link
Copy Markdown
Member

@azat azat commented Aug 13, 2020

Changelog category (leave one):

  • Bug Fix

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Do not optimize any(arrayJoin()) -> arrayJoin() under optimize_move_functions_out_of_any

Detailed description / Documentation draft:
Otherwise the following query will be optimized incorrectly:

SELECT
    *,
    any(arrayJoin([[], []]))
FROM numbers(1)
GROUP BY number

And the result will be:

┌─number─┬─arrayJoin(array(array(), array()))─┐
│      0 │ []                                 │
│      0 │ []                                 │
└────────┴────────────────────────────────────┘

While should be:

┌─number─┬─any(arrayJoin(array(array(), array())))─┐
│      0 │ []                                      │
└────────┴─────────────────────────────────────────┘

Refs: #11529
Refs: #12664
Cc: @4ertus2
Cc: @kamalov-ruslan

…unctions_out_of_any

Otherwise the following query will be optimized incorrectly:

    SELECT
        *,
        any(arrayJoin([[], []]))
    FROM numbers(1)
    GROUP BY number

And the result will be:

    ┌─number─┬─arrayJoin(array(array(), array()))─┐
    │      0 │ []                                 │
    │      0 │ []                                 │
    └────────┴────────────────────────────────────┘

While should be:

    ┌─number─┬─any(arrayJoin(array(array(), array())))─┐
    │      0 │ []                                      │
    └────────┴─────────────────────────────────────────┘
@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Aug 13, 2020
@alexey-milovidov
Copy link
Copy Markdown
Member

test_storage_rabbitmq - known bad test.

@alexey-milovidov alexey-milovidov merged commit e1a2505 into ClickHouse:master Aug 14, 2020
robot-clickhouse pushed a commit that referenced this pull request Aug 14, 2020
…n() under optimize_move_functions_out_of_any
robot-clickhouse pushed a commit that referenced this pull request Aug 14, 2020
…n() under optimize_move_functions_out_of_any
robot-clickhouse pushed a commit that referenced this pull request Aug 14, 2020
…n() under optimize_move_functions_out_of_any
@azat azat deleted the optimize_move_functions_out_of_any-arrayJoin branch August 14, 2020 18:07
alexey-milovidov added a commit that referenced this pull request Aug 15, 2020
Backport #13681 to 20.5: Do not optimize any(arrayJoin()) -> arrayJoin() under optimize_move_functions_out_of_any
alexey-milovidov added a commit that referenced this pull request Aug 15, 2020
Backport #13681 to 20.7: Do not optimize any(arrayJoin()) -> arrayJoin() under optimize_move_functions_out_of_any
alexey-milovidov added a commit that referenced this pull request Aug 15, 2020
Backport #13681 to 20.6: Do not optimize any(arrayJoin()) -> arrayJoin() under optimize_move_functions_out_of_any
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.

3 participants