Class SortExpr

java.lang.Object
org.apache.datafusion.SortExpr

public final class SortExpr extends Object
A single sort key passed to DataFrame.sort(SortExpr...), mirroring DataFusion's expr::Sort{ expr, asc, nulls_first }. Build via asc(String) or desc(String); tweak null placement via nullsFirst(boolean).

v1 accepts column names only -- the column string is interpreted as a column reference, not a SQL expression. Complex sort keys (e.g. "a + b") are intentionally deferred until the Java binding gains an Expr builder.

Defaults match DataFusion: asc(String) sorts ascending with NULLs last; desc(String) sorts descending with NULLs first.

  • Method Details

    • asc

      public static SortExpr asc(String column)
      Sort the given column ascending, with NULLs placed last.
    • desc

      public static SortExpr desc(String column)
      Sort the given column descending, with NULLs placed first.
    • nullsFirst

      public SortExpr nullsFirst(boolean v)
      Override the default NULL placement. true = NULLs first, false = last.
    • column

      public String column()
      The column name this sort key references.
    • ascending

      public boolean ascending()
      true if ascending, false if descending.
    • nullsFirst

      public boolean nullsFirst()
      true if NULLs are placed first, false if last.