Skip to content

[BUG] Predicate push down where sub query has distinct may throw NPE #4313

Description

@yangzhg

Describe the bug
Predicate push down where sub query has distinct may throw NPE

To Reproduce
Steps to reproduce the behavior:

  1. create table like
+--------------+--------------+------+-------+---------+---------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-------+---------+---------+
| event_day | DATETIME | No | true | NULL | |
| title | VARCHAR(600) | No | true | NULL | |
| report_value | VARCHAR(50) | No | false | NULL | REPLACE |
+--------------+--------------+------+-------+---------+---------+
  1. exec query

```SELECT
*
FROM
(
SELECT
DISTINCT event_day,
title
FROM
click_show_window
) a
WHERE
a.title IS NOT NULL
  1. See error
ERROR 1064 (HY000): errCode = 2, detailMessage = Unexpected exception: null

This is because DISTINCT generate grouping exprs in agginfo, but this clause does not have a group by clause

Activity

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

Metadata

Metadata

Assignees

Labels

kind/fixCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions