Skip to content

SQL: Incorrect NULL from aggregation on nullable union in sam #6799

@philrz

Description

@philrz

The following query returns an incorrect NULL return value when run in sequential runtime.

$ super -s -o input-with-union.sup -c "values {col0:5::(int64|null)},{col0:10::(int64|null)}" &&
  super -sam -c "SELECT MAX(col0) FROM 'input-with-union.sup';"
{MAX:null}

Details

Repro is with super commit 8e75f06. The query above is a simplification of sqllogictest query groupby/slt_good_12/q9771, which is one of many that failed in the last overnight run, correlated with the merge of the changes in #6795.

The query returns the expected result in vector runtime.

$ super -version
Version: v0.3.0-29-g8e75f06f8

$ super -vam -c "SELECT MAX(col0) FROM 'input-with-union.sup';"
{MAX:10}

The problem seems to be unique to the values having a union type that includes the null type, as the following returns the correct result in sequential runtime.

$ super -s -o input-no-union.sup -c "values {col0:5},{col0:10}" &&
  super -sam -c "SELECT MAX(col0) FROM 'input-no-union.sup';"

We can also get the correct result in sequential runtime if we jump back to the commit right before the changes merged from #6795.

$ super -version
Version: v0.3.0-28-g15d2ef03a

$ super -sam -c "SELECT MAX(col0) FROM 'input-with-union.sup';"
{MAX:10}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions