Skip to content

[FEA] Null-tolerant logical AND and OR operations #8980

Closed

Description

@jlowe

Is your feature request related to a problem? Please describe.
Currently the logical AND and OR binary operators are what I would call "null intolerant", in that any null input automatically results in a null output regardless of the operand and other inputs. However for SQL engines, logical AND and OR treat null as an "unknown value", and in that context a non-null result can occur in spite of a null input. For example:

null && false == false
false && null == false
null || true == true
true || null == true

Currently the RAPIDS Accelerator has to hack around the null intolerant form of LOGICAL_AND and LOGICAL_OR to "fixup" the value if one side was false or true, respectively. When it comes to the AST versions of these operations, there isn't yet enough expressiveness to hack up the correct answer since it is missing something like an if statement.

Describe the solution you'd like
libcudf could have null-tolerant, short-circuiting, or whatever name we want to call it form of logical AND and OR that can return non-null inputs in some cases despite one of the inputs being null. These new operators would be available both in the binops API and also as AST binary operators for AST expressions.

Describe alternatives you've considered
Without these operators we would need to perform extra steps to detect and "fixup" the incorrect null answer in the short-circuit cases. The AST currently lacks the ability to express this behavior, so we either need direct support of the binary operation or the ability to express the fixup logic in order to support logical AND and OR Spark expressions in conditional joins.

Activity

  1. added
    feature request
    Needs Triage
    libcudf
    Spark
    on Aug 5, 2021
  2. added this to the Conditional Joins milestone on Aug 5, 2021
  3. removed
    Needs Triage
    on Aug 23, 2021
  4. vyasr commented on Aug 25, 2021

    @vyasr
    Contributor

    #9096 addresses this request for AST expressions.

  5. added a commit that references this issue on Sep 9, 2021
  6. github-actions commented on Nov 15, 2021

    @github-actions

    This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

  7. jlowe commented on Nov 15, 2021

    @jlowe
    ContributorAuthor

    Still would like to see this for regular logical binary ops outside of AST. Low priority.

  8. added
    0 - Backlog
    and removed on Nov 15, 2021
  9. self-assigned this
    on Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

0 - BacklogSparkfeature requestlibcudf

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions