Class Column

java.lang.Object
com.snowflake.snowpark_java.Column

public class Column extends Object
A column expression, carried as the SQL it stands for.

Snowpark builds an expression tree and renders it when the plan runs; the stub renders eagerly and keeps the text, which is the same thing for every purpose a handler can observe — col("a").gt(lit(1)) is (A > 1) either way. Operators parenthesise their operands so precedence survives nesting.

Each operator has a symbolic spelling and the word spelling Snowpark gives it (Java has no operator overloading, so equal_to and gt are the real API, not a convenience).

  • Constructor Details

    • Column

      public Column(String sql)
  • Method Details

    • as

      public Column as(String alias)
    • alias

      public Column alias(String alias)
    • plus

      public Column plus(Column other)
    • minus

      public Column minus(Column other)
    • multiply

      public Column multiply(Column other)
    • divide

      public Column divide(Column other)
    • mod

      public Column mod(Column other)
    • equal_to

      public Column equal_to(Column other)
    • not_equal

      public Column not_equal(Column other)
    • gt

      public Column gt(Column other)
    • lt

      public Column lt(Column other)
    • geq

      public Column geq(Column other)
    • leq

      public Column leq(Column other)
    • and

      public Column and(Column other)
    • or

      public Column or(Column other)
    • unary_not

      public Column unary_not()
    • is_null

      public Column is_null()
    • is_not_null

      public Column is_not_null()
    • like

      public Column like(Column pattern)
    • in

      public Column in(Column... values)
    • cast

      public Column cast(DataType to)
    • between

      public Column between(Column lower, Column upper)
      BETWEEN, inclusive on both ends as in SQL.
    • isNull

      public Column isNull()
      The real Column carries BOTH spellings; is_null() is the other one.
    • unary_minus

      public Column unary_minus()
    • equal_null

      public Column equal_null(Column other)
      NULL-safe equality — two NULLs compare equal, unlike =.
    • asc_nulls_first

      public Column asc_nulls_first()
    • asc_nulls_last

      public Column asc_nulls_last()
    • desc_nulls_first

      public Column desc_nulls_first()
    • desc_nulls_last

      public Column desc_nulls_last()
    • bitand

      public Column bitand(Column other)
    • bitor

      public Column bitor(Column other)
    • bitxor

      public Column bitxor(Column other)
    • collate

      public Column collate(String collationSpecification)
    • regexp

      public Column regexp(Column pattern)
    • subField

      public Column subField(String field)
      A field of a semi-structured value: v['name'].
    • subField

      public Column subField(int index)
      An element of a semi-structured array: v[0].
    • getName

      public Optional<String> getName()
      The column's name when it has one — measured to return Optional<String>.

      Frostlake answers it from the SQL this column carries: a bare identifier IS its name, and anything composed (an expression, a function call, a literal) has none, which is what the empty Optional says.

      The name comes back QUOTED and folded — col("name").getName() is "NAME", quotes included — because that is what live answers, and it is the resolved identifier rather than the text the caller typed.

    • asc

      public Column asc()
    • desc

      public Column desc()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object