Class In

All Implemented Interfaces:
Expression

@Evolving public final class In extends Predicate
IN expression

Definition:

  • SQL semantic: expr IN (expr1, expr2, ...) [COLLATE collationIdentifier]
  • Requires the value expression to be evaluated against a list of literal expressions.
  • Result is true if the value matches any element in the list, false if no matches and no nulls, null if the value is null or any comparison results in null.
  • Supports collation for string comparisons.
  • Only supports primitive types . Nested types are not supported.
Since:
4.0.0
  • Constructor Details

    • In

      public In(Expression valueExpression, List<Expression> inListElements)
      Creates an IN predicate expression.
      Parameters:
      valueExpression - The expression to evaluate (left side of IN)
      inListElements - The list of literal expressions to check against
    • In

      public In(Expression valueExpression, List<Expression> inListElements, CollationIdentifier collationIdentifier)
      Creates an IN predicate expression with collation support.
      Parameters:
      valueExpression - The expression to evaluate (left side of IN)
      inListElements - The list of literal expressions to check against
      collationIdentifier - The collation identifier for string comparisons
  • Method Details

    • getValueExpression

      public Expression getValueExpression()
      Returns:
      The value expression to be evaluated (left side of IN).
    • getInListElements

      public List<Expression> getInListElements()
      Returns:
      The list of expressions to check against (right side of IN).
    • toString

      public String toString()
      Description copied from class: Predicate
      Returns string representation of the predicate.

      Format for binary operators: (left OP right) or (left OP right COLLATE collation)

      Examples:

      • (col = 5)
      • (name = 'John' COLLATE SPARK.UTF8_BINARY)

      Note: Specialized operators like IN override this method to provide their own string representation.

      Overrides:
      toString in class Predicate