Skip to content

Numeric, String, Boolean comparisons with literal NULL #2482

Closed

Description

@WinkerDu

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
As discuss in #1179 , there is bug when Numeric, String, Boolean comparisons work with literal NULL

Toproduce

> select * from (VALUES (1, 'foo' ,2.3), (2, 'bar', 5.4)) as t;
+---------+---------+---------+
| column1 | column2 | column3 |
+---------+---------+---------+
| 1       | foo     | 2.3     |
| 2       | bar     | 5.4     |
+---------+---------+---------+
2 rows in set. Query took 0.004 seconds.
> select column1 < null from (VALUES (1, 'foo' ,2.3), (2, 'bar', 5.4)) as t;
Plan("'Int64 < Utf8' can't be evaluated because there isn't a common type to coerce the types to")
> select column2 < null from (VALUES (1, 'foo' ,2.3), (2, 'bar', 5.4)) as t;
ArrowError(ExternalError(Internal("compute_utf8_op_scalar for 'lt' failed to cast literal value NULL")))
> select column3 < null from (VALUES (1, 'foo' ,2.3), (2, 'bar', 5.4)) as t;
Plan("'Float64 < Utf8' can't be evaluated because there isn't a common type to coerce the types to")

Describe the solution you'd like

  • Introduces null_coercion to comparison_eq_coercion and comparison_order_coercion
  • Enhances binary expression macros to support NULL scalar value comparing with array, like binary_array_op_dyn_scalar

Activity

  1. WinkerDu commented on May 20, 2022

    @WinkerDu
    ContributorAuthor

    closed by #2481

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions