object functions
Provides utility functions that generate Column expressions that you can pass to DataFrame transformation methods. These functions generate references to columns, literals, and SQL expressions (e.g. "c + 1").
This object also provides functions that correspond to Snowflake system-defined functions (built-in functions), including functions for aggregation and window functions.
The following examples demonstrate the use of some of these functions:
// Use columns and literals in expressions. df.select(col("c") + lit(1)) // Call system-defined (built-in) functions. // This example calls the function that corresponds to the ADD_MONTHS() SQL function. df.select(add_months(col("d"), lit(3))) // Call system-defined functions that have no corresponding function in the functions object. // This example calls the RADIANS() SQL function, passing in values from the column "e". df.select(callBuiltin("radians", col("e"))) // Call a user-defined function (UDF) by name. df.select(callUDF("some_func", col("c"))) // Register and call an anonymous UDF. val myudf = udf((x:Int) => x + x) df.select(myudf(col("c"))) // Evaluate an SQL expression df.select(sqlExpr("c + 1"))
For functions that accept scala types, e.g. callUdf, callBuiltin, lit(), the mapping from scala types to Snowflake types is as follows:
String => String Byte => TinyInt Int => Int Short => SmallInt Long => BigInt Float => Float Double => Double Decimal => Number Boolean => Boolean Array => Array Timestamp => Timestamp Date => Date
- Since
0.1.0
- Alphabetic
- By Inheritance
- functions
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class builtin(functionName: String) extends Product with Serializable
Function object to invoke a Snowflake builtin.
Function object to invoke a Snowflake builtin. Use this to invoke any builtins not explicitly listed in this object.
Example
val repeat = functions.builtin("repeat") df.select(repeat(col("col_1"), 3))
- Since
0.1.0
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def abs(e: Column): Column
Returns the absolute value of a numeric expression.
Returns the absolute value of a numeric expression.
- Since
0.1.0
- def acos(e: Column): Column
Computes the inverse cosine (arc cosine) of its input; the result is a number in the interval [-pi, pi].
Computes the inverse cosine (arc cosine) of its input; the result is a number in the interval [-pi, pi].
- Since
0.1.0
- def add_months(startDate: Column, numMonths: Column): Column
Adds or subtracts a specified number of months to a date or timestamp, preserving the end-of-month information.
Adds or subtracts a specified number of months to a date or timestamp, preserving the end-of-month information.
- Since
0.1.0
- def any_value(e: Column): Column
Returns a non-deterministic value for the specified column.
Returns a non-deterministic value for the specified column.
- Since
0.12.0
- def approx_count_distinct(e: Column): Column
Uses HyperLogLog to return an approximation of the distinct cardinality of the input (i.e.
Uses HyperLogLog to return an approximation of the distinct cardinality of the input (i.e. returns an approximation of
COUNT(DISTINCT col)).- Since
0.1.0
- def approx_percentile(col: Column, percentile: Double): Column
Returns an approximated value for the desired percentile.
Returns an approximated value for the desired percentile. This function uses the t-Digest algorithm.
- Since
0.2.0
- def approx_percentile_accumulate(col: Column): Column
Returns the internal representation of the t-Digest state (as a JSON object) at the end of aggregation.
Returns the internal representation of the t-Digest state (as a JSON object) at the end of aggregation. This function uses the t-Digest algorithm.
- Since
0.2.0
- def approx_percentile_combine(state: Column): Column
Combines (merges) percentile input states into a single output state.
Combines (merges) percentile input states into a single output state.
This allows scenarios where APPROX_PERCENTILE_ACCUMULATE is run over horizontal partitions of the same table, producing an algorithm state for each table partition. These states can later be combined using APPROX_PERCENTILE_COMBINE, producing the same output state as a single run of APPROX_PERCENTILE_ACCUMULATE over the entire table.
- Since
0.2.0
- def approx_percentile_estimate(state: Column, percentile: Double): Column
Returns the desired approximated percentile value for the specified t-Digest state.
Returns the desired approximated percentile value for the specified t-Digest state. APPROX_PERCENTILE_ESTIMATE(APPROX_PERCENTILE_ACCUMULATE(.)) is equivalent to APPROX_PERCENTILE(.).
- Since
0.2.0
- def array(c: Column*): Column
Returns an ARRAY constructed from zero, one, or more inputs.
Returns an ARRAY constructed from zero, one, or more inputs.
Example:
val df = session.createDataFrame(Seq((1, 2, 3), (4, 5, 6))).toDF("id") df.select(array(col("a"), col("b")).as("id")).show() -------- |"ID" | -------- |[ | | 1, | | 2 | |] | |[ | | 4, | | 5 | |] | --------
- c
Columns to build the array.
- returns
The array.
- Since
1.14.0
- def array_agg(col: Column): Column
Returns the input values, pivoted into an ARRAY.
Returns the input values, pivoted into an ARRAY. If the input is empty, an empty ARRAY is returned.
- Since
0.2.0
- def array_append(array: Column, element: Column): Column
Returns an ARRAY containing all elements from the source ARRAYas well as the new element.
Returns an ARRAY containing all elements from the source ARRAYas well as the new element. The new element is located at end of the ARRAY.
- array
The column containing the source ARRAY.
- element
The column containing the element to be appended. The element may be of almost any data type. The data type does not need to match the data type(s) of the existing elements in the ARRAY.
- Since
0.2.0
- def array_cat(array1: Column, array2: Column): Column
Returns the concatenation of two ARRAYs.
Returns the concatenation of two ARRAYs.
- array1
Column containing the source ARRAY.
- array2
Column containing the ARRAY to be appended to
array1.
- Since
0.2.0
- def array_compact(array: Column): Column
Returns a compacted ARRAY with missing and null values removed, effectively converting sparse arrays into dense arrays.
Returns a compacted ARRAY with missing and null values removed, effectively converting sparse arrays into dense arrays.
- Since
0.2.0
- def array_construct(cols: Column*): Column
Returns an ARRAY constructed from zero, one, or more inputs.
Returns an ARRAY constructed from zero, one, or more inputs.
- cols
Columns containing the values (or expressions that evaluate to values). The values do not all need to be of the same data type.
- Since
0.2.0
- def array_construct_compact(cols: Column*): Column
Returns an ARRAY constructed from zero, one, or more inputs; the constructed ARRAY omits any NULL input values.
Returns an ARRAY constructed from zero, one, or more inputs; the constructed ARRAY omits any NULL input values.
- cols
Columns containing the values (or expressions that evaluate to values). The values do not all need to be of the same data type.
- Since
0.2.0
- def array_contains(variant: Column, array: Column): Column
Returns
trueif the specified VARIANT is found in the specified ARRAY.Returns
trueif the specified VARIANT is found in the specified ARRAY.- variant
Column containing the VARIANT to find.
- array
Column containing the ARRAY to search.
- Since
0.2.0
- def array_flatten(array: Column): Column
Flattens an array of arrays into a single array, removing only one level of nesting.
Flattens an array of arrays into a single array, removing only one level of nesting.
Examples
Example 1: Flattens a two-level nested array into a single array of elements.
val df = Seq( Array(Array(1, 2), Array(3, 4)), Array(Array(5, 6, 7), Array(8)), Array(Array.empty[Int], Array(9, 10)), ).toDF("a") df.select(array_flatten(col("a"))).show() -------------------------- |"ARRAY_FLATTEN(""A"")" | -------------------------- |[ | | 1, | | 2, | | 3, | | 4 | |] | |[ | | 5, | | 6, | | 7, | | 8 | |] | |[ | | 9, | | 10 | |] | --------------------------
Example 2: Flattens only one level of a three-level nested array.
val df = Seq( Array(Array(Array(1, 2), Array(3)), Array(Array(4, 5))) ).toDF("a") df.select(array_flatten(col("a"))).show() -------------------------- |"ARRAY_FLATTEN(""A"")" | -------------------------- |[ | | [ | | 1, | | 2 | | ], | | [ | | 3 | | ], | | [ | | 4, | | 5 | | ] | |] | --------------------------
- array
Column containing the array of arrays to flatten.
- If any element of
arrayis not an ARRAY, the function throws an error. - If
arrayis NULL, the function returns NULL.
- If any element of
- returns
A column containing the flattened array.
- Since
1.17.0
- def array_insert(array: Column, pos: Column, element: Column): Column
Returns an ARRAY containing all elements from the source ARRAY as well as the new element.
Returns an ARRAY containing all elements from the source ARRAY as well as the new element.
- array
Column containing the source ARRAY.
- pos
Column containing a (zero-based) position in the source ARRAY. The new element is inserted at this position. The original element from this position (if any) and all subsequent elements (if any) are shifted by one position to the right in the resulting array (i.e. inserting at position 0 has the same effect as using array_prepend). A negative position is interpreted as an index from the back of the array (e.g.
-1results in insertion before the last element in the array).- element
Column containing the element to be inserted. The new element is located at position
pos. The relative order of the other elements from the source array is preserved.
- Since
0.2.0
- def array_intersection(col1: Column, col2: Column): Column
Returns an ARRAY that contains the matching elements in the two input ARRAYs.
Returns an ARRAY that contains the matching elements in the two input ARRAYs.
- Since
0.1.0
- def array_position(variant: Column, array: Column): Column
Returns the index of the first occurrence of an element in an ARRAY.
Returns the index of the first occurrence of an element in an ARRAY.
- variant
Column containing the VARIANT value that you want to find. The function searches for the first occurrence of this value in the array.
- array
Column containing the ARRAY to be searched.
- Since
0.2.0
- def array_prepend(array: Column, element: Column): Column
Returns an ARRAY containing the new element as well as all elements from the source ARRAY.
Returns an ARRAY containing the new element as well as all elements from the source ARRAY. The new element is positioned at the beginning of the ARRAY.
- array
Column containing the source ARRAY.
- element
Column containing the element to be prepended.
- Since
0.2.0
- def array_size(array: Column): Column
Returns the size of the input ARRAY.
Returns the size of the input ARRAY.
If the specified column contains a VARIANT value that contains an ARRAY, the size of the ARRAY is returned; otherwise, NULL is returned if the value is not an ARRAY.
- Since
0.2.0
- def array_slice(array: Column, from: Column, to: Column): Column
Returns an ARRAY constructed from a specified subset of elements of the input ARRAY.
Returns an ARRAY constructed from a specified subset of elements of the input ARRAY.
- array
Column containing the source ARRAY.
- from
Column containing a position in the source ARRAY. The position of the first element is
0. Elements from positions less than this parameter are not included in the resulting ARRAY.- to
Column containing a position in the source ARRAY. Elements from positions equal to or greater than this parameter are not included in the resulting array.
- Since
0.2.0
- def array_to_string(array: Column, separator: Column): Column
Returns an input ARRAY converted to a string by casting all values to strings (using TO_VARCHAR) and concatenating them (using the string from the second argument to separate the elements).
Returns an input ARRAY converted to a string by casting all values to strings (using TO_VARCHAR) and concatenating them (using the string from the second argument to separate the elements).
- array
Column containing the ARRAY of elements to convert to a string.
- separator
Column containing the string to put between each element (e.g. a space, comma, or other human-readable separator).
- Since
0.2.0
- def arrays_overlap(a1: Column, a2: Column): Column
Compares whether two arrays have at least one element in common.
Compares whether two arrays have at least one element in common. Returns TRUE if there is at least one element in common; otherwise returns FALSE. The function is NULL-safe, meaning it treats NULLs as known values for comparing equality.
- Since
0.1.0
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def as_array(variant: Column): Column
Casts a VARIANT value to an array.
Casts a VARIANT value to an array.
- Since
0.2.0
- def as_binary(variant: Column): Column
Casts a VARIANT value to a binary string.
Casts a VARIANT value to a binary string.
- Since
0.2.0
- def as_char(variant: Column): Column
Casts a VARIANT value to a string.
Casts a VARIANT value to a string. Does not convert values of other types into string.
- Since
0.2.0
- def as_date(variant: Column): Column
Casts a VARIANT value to a date.
Casts a VARIANT value to a date. Does not convert from timestamps.
- Since
0.2.0
- def as_decimal(variant: Column, precision: Int, scale: Int): Column
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision and scale.
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision and scale.
- Since
0.2.0
- def as_decimal(variant: Column, precision: Int): Column
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision.
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision.
- Since
0.2.0
- def as_decimal(variant: Column): Column
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values).
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values).
- Since
0.2.0
- def as_double(variant: Column): Column
Casts a VARIANT value to a floating-point value.
Casts a VARIANT value to a floating-point value.
- Since
0.2.0
- def as_integer(variant: Column): Column
Casts a VARIANT value to an integer.
Casts a VARIANT value to an integer. Does not match non-integer values.
- Since
0.2.0
- def as_number(variant: Column, precision: Int, scale: Int): Column
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision and scale.
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision and scale.
- Since
0.2.0
- def as_number(variant: Column, precision: Int): Column
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision.
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values), with precision.
- Since
0.2.0
- def as_number(variant: Column): Column
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values).
Casts a VARIANT value to a fixed-point decimal (does not match floating-point values).
- Since
0.2.0
- def as_object(variant: Column): Column
Casts a VARIANT value to an object.
Casts a VARIANT value to an object.
- Since
0.2.0
- def as_real(variant: Column): Column
Casts a VARIANT value to a floating-point value.
Casts a VARIANT value to a floating-point value.
- Since
0.2.0
- def as_time(variant: Column): Column
Casts a VARIANT value to a time value.
Casts a VARIANT value to a time value. Does not convert from timestamps.
- Since
0.2.0
- def as_timestamp_ltz(variant: Column): Column
Casts a VARIANT value to a TIMESTAMP value with local timezone.
Casts a VARIANT value to a TIMESTAMP value with local timezone.
- Since
0.2.0
- def as_timestamp_ntz(variant: Column): Column
Casts a VARIANT value to a TIMESTAMP value with no timezone.
Casts a VARIANT value to a TIMESTAMP value with no timezone.
- Since
0.2.0
- def as_timestamp_tz(variant: Column): Column
Casts a VARIANT value to a TIMESTAMP value with timezone.
Casts a VARIANT value to a TIMESTAMP value with timezone.
- Since
0.2.0
- def as_varchar(variant: Column): Column
Casts a VARIANT value to a string.
Casts a VARIANT value to a string. Does not convert values of other types into string.
- Since
0.2.0
- def asc(colName: String): Column
Returns a Column expression with values sorted in ascending order.
Returns a Column expression with values sorted in ascending order. Example:
val df = session.createDataFrame(Seq(3, 2, 1)).toDF("id") df.sort(asc("id")).show() -------- |"ID" | -------- |1 | |2 | |3 | --------
- colName
Column name.
- returns
Column object ordered in an ascending manner.
- Since
1.14.0
- def ascii(e: Column): Column
Returns the ASCII code for the first character of a string.
Returns the ASCII code for the first character of a string. If the string is empty, a value of 0 is returned.
- Since
0.1.0
- def asin(e: Column): Column
Computes the inverse sine (arc sine) of its argument; the result is a number in the interval [-pi, pi].
Computes the inverse sine (arc sine) of its argument; the result is a number in the interval [-pi, pi].
- Since
0.1.0
- def atan(e: Column): Column
Computes the inverse tangent (arc tangent) of its argument; the result is a number in the interval [-pi, pi].
Computes the inverse tangent (arc tangent) of its argument; the result is a number in the interval [-pi, pi].
- Since
0.1.0
- def atan2(y: Column, x: Column): Column
Computes the inverse tangent (arc tangent) of the ratio of its two arguments.
Computes the inverse tangent (arc tangent) of the ratio of its two arguments.
- Since
0.1.0
- def avg(e: Column): Column
Returns the average of non-NULL records.
Returns the average of non-NULL records. If all records inside a group are NULL, the function returns NULL.
- Since
0.1.0
- def base64(col: Column): Column
Computes the BASE64 encoding of a column and returns it as a string column.
Computes the BASE64 encoding of a column and returns it as a string column. This is the reverse of unbase64. Example
val df = session.createDataFrame(Seq("test")).toDF("a") df.select(base64(col("a")).as("base64")).show() ------------ |"BASE64" | ------------ |dGVzdA== | ------------
- returns
base64 encoded value of the given input column.
- Since
1.14.0
- def bitnot(e: Column): Column
Returns the bitwise negation of a numeric expression.
Returns the bitwise negation of a numeric expression.
- Since
0.1.0
- def bitshiftleft(e: Column, numBits: Column): Column
Shifts the bits for a numeric expression numBits positions to the left.
Shifts the bits for a numeric expression numBits positions to the left.
- Since
0.1.0
- def bitshiftright(e: Column, numBits: Column): Column
Shifts the bits for a numeric expression numBits positions to the right.
Shifts the bits for a numeric expression numBits positions to the right.
- Since
0.1.0
- def callBuiltin(functionName: String, args: Any*): Column
Invokes a built-in snowflake function with the specified name and arguments.
Invokes a built-in snowflake function with the specified name and arguments. Arguments can be of two types
- Column, or
b. Basic types such as Int, Long, Double, Decimal etc. which are converted to Snowpark literals.
- Since
0.1.0
- def callUDF(udfName: String, cols: Any*): Column
Calls a user-defined function (UDF) by name.
Calls a user-defined function (UDF) by name.
- Since
0.1.0
- def ceil(e: Column): Column
Returns values from the specified column rounded to the nearest equal or larger integer.
Returns values from the specified column rounded to the nearest equal or larger integer.
- Since
0.1.0
- def char(col: Column): Column
Converts a Unicode code point (including 7-bit ASCII) into the character that matches the input Unicode.
Converts a Unicode code point (including 7-bit ASCII) into the character that matches the input Unicode.
- Since
0.1.0
- def charindex(targetExpr: Column, sourceExpr: Column, position: Column): Column
Searches for targetExpr in sourceExpr and, if successful, returns the position (1-based) of the targetExpr in sourceExpr.
Searches for targetExpr in sourceExpr and, if successful, returns the position (1-based) of the targetExpr in sourceExpr.
- Since
0.1.0
- def charindex(targetExpr: Column, sourceExpr: Column): Column
Searches for targetExpr in sourceExpr and, if successful, returns the position (1-based) of the targetExpr in sourceExpr.
Searches for targetExpr in sourceExpr and, if successful, returns the position (1-based) of the targetExpr in sourceExpr.
- Since
0.1.0
- def check_json(col: Column): Column
Checks the validity of a JSON document.
Checks the validity of a JSON document. If the input string is a valid JSON document or a NULL (i.e. no error would occur when parsing the input string), the function returns NULL. In case of a JSON parsing error, the function returns a string that contains the error message.
- Since
0.2.0
- def check_xml(col: Column): Column
Checks the validity of an XML document.
Checks the validity of an XML document. If the input string is a valid XML document or a NULL (i.e. no error would occur when parsing the input string), the function returns NULL. In case of an XML parsing error, the output string contains the error message.
- Since
0.2.0
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def coalesce(e: Column*): Column
Returns the first non-NULL expression among its arguments, or NULL if all its arguments are NULL.
Returns the first non-NULL expression among its arguments, or NULL if all its arguments are NULL.
- Since
0.1.0
- def col(df: DataFrame): Column
Generate a Column representing the result of the input DataFrame.
Generate a Column representing the result of the input DataFrame. The parameter
dfshould have one column and must produce one row. Is an alias of toScalar.For Example:
import functions._ val df1 = session.sql("select * from values(1,1,1),(2,2,3) as T(c1,c2,c3)") val df2 = session.sql("select * from values(2) as T(a)") df1.select(Column("c1"), col(df2)).show() df1.filter(Column("c1") < col(df2)).show()
- Since
0.2.0
- def col(colName: String): Column
Returns the Column with the specified name.
Returns the Column with the specified name.
- Since
0.1.0
- def collate(expr: Column, collationSpec: String): Column
Returns a copy of expr, but with the specified collationSpec property instead of the original collation specification property.
Returns a copy of expr, but with the specified collationSpec property instead of the original collation specification property.
Collation Specification is specified here
- Since
0.1.0
- def collation(expr: Column): Column
Returns the collation specification of expr.
Returns the collation specification of expr.
- Since
0.1.0
- def collect_list(s: String): Column
Returns the input values, pivoted into an ARRAY.
Returns the input values, pivoted into an ARRAY. If the input is empty, an empty ARRAY is returned.
Example::
>>> df = session.create_dataframe([[1], [2], [3], [1]], schema=["a"]) >>> df.select(array_agg("a", True).alias("result")).show() ------------ |"RESULT" | ------------ |[ | | 1, | | 2, | | 3 | |] | ------------
- s
Column name to be collected.
- returns
The array.
- Since
1.14.0
- def collect_list(c: Column): Column
Returns the input values, pivoted into an ARRAY.
Returns the input values, pivoted into an ARRAY. If the input is empty, an empty ARRAY is returned. <pr> Example::
>>> df = session.create_dataframe([[1], [2], [3], [1]], schema=["a"]) >>> df.select(array_agg("a", True).alias("result")).show() ------------ |"RESULT" | ------------ |[ | | 1, | | 2, | | 3 | |] | ------------
</pr>
- c
Column to be collect.
- returns
The array.
- Since
1.14.0
- def collect_set(e: String): Column
Aggregate function: returns a set of objects with duplicate elements eliminated.
Aggregate function: returns a set of objects with duplicate elements eliminated. Returns the input values, pivoted into an ARRAY. If the input is empty, an empty ARRAY is returned.
Example::
>>> df = session.create_dataframe([[1], [2], [3], [1]], schema=["a"]) >>> df.select(array_agg("a", True).alias("result")).show() ------------ |"RESULT" | ------------ |[ | | 1, | | 2, | | 3 | |] | ------------
- e
The column to collect the list values
- returns
A list with unique values
- Since
1.15.0
- def collect_set(e: Column): Column
Aggregate function: returns a set of objects with duplicate elements eliminated.
Aggregate function: returns a set of objects with duplicate elements eliminated. Returns the input values, pivoted into an ARRAY. If the input is empty, an empty ARRAY is returned.
Example::
>>> df = session.create_dataframe([[1], [2], [3], [1]], schema=["a"]) >>> df.select(array_agg("a", True).alias("result")).show() ------------ |"RESULT" | ------------ |[ | | 1, | | 2, | | 3 | |] | ------------
- e
The column to collect the list values
- returns
A list with unique values
- Since
1.15.0
- def column(colName: String): Column
Returns a Column with the specified name.
Returns a Column with the specified name. Alias for col.
- Since
0.1.0
- def concat(exprs: Column*): Column
Concatenates one or more strings, or concatenates one or more binary values.
Concatenates one or more strings, or concatenates one or more binary values. If any of the values is null, the result is also null.
- Since
0.1.0
- def concat_ws(separator: Column, exprs: Column*): Column
Concatenates two or more strings, or concatenates two or more binary values.
Concatenates two or more strings, or concatenates two or more binary values. If any of the values is null, the result is also null.
- Since
0.1.0
- def concat_ws_ignore_nulls(separator: String, exprs: Column*): Column
Concatenates two or more strings ignoring any null values.
Concatenates two or more strings ignoring any null values.
Unlike concat_ws, this function automatically filters out null values before concatenation.
Examples
val df = session.createDataFrame( Seq( Row("Hello", "World", null), Row(null, null, null), Row("Hello", null, null), ), StructType( StructField("A", StringType), StructField("B", StringType), StructField("C", StringType), ) ) df.select( concat_ws_ignore_nulls(" | ", col("A"), col("B"), col("C")).as("concat_ws_ignore_nulls") ).show() ---------------------------- |"CONCAT_WS_IGNORE_NULLS" | ---------------------------- |Hello | World | | | |Hello | ----------------------------
- separator
A string literal used as the separator between concatenated values.
- exprs
The columns to be concatenated.
- returns
A Column containing the concatenated values with null values filtered out.
- Since
1.17.0
- def contains(col: Column, str: Column): Column
Returns true if col contains str.
Returns true if col contains str.
- Since
0.1.0
- def convert_timezone(targetTimeZone: Column, sourceTimestamp: Column): Column
Converts the given sourceTimestampNTZ to targetTimeZone.
Converts the given sourceTimestampNTZ to targetTimeZone.
Supported time zones are listed here
Example
timestamp.select(convert_timezone(lit("America/New_York"), col("time")))
- Since
0.1.0
- def convert_timezone(sourceTimeZone: Column, targetTimeZone: Column, sourceTimestampNTZ: Column): Column
Converts the given sourceTimestampNTZ from sourceTimeZone to targetTimeZone.
Converts the given sourceTimestampNTZ from sourceTimeZone to targetTimeZone.
Supported time zones are listed here
Example
timestampNTZ.select(convert_timezone(lit("America/Los_Angeles"), lit("America/New_York"), col("time")))
- Since
0.1.0
- def corr(column1: Column, column2: Column): Column
Returns the correlation coefficient for non-null pairs in a group.
Returns the correlation coefficient for non-null pairs in a group.
- Since
0.1.0
- def cos(e: Column): Column
Computes the cosine of its argument; the argument should be expressed in radians.
Computes the cosine of its argument; the argument should be expressed in radians.
- Since
0.1.0
- def cosh(e: Column): Column
Computes the hyperbolic cosine of its argument.
Computes the hyperbolic cosine of its argument.
- Since
0.1.0
- def count(e: Column): Column
Returns either the number of non-NULL records for the specified columns, or the total number of records.
Returns either the number of non-NULL records for the specified columns, or the total number of records.
- Since
0.1.0
- def countDistinct(expr: Column, exprs: Column*): Column
Returns either the number of non-NULL distinct records for the specified columns, or the total number of the distinct records.
Returns either the number of non-NULL distinct records for the specified columns, or the total number of the distinct records. An alias of count_distinct.
- Since
1.13.0
- def countDistinct(colName: String, colNames: String*): Column
Returns either the number of non-NULL distinct records for the specified columns, or the total number of the distinct records.
Returns either the number of non-NULL distinct records for the specified columns, or the total number of the distinct records. An alias of count_distinct.
- Since
1.13.0
- def count_distinct(expr: Column, exprs: Column*): Column
Returns either the number of non-NULL distinct records for the specified columns, or the total number of the distinct records.
Returns either the number of non-NULL distinct records for the specified columns, or the total number of the distinct records.
- Since
0.1.0
- def covar_pop(column1: Column, column2: Column): Column
Returns the population covariance for non-null pairs in a group.
Returns the population covariance for non-null pairs in a group.
- Since
0.1.0
- def covar_samp(column1: Column, column2: Column): Column
Returns the sample covariance for non-null pairs in a group.
Returns the sample covariance for non-null pairs in a group.
- Since
0.1.0
- def cume_dist(): Column
Finds the cumulative distribution of a value with regard to other values within the same window partition.
Finds the cumulative distribution of a value with regard to other values within the same window partition.
- Since
0.1.0
- def current_account(): Column
Returns the account used by the user's current session.
Returns the account used by the user's current session.
- Since
0.1.0
- def current_available_roles(): Column
Returns a JSON string that lists all roles granted to the current user.
Returns a JSON string that lists all roles granted to the current user.
- Since
0.1.0
- def current_database(): Column
Returns the name of the database in use for the current session.
Returns the name of the database in use for the current session.
- Since
0.1.0
- def current_date(): Column
Returns the current date of the system.
Returns the current date of the system.
- Since
0.1.0
- def current_region(): Column
Returns the name of the region for the account where the current user is logged in.
Returns the name of the region for the account where the current user is logged in.
- Since
0.1.0
- def current_role(): Column
Returns the name of the role in use for the current session.
Returns the name of the role in use for the current session.
- Since
0.1.0
- def current_schema(): Column
Returns the name of the schema in use by the current session.
Returns the name of the schema in use by the current session.
- Since
0.1.0
- def current_schemas(): Column
Returns active search path schemas.
Returns active search path schemas.
- Since
0.1.0
- def current_session(): Column
Returns a unique system identifier for the Snowflake session corresponding to the present connection.
Returns a unique system identifier for the Snowflake session corresponding to the present connection.
- Since
0.1.0
- def current_statement(): Column
Returns the SQL text of the statement that is currently executing.
Returns the SQL text of the statement that is currently executing.
- Since
0.1.0
- def current_time(): Column
Returns the current time for the system.
Returns the current time for the system.
- Since
0.1.0
- def current_timestamp(): Column
Returns the current timestamp for the system.
Returns the current timestamp for the system.
- Since
0.1.0
- def current_user(): Column
Returns the name of the user currently logged into the system.
Returns the name of the user currently logged into the system.
- Since
0.1.0
- def current_version(): Column
Returns the current Snowflake version.
Returns the current Snowflake version.
- Since
0.1.0
- def current_warehouse(): Column
Returns the name of the warehouse in use for the current session.
Returns the name of the warehouse in use for the current session.
- Since
0.1.0
- def date_add(start: Column, days: Column): Column
Returns the date that is
daysdays afterstart.Returns the date that is
daysdays afterstart. Usage:DATE_ADD( date_or_time_part, value, date_or_time_expr )
Example::
SELECT TO_DATE('2013-05-08') AS v1, DATE_ADD(year, 2, TO_DATE('2013-05-08')) AS v; +------------+------------+ | V1 | V | |------------+------------| | 2013-05-08 | 2015-05-08 | +------------+------------+- start
A date, timestamp or string. If a string, the data must be in a format that can be cast to a date, such as
yyyy-MM-ddoryyyy-MM-dd HH:mm:ss.SSSS- days
The number of days to add to
start, can be negative to subtract days- returns
A date, or null if
startwas a string that could not be cast to a date
- Since
1.15.0
- def date_add(days: Int, start: Column): Column
Returns the date that is
daysdays afterstart.Returns the date that is
daysdays afterstart. Usage -DATE_ADD( date_or_time_part, value, date_or_time_expr )
Example::
SELECT TO_DATE('2013-05-08') AS v1, DATE_ADD(year, 2, TO_DATE('2013-05-08')) AS v; +------------+------------+ | V1 | V | |------------+------------| | 2013-05-08 | 2015-05-08 | +------------+------------+- days
Int .
- start
Column name
- returns
Column.
- Since
1.15.0
- def date_format(c: Column, s: String): Column
Converts an input expression into the corresponding date in the specified date format.
Converts an input expression into the corresponding date in the specified date format. Example:
val df = Seq("2023-10-10", "2022-05-15", null.asInstanceOf[String]).toDF("date") df.select(date_format(col("date"), "YYYY/MM/DD").as("formatted_date")).show() -------------------- |"FORMATTED_DATE" | -------------------- |2023/10/10 | |2022/05/15 | |NULL | --------------------
- c
Column to format to date.
- s
Date format.
- returns
Column object.
- Since
1.14.0
- def date_from_parts(year: Column, month: Column, day: Column): Column
Creates a date from individual numeric components that represent the year, month, and day of the month.
Creates a date from individual numeric components that represent the year, month, and day of the month.
- Since
0.1.0
- def date_trunc(format: String, timestamp: Column): Column
Truncates a DATE, TIME, or TIMESTAMP to the specified precision.
Truncates a DATE, TIME, or TIMESTAMP to the specified precision.
- Since
0.1.0
- def dateadd(part: String, value: Column, expr: Column): Column
Adds the specified value for the specified date or time art to date or time expr.
Adds the specified value for the specified date or time art to date or time expr.
Supported date and time parts are listed here
Example: add one year on dates
date.select(dateadd("year", lit(1), col("date_col")))
- Since
0.1.0
- def datediff(part: String, col1: Column, col2: Column): Column
Calculates the difference between two date, time, or timestamp columns based on the date or time part requested.
Calculates the difference between two date, time, or timestamp columns based on the date or time part requested.
Supported date and time parts are listed here
Example: year difference between two date columns
date.select(datediff("year", col("date_col1"), col("date_col2"))),
- Since
0.1.0
- def dayname(expr: Column): Column
Extracts the three-letter day-of-week name from the specified date or timestamp.
Extracts the three-letter day-of-week name from the specified date or timestamp.
- Since
0.1.0
- def dayofmonth(e: Column): Column
Extracts the day of month from a date or timestamp.
Extracts the day of month from a date or timestamp.
- Since
0.1.0
- def dayofweek(e: Column): Column
Extracts the day of week from a date or timestamp.
Extracts the day of week from a date or timestamp.
- Since
0.1.0
- def dayofyear(e: Column): Column
Extracts the day of year from a date or timestamp.
Extracts the day of year from a date or timestamp.
- Since
0.1.0
- def degrees(e: Column): Column
Converts radians to degrees.
Converts radians to degrees.
- Since
0.1.0
- def dense_rank(): Column
Returns the rank of a value within a group of values, without gaps in the ranks.
Returns the rank of a value within a group of values, without gaps in the ranks. The rank value starts at 1 and continues up sequentially. If two values are the same, they will have the same rank.
- Since
0.1.0
- def desc(colName: String): Column
- def div0(dividend: Column, divisor: Column): Column
Performs division like the division operator (/), but returns 0 when the divisor is 0 (rather than reporting an error).
Performs division like the division operator (/), but returns 0 when the divisor is 0 (rather than reporting an error).
- Since
0.1.0
- def endswith(expr: Column, str: Column): Column
Returns TRUE if expr ends with str.
Returns TRUE if expr ends with str.
- Since
0.1.0
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equal_nan(e: Column): Column
Return true if the value in the column is not a number (NaN).
Return true if the value in the column is not a number (NaN).
- Since
0.1.0
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exp(e: Column): Column
Computes Euler's number e raised to a floating-point value.
Computes Euler's number e raised to a floating-point value.
- Since
0.1.0
- def expr(s: String): Column
Creates a Column expression from raw SQL text.
Creates a Column expression from raw SQL text.
Note that the function does not interpret or check the SQL text.
Example:
val df = session.createDataFrame(Seq(Array(1, 2, 3))).toDF("id") df.filter(expr("id > 2")).show() -------- |"ID" | -------- |3 | --------
- s
SQL Expression as text.
- returns
Converted SQL Expression.
- Since
1.14.0
- def factorial(e: Column): Column
Computes the factorial of its input.
Computes the factorial of its input. The input argument must be an integer expression in the range of 0 to 33.
- Since
0.1.0
- def floor(e: Column): Column
Returns values from the specified column rounded to the nearest equal or smaller integer.
Returns values from the specified column rounded to the nearest equal or smaller integer.
- Since
0.1.0
- def format_number(x: Column, d: Int): Column
Formats numeric column x to a format like '#,###,###.##', rounded to d decimal places with HALF_EVEN round mode, and returns the result as a string column.
Formats numeric column x to a format like '#,###,###.##', rounded to d decimal places with HALF_EVEN round mode, and returns the result as a string column.
- x
numeric column to be transformed
- d
Amount of decimal for the number format
- returns
Number casted to the specific string format
- Since
1.15.0 If d is 0, the result has no decimal point or fractional part. If d is less than 0, the result will be null.
- def from_unixtime(ut: Column, f: String): Column
Converts the number of seconds from unix epoch (1970-01-01 00:00:00 UTC) to a string representing the timestamp of that moment in the current system time zone in the given format.
Converts the number of seconds from unix epoch (1970-01-01 00:00:00 UTC) to a string representing the timestamp of that moment in the current system time zone in the given format.
- ut
A number of a type that is castable to a long, such as string or integer. Can be negative for timestamps before the unix epoch
- f
A date time pattern that the input will be formatted to
- returns
A string, or null if
utwas a string that could not be cast to a long orfwas an invalid date time pattern
- Since
1.15.0
- def from_unixtime(ut: Column): Column
Converts the number of seconds from unix epoch (1970-01-01 00:00:00 UTC) to a string representing the timestamp of that moment in the current system time zone in the yyyy-MM-dd HH:mm:ss format.
Converts the number of seconds from unix epoch (1970-01-01 00:00:00 UTC) to a string representing the timestamp of that moment in the current system time zone in the yyyy-MM-dd HH:mm:ss format.
- ut
A number of a type that is castable to a long, such as string or integer. Can be negative for timestamps before the unix epoch
- returns
A string, or null if the input was a string that could not be cast to a long
- Since
1.15.0
- def from_utc_timestamp(ts: Column): Column
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in UTC, and renders that time as a timestamp in the given time zone.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in UTC, and renders that time as a timestamp in the given time zone. For example, 'GMT+1' would yield '2017-07-14 03:40:00.0'.
ALTER SESSION SET TIMEZONE = 'America/Los_Angeles'; SELECT TO_TIMESTAMP_TZ('2024-04-05 01:02:03'); +----------------------------------------+ | TO_TIMESTAMP_TZ('2024-04-05 01:02:03') | |----------------------------------------| | 2024-04-05 01:02:03.000 -0700 | +----------------------------------------+- ts
A date, timestamp or string. If a string, the data must be in a format that can be cast to a timestamp, such as
yyyy-MM-ddoryyyy-MM-dd HH:mm:ss.SSSSA string detailing the time zone ID that the input should be adjusted to. It should be in the format of either region-based zone IDs or zone offsets. Region IDs must have the form 'area/city', such as 'America/Los_Angeles'. Zone offsets must be in the format '(+|-)HH:mm', for example '-08:00' or '+01:00'. Also 'UTC' and 'Z' are supported as aliases of '+00:00'. Other short names are not recommended to use because they can be ambiguous.- returns
A timestamp, or null if
tswas a string that could not be cast to a timestamp ortzwas an invalid value
- Since
1.15.0
- def get(col1: Column, col2: Column): Column
Extracts a value from an object or array; returns NULL if either of the arguments is NULL.
Extracts a value from an object or array; returns NULL if either of the arguments is NULL.
- Since
0.2.0
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def get_ignore_case(obj: Column, field: Column): Column
Extracts a field value from an object; returns NULL if either of the arguments is NULL.
Extracts a field value from an object; returns NULL if either of the arguments is NULL. This function is similar to GET but applies case-insensitive matching to field names.
- Since
0.2.0
- def get_path(col: Column, path: Column): Column
Extracts a value from semi-structured data using a path name.
Extracts a value from semi-structured data using a path name.
- Since
0.2.0
- def greatest(exprs: Column*): Column
Returns the largest value from a list of expressions.
Returns the largest value from a list of expressions. If any of the argument values is NULL, the result is NULL. GREATEST supports all data types, including VARIANT.
- Since
0.1.0
- def grouping(e: Column): Column
Describes which of a list of expressions are grouped in a row produced by a GROUP BY query.
Describes which of a list of expressions are grouped in a row produced by a GROUP BY query.
- Since
0.1.0
- def grouping_id(cols: Column*): Column
Describes which of a list of expressions are grouped in a row produced by a GROUP BY query.
Describes which of a list of expressions are grouped in a row produced by a GROUP BY query.
- Since
0.1.0
- def hash(cols: Column*): Column
Returns a signed 64-bit hash value.
Returns a signed 64-bit hash value. Note that HASH never returns NULL, even for NULL inputs.
- Since
0.1.0
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hex(c: Column): Column
Computes hex value of the given column.
Computes hex value of the given column. Example
val df = session.createDataFrame(Seq((1), (2), (3))).toDF("a") df.withColumn("hex_col", hex(col("A"))).select("hex_col").show() ------------- |"HEX_COL" | ------------- |31 | |32 | |33 | -------------
- c
Column to encode.
- returns
Encoded string.
- Since
1.14.0
- def hour(e: Column): Column
Extracts the hour from a date or timestamp.
Extracts the hour from a date or timestamp.
- Since
0.1.0
- def iff(condition: Column, expr1: Column, expr2: Column): Column
Returns one of two specified expressions, depending on a condition.
Returns one of two specified expressions, depending on a condition.
This is equivalent to an
if-then-elseexpression. Ifconditionevaluates to TRUE, the function returnsexpr1. Otherwise, the function returnsexpr2.- condition
The condition to evaluate.
- expr1
The expression to return if the condition evaluates to TRUE.
- expr2
The expression to return if the condition is not TRUE (i.e. if it is FALSE or NULL).
- Since
0.9.0
- def in(columns: Seq[Column], df: DataFrame): Column
Returns a conditional expression that you can pass to the filter or where method to perform the equivalent of a WHERE ...
Returns a conditional expression that you can pass to the filter or where method to perform the equivalent of a WHERE ... IN query with the subquery represented by the specified DataFrame.
The expression evaluates to true if the value in the column is one of the values in the column of the same name in a specified DataFrame.
For example, the following code returns a DataFrame that contains the rows where the values of the columns
c1andc2indf2match the values of the columnsaandbindf1. This is equivalent to SELECT * FROM table2 WHERE (c1, c2) IN (SELECT a, b FROM table1).val df1 = session.sql("select a, b from table1"). val df2 = session.table(table2) val dfFilter = df2.filter(functions.in(Seq(col("c1"), col("c2")), df1))
- columns
A sequence of the columns to compare for the IN operation.
- df
The DataFrame used as the values for the IN operation
- Since
0.10.0
- def in(columns: Seq[Column], values: Seq[Seq[Any]]): Column
Returns a conditional expression that you can pass to the filter or where method to perform the equivalent of a WHERE ...
Returns a conditional expression that you can pass to the filter or where method to perform the equivalent of a WHERE ... IN query that matches rows containing a sequence of values.
The expression evaluates to true if the values in a row matches the values in one of the specified sequences.
For example, the following code returns a DataFrame that contains the rows in which the columns
c1andc2contain the values:1and"a", or2and"b"This is equivalent toSELECT * FROM table WHERE (c1, c2) IN ((1, 'a'), (2, 'b')).
val df2 = df.filter(functions.in(Seq(df("c1"), df("c2")), Seq(Seq(1, "a"), Seq(2, "b"))))
- columns
A sequence of the columns to compare for the IN operation.
- values
A sequence containing the sequences of values to compare for the IN operation.
- Since
0.10.0
- def initcap(e: Column): Column
Returns the input string with the first letter of each word in uppercase and the subsequent letters in lowercase.
Returns the input string with the first letter of each word in uppercase and the subsequent letters in lowercase.
- Since
0.1.0
- def insert(baseExpr: Column, position: Column, length: Column, insertExpr: Column): Column
Replaces a substring of the specified length, starting at the specified position, with a new string or binary value.
Replaces a substring of the specified length, starting at the specified position, with a new string or binary value.
- Since
0.1.0
- def instr(str: Column, substring: String): Column
Locate the position of the first occurrence of substr column in the given string.
Locate the position of the first occurrence of substr column in the given string. Returns null if either of the arguments are null. For example
SELECT id, string1, REGEXP_SUBSTR(string1, 'nevermore\\d') AS substring, REGEXP_INSTR( string1, 'nevermore\\d') AS position FROM demo1 ORDER BY id; +----+-------------------------------------+------------+----------+ | ID | STRING1 | SUBSTRING | POSITION | |----+-------------------------------------+------------+----------| | 1 | nevermore1, nevermore2, nevermore3. | nevermore1 | 1 | +----+-------------------------------------+------------+----------+- Since
1.15.0
- Note
The position is not zero based, but 1 based index. Returns 0 if substr could not be found in str.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def is_array(col: Column): Column
Returns true if the specified VARIANT column contains an ARRAY value.
Returns true if the specified VARIANT column contains an ARRAY value.
- Since
0.1.0
- def is_binary(col: Column): Column
Returns true if the specified VARIANT column contains a binary value.
Returns true if the specified VARIANT column contains a binary value.
- Since
0.1.0
- def is_boolean(col: Column): Column
Returns true if the specified VARIANT column contains a Boolean value.
Returns true if the specified VARIANT column contains a Boolean value.
- Since
0.1.0
- def is_char(col: Column): Column
Returns true if the specified VARIANT column contains a string value.
Returns true if the specified VARIANT column contains a string value.
- Since
0.1.0
- def is_date(col: Column): Column
Returns true if the specified VARIANT column contains a DATE value.
Returns true if the specified VARIANT column contains a DATE value.
- Since
0.1.0
- def is_date_value(col: Column): Column
Returns true if the specified VARIANT column contains a DATE value.
Returns true if the specified VARIANT column contains a DATE value.
- Since
0.1.0
- def is_decimal(col: Column): Column
Returns true if the specified VARIANT column contains a fixed-point decimal value or integer.
Returns true if the specified VARIANT column contains a fixed-point decimal value or integer.
- Since
0.1.0
- def is_double(col: Column): Column
Returns true if the specified VARIANT column contains a floating-point value, fixed-point decimal, or integer.
Returns true if the specified VARIANT column contains a floating-point value, fixed-point decimal, or integer.
- Since
0.1.0
- def is_integer(col: Column): Column
Returns true if the specified VARIANT column contains an integer value.
Returns true if the specified VARIANT column contains an integer value.
- Since
0.1.0
- def is_null(e: Column): Column
Return true if the value in the column is null.
Return true if the value in the column is null.
- Since
0.1.0
- def is_null_value(col: Column): Column
Returns true if the specified VARIANT column is a JSON null value.
Returns true if the specified VARIANT column is a JSON null value.
- Since
0.1.0
- def is_object(col: Column): Column
Returns true if the specified VARIANT column contains an OBJECT value.
Returns true if the specified VARIANT column contains an OBJECT value.
- Since
0.1.0
- def is_real(col: Column): Column
Returns true if the specified VARIANT column contains a floating-point value, fixed-point decimal, or integer.
Returns true if the specified VARIANT column contains a floating-point value, fixed-point decimal, or integer.
- Since
0.1.0
- def is_time(col: Column): Column
Returns true if the specified VARIANT column contains a TIME value.
Returns true if the specified VARIANT column contains a TIME value.
- Since
0.1.0
- def is_timestamp_ltz(col: Column): Column
Returns true if the specified VARIANT column contains a TIMESTAMP value to be interpreted using the local time zone.
Returns true if the specified VARIANT column contains a TIMESTAMP value to be interpreted using the local time zone.
- Since
0.1.0
- def is_timestamp_ntz(col: Column): Column
Returns true if the specified VARIANT column contains a TIMESTAMP value with no time zone.
Returns true if the specified VARIANT column contains a TIMESTAMP value with no time zone.
- Since
0.1.0
- def is_timestamp_tz(col: Column): Column
Returns true if the specified VARIANT column contains a TIMESTAMP value with a time zone.
Returns true if the specified VARIANT column contains a TIMESTAMP value with a time zone.
- Since
0.1.0
- def is_varchar(col: Column): Column
Returns true if the specified VARIANT column contains a string value.
Returns true if the specified VARIANT column contains a string value.
- Since
0.1.0
- def isnull(c: Column): Column
Wrapper for Snowflake built-in isnull function.
Wrapper for Snowflake built-in isnull function. Gets a boolean depending if value is NULL or not. Return true if the value in the column is null. Example:: >>> from snowflake.snowpark.functions import is_null >>> df = session.create_dataframe([1.2, float("nan"), None, 1.0], schema=["a"]) >>> df.select(is_null("a").as_("a")).collect() [Row(A=False), Row(A=False), Row(A=True), Row(A=False)]
- c
Column to qnalize if it is null value.
- returns
Column object.
- Since
1.14.0
- def json_extract_path_text(col: Column, path: Column): Column
Parses a JSON string and returns the value of an element at a specified path in the resulting JSON document.
Parses a JSON string and returns the value of an element at a specified path in the resulting JSON document.
- col
Column containing the JSON string that should be parsed.
- path
Column containing the path to the element that should be extracted.
- Since
0.2.0
- def kurtosis(e: Column): Column
Returns the population excess kurtosis of non-NULL records.
Returns the population excess kurtosis of non-NULL records. If all records inside a group are NULL, the function returns NULL.
- Since
0.1.0
- def lag(e: Column): Column
Accesses data in a previous row in the same result set without having to join the table to itself.
Accesses data in a previous row in the same result set without having to join the table to itself.
- Since
0.1.0
- def lag(e: Column, offset: Int): Column
Accesses data in a previous row in the same result set without having to join the table to itself.
Accesses data in a previous row in the same result set without having to join the table to itself.
- Since
0.1.0
- def lag(e: Column, offset: Int, defaultValue: Column): Column
Accesses data in a previous row in the same result set without having to join the table to itself.
Accesses data in a previous row in the same result set without having to join the table to itself.
- Since
0.1.0
- def last(c: Column): Column
Returns the last value of the column in a group.
Returns the last value of the column in a group. Example
val df = session.createDataFrame(Seq((5, "a", 10), (5, "b", 20), (3, "d", 15), (3, "e", 40))).toDF("grade", "name", "score") val window = Window.partitionBy(col("grade")).orderBy(col("score").desc) df.select(last(col("name")).over(window)).show() --------------------- |"LAST_SCORE_NAME" | --------------------- |a | |a | |d | |d | ---------------------
- c
Column to obtain last value.
- returns
Column object.
- Since
1.14.0
- def last_day(e: Column): Column
Returns the last day of the specified date part for a date or timestamp.
Returns the last day of the specified date part for a date or timestamp. Commonly used to return the last day of the month for a date or timestamp.
- Since
0.1.0
- def lead(e: Column): Column
Accesses data in a subsequent row in the same result set without having to join the table to itself.
Accesses data in a subsequent row in the same result set without having to join the table to itself.
- Since
0.1.0
- def lead(e: Column, offset: Int): Column
Accesses data in a subsequent row in the same result set without having to join the table to itself.
Accesses data in a subsequent row in the same result set without having to join the table to itself.
- Since
0.1.0
- def lead(e: Column, offset: Int, defaultValue: Column): Column
Accesses data in a subsequent row in the same result set without having to join the table to itself.
Accesses data in a subsequent row in the same result set without having to join the table to itself.
- Since
0.1.0
- def least(exprs: Column*): Column
Returns the smallest value from a list of expressions.
Returns the smallest value from a list of expressions. LEAST supports all data types, including VARIANT.
- Since
0.1.0
- def left(strExpr: Column, lengthExpr: Column): Column
Returns a left most substring of strExpr.
Returns a left most substring of strExpr.
- Since
0.1.0
- def length(e: Column): Column
Returns the length of an input string or binary value.
Returns the length of an input string or binary value. For strings, the length is the number of characters, and UTF-8 characters are counted as a single character. For binary, the length is the number of bytes.
- Since
0.1.0
- def listagg(col: Column): Column
Returns the concatenated input values, separated by empty string.
Returns the concatenated input values, separated by empty string.
For example:
df.groupBy(df.col("col1")).agg(listagg(df.col("col2"), ",") .withinGroup(df.col("col2").asc)) df.select(listagg(df.col("col2"), ",", false))
- col
The expression (typically a Column) that determines the values to be put into the list. The expression should evaluate to a string, or to a data type that can be cast to string.
- Since
0.12.0
- def listagg(col: Column, delimiter: String): Column
Returns the concatenated input values, separated by
delimiterstring.Returns the concatenated input values, separated by
delimiterstring.For example:
df.groupBy(df.col("col1")).agg(listagg(df.col("col2"), ",") .withinGroup(df.col("col2").asc)) df.select(listagg(df.col("col2"), ",", false))
- col
The expression (typically a Column) that determines the values to be put into the list. The expression should evaluate to a string, or to a data type that can be cast to string.
- delimiter
A string delimiter.
- Since
0.12.0
- def listagg(col: Column, delimiter: String, isDistinct: Boolean): Column
Returns the concatenated input values, separated by
delimiterstring.Returns the concatenated input values, separated by
delimiterstring.For example:
df.groupBy(df.col("col1")).agg(listagg(df.col("col2"), ",") .withinGroup(df.col("col2").asc)) df.select(listagg(df.col("col2"), ",", false))
- col
The expression (typically a Column) that determines the values to be put into the list. The expression should evaluate to a string, or to a data type that can be cast to string.
- delimiter
A string delimiter.
- isDistinct
Whether the input expression is distinct.
- Since
0.12.0
- def lit(literal: Any): Column
Creates a Column expression for a literal value.
Creates a Column expression for a literal value.
- Since
0.1.0
- def locate(substr: String, str: Column, pos: Int = 1): Column
Locate the position of the first occurrence of substr in a string column, after position pos.
Locate the position of the first occurrence of substr in a string column, after position pos.
- substr
string to search
- str
value where string will be searched
- pos
index for starting the search. default to 1.
- returns
Returns the position of the first occurrence
- Since
1.14.0
- Note
The position is not zero based, but 1 based index. returns 0 if substr could not be found in str. This function is just leverages the SF POSITION builtin Example
val df = session.createDataFrame(Seq("java scala python")).toDF("a") df.select(locate("scala", col("a")).as("locate")).show() ------------ |"LOCATE" | ------------ |6 | ------------
- def locate(substr: Column, str: Column, pos: Int): Column
Locate the position of the first occurrence of substr in a string column, after position pos.
Locate the position of the first occurrence of substr in a string column, after position pos.
- substr
string to search
- str
value where string will be searched
- pos
index for starting the search
- returns
returns the position of the first occurrence.
- Since
1.14.0
- Note
The position is not zero based, but 1 based index. returns 0 if substr could not be found in str. This function is just leverages the SF POSITION builtin Example
val df = session.createDataFrame(Seq(("b", "abcd"))).toDF("a", "b") df.select(locate(col("a"), col("b"), 1).as("locate")).show() ------------ |"LOCATE" | ------------ |2 | ------------
- def log(base: Column, a: Column): Column
Returns the logarithm of a numeric expression.
Returns the logarithm of a numeric expression.
- Since
0.1.0
- def log10(columnName: String): Column
Computes the logarithm of the given column in base 10.
Computes the logarithm of the given column in base 10. Example
val df = session.createDataFrame(Seq(100)).toDF("a") df.select(log10("a"))).show() ----------- |"LOG10" | ----------- |2.0 | -----------
- columnName
ColumnName in String to apply logarithm operation
- returns
log10 of the given column
- Since
1.14.0
- def log10(c: Column): Column
Computes the logarithm of the given value in base 10.
Computes the logarithm of the given value in base 10. Example
val df = session.createDataFrame(Seq(100)).toDF("a") df.select(log10(col("a"))).show() ----------- |"LOG10" | ----------- |2.0 | -----------
- c
Column to apply logarithm operation
- returns
log10 of the given column
- Since
1.14.0
- def log1p(columnName: String): Column
Computes the natural logarithm of the given value plus one.
Computes the natural logarithm of the given value plus one. Example
val df = session.createDataFrame(Seq(0.1)).toDF("a") df.select(log1p("a").as("log1p")).show() ----------------------- |"LOG1P" | ----------------------- |0.09531017980432493 | -----------------------
- columnName
ColumnName in String to apply logarithm operation
- returns
the natural logarithm of the given value plus one.
- Since
1.14.0
- def log1p(c: Column): Column
Computes the natural logarithm of the given value plus one.
Computes the natural logarithm of the given value plus one. Example
val df = session.createDataFrame(Seq(0.1)).toDF("a") df.select(log1p(col("a")).as("log1p")).show() ----------------------- |"LOG1P" | ----------------------- |0.09531017980432493 | -----------------------
- c
Column to apply logarithm operation
- returns
the natural logarithm of the given value plus one.
- Since
1.14.0
- def lower(e: Column): Column
Returns the input string with all characters converted to lowercase.
Returns the input string with all characters converted to lowercase.
- Since
0.1.0
- def lpad(str: Column, len: Int, pad: Array[Byte]): Column
Left-pads a binary value with bytes from another binary value.
Left-pads a binary value with bytes from another binary value.
Examples:
val df = Seq(Array[Byte](0x41, 0x42)).toDF("a") df.select(lpad(col("a"), 5, Array[Byte](0x00))).show() ------------------------------------ |"LPAD(""A"", 5, '00' :: BINARY)" | ------------------------------------ |'0000004142' | ------------------------------------
- str
The binary column to pad.
- len
The target length of the resulting binary value (in bytes).
- pad
The byte array to use for padding.
- returns
A new column containing the left-padded binary value.
- Since
1.17.0
- def lpad(str: Column, len: Int, pad: String): Column
Left-pads a string with characters from another string.
Left-pads a string with characters from another string.
Examples:
val df = Seq("hello", "world").toDF("a") df.select(lpad(col("a"), 10, "*")).show() -------------------------- |"LPAD(""A"", 10, '*')" | -------------------------- |*****hello | |*****world | --------------------------
- str
The string column to pad.
- len
The target length of the resulting string value (in characters).
- pad
The string literal to use for padding.
- returns
A new column containing the left-padded string.
- Since
1.17.0
- def lpad(str: Column, len: Column, pad: Column): Column
Left-pads a string with characters from another string, or left-pads a binary value with bytes from another binary value.
Left-pads a string with characters from another string, or left-pads a binary value with bytes from another binary value.
- Since
0.1.0
- def ltrim(e: Column): Column
Removes leading characters, including whitespace, from a string.
Removes leading characters, including whitespace, from a string.
- Since
0.1.0
- def ltrim(e: Column, trimString: Column): Column
Removes leading characters, including whitespace, from a string.
Removes leading characters, including whitespace, from a string.
- Since
0.1.0
- def max(e: Column): Column
Returns the maximum value for the records in a group.
Returns the maximum value for the records in a group. NULL values are ignored unless all the records are NULL, in which case a NULL value is returned.
- Since
0.1.0
- def max(colName: String): Column
Returns the maximum value for the records in a group.
Returns the maximum value for the records in a group. NULL values are ignored unless all the records are NULL, in which case a NULL value is returned.
Example:
val df = session.createDataFrame(Seq(1, 3, 10, 1, 3)).toDF("x") df.select(max("x")).show() ---------------- |"MAX(""X"")" | ---------------- |10 | ----------------
- colName
The name of the column
- returns
The maximum value of the given column
- Since
1.13.0
- def md5(e: Column): Column
Returns a 32-character hex-encoded string containing the 128-bit MD5 message digest.
Returns a 32-character hex-encoded string containing the 128-bit MD5 message digest.
- Since
0.1.0
- def mean(e: Column): Column
Returns the average of non-NULL records.
Returns the average of non-NULL records. If all records inside a group are NULL, the function returns NULL. Alias of avg
- Since
0.1.0
- def mean(colName: String): Column
Returns the average of non-NULL records.
Returns the average of non-NULL records. If all records inside a group are NULL, the function returns NULL. Alias of avg.
Example:
val df = session.createDataFrame(Seq(1, 3, 10, 1, 3)).toDF("x") df.select(mean("x")).show() ---------------- |"AVG(""X"")" | ---------------- |3.600000 | ----------------
- colName
The name of the column
- returns
The average value of the given column
- Since
1.13.0
- def median(e: Column): Column
Returns the median value for the records in a group.
Returns the median value for the records in a group. NULL values are ignored unless all the records are NULL, in which case a NULL value is returned.
- Since
0.5.0
- def min(e: Column): Column
Returns the minimum value for the records in a group.
Returns the minimum value for the records in a group. NULL values are ignored unless all the records are NULL, in which case a NULL value is returned.
- Since
0.1.0
- def min(colName: String): Column
Returns the minimum value for the records in a group.
Returns the minimum value for the records in a group. NULL values are ignored unless all the records are NULL, in which case a NULL value is returned.
Example:
val df = session.createDataFrame(Seq(1, 3, 10, 1, 3)).toDF("x") df.select(min("x")).show() ---------------- |"MIN(""X"")" | ---------------- |1 | ----------------
- colName
The name of the column
- returns
The minimum value of the given column
- Since
1.13.0
- def minute(e: Column): Column
Extracts the minute from a date or timestamp.
Extracts the minute from a date or timestamp.
- Since
0.1.0
- def monotonically_increasing_id(): Column
A column expression that generates monotonically increasing 64-bit integers.
A column expression that generates monotonically increasing 64-bit integers. Returns a sequence of monotonically increasing integers, with wrap-around which happens after largest representable integer of integer width 8 byte.
Args: sign: When 0, the sequence continues at 0 after wrap-around. When 1, the sequence continues at smallest representable 8 byte integer. Defaults to 0.
See Also:
- :meth:
Session.generator, which can be used to generate in tandem withseq8to generate sequences.
Example:: >>> df = session.generator(seq8(0), rowcount=3) >>> df.collect() [Row(SEQ8(0)=0), Row(SEQ8(0)=1), Row(SEQ8(0)=2)]
- Since
1.15.0
- :meth:
- def month(e: Column): Column
Extracts the month from a date or timestamp.
Extracts the month from a date or timestamp.
- Since
0.1.0
- def monthname(expr: Column): Column
Extracts the three-letter month name from the specified date or timestamp.
Extracts the three-letter month name from the specified date or timestamp.
- Since
0.1.0
- def months_between(end: String, start: String): Column
Returns number of months between dates
startandend.Returns number of months between dates
startandend.A whole number is returned if both inputs have the same day of month or both are the last day of their respective months. Otherwise, the difference is calculated assuming 31 days per month.
For example:
months_between("2017-11-14", "2017-07-14") // returns 4.0 months_between("2017-01-01", "2017-01-10") // returns 0.29032258 months_between("2017-06-01", "2017-06-16 12:00:00") // returns -0.5
- end
Column name. If a string, the data must be in a format that can be cast to a timestamp, such as yyyy-MM-dd or yyyy-MM-dd HH:mm:ss.SSSS
- start
Column name . If a string, the data must be in a format that can cast to a timestamp, such as yyyy-MM-dd or yyyy-MM-dd HH:mm:ss.SSSS
- returns
A double, or null if either end or start were strings that could not be cast to a timestamp. Negative if end is before start
- Since
1.15.0
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def negate(e: Column): Column
Returns the negation of the value in the column (equivalent to a unary minus).
Returns the negation of the value in the column (equivalent to a unary minus).
- Since
0.1.0
- def next_day(date: Column, dayOfWeek: Column): Column
Returns the date of the first specified DOW (day of week) that occurs after the input date.
Returns the date of the first specified DOW (day of week) that occurs after the input date.
- Since
0.1.0
- def not(e: Column): Column
Returns the inverse of a boolean expression.
Returns the inverse of a boolean expression.
- Since
0.1.0
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def ntile(n: Int): Column
Window function: returns the ntile group id (from 1 to
ninclusive) in an ordered window partition.Window function: returns the ntile group id (from 1 to
ninclusive) in an ordered window partition. For example, ifnis 4, the first quarter of the rows will get value 1, the second quarter will get 2, the third quarter will get 3, and the last quarter will get 4.This is equivalent to the NTILE function in SQL. Example
val df = Seq((5, 15), (5, 15), (5, 15), (5, 20)).toDF("grade", "score") val window = Window.partitionBy(col("grade")).orderBy(col("score")) df.select(ntile(2).over(window).as("ntile")).show() ----------- |"NTILE" | ----------- |1 | |1 | |2 | |2 | -----------
- n
number of groups
- returns
returns the ntile group id (from 1 to n inclusive) in an ordered window partition.
- Since
1.14.0
- def ntile(n: Column): Column
Divides an ordered data set equally into the number of buckets specified by n.
Divides an ordered data set equally into the number of buckets specified by n. Buckets are sequentially numbered 1 through n.
- Since
0.1.0
- def object_construct(key_values: Column*): Column
Returns an OBJECT constructed from the arguments.
Returns an OBJECT constructed from the arguments.
- Since
0.2.0
- def object_delete(obj: Column, key1: Column, keys: Column*): Column
Returns an object containing the contents of the input (i.e.source) object with one or more keys removed.
Returns an object containing the contents of the input (i.e.source) object with one or more keys removed.
- Since
0.2.0
- def object_insert(obj: Column, key: Column, value: Column, update_flag: Column): Column
Returns an object consisting of the input object with a new key-value pair inserted (or an existing key updated with a new value).
Returns an object consisting of the input object with a new key-value pair inserted (or an existing key updated with a new value).
- Since
0.2.0
- def object_insert(obj: Column, key: Column, value: Column): Column
Returns an object consisting of the input object with a new key-value pair inserted.
Returns an object consisting of the input object with a new key-value pair inserted. The input key must not exist in the object.
- Since
0.2.0
- def object_keys(obj: Column): Column
Returns an array containing the list of keys in the input object.
Returns an array containing the list of keys in the input object.
- Since
0.2.0
- def object_pick(obj: Column, key1: Column, keys: Column*): Column
Returns a new OBJECT containing some of the key-value pairs from an existing object.
Returns a new OBJECT containing some of the key-value pairs from an existing object.
To identify the key-value pairs to include in the new object, pass in the keys as arguments, or pass in an array containing the keys.
If a specified key is not present in the input object, the key is ignored.
- Since
0.2.0
- def objectagg(key: Column, value: Column): Column
Returns one OBJECT per group.
Returns one OBJECT per group. For each (key, value) input pair, where key must be a VARCHAR and value must be a VARIANT, the resulting OBJECT contains a key:value field.
- Since
0.2.0
- def parse_json(col: Column): Column
Parse the value of the specified column as a JSON string and returns the resulting JSON document.
Parse the value of the specified column as a JSON string and returns the resulting JSON document.
- Since
0.2.0
- def parse_xml(col: Column): Column
Parse the value of the specified column as a JSON string and returns the resulting XML document.
Parse the value of the specified column as a JSON string and returns the resulting XML document.
- Since
0.2.0
- def percent_rank(): Column
Returns the relative rank of a value within a group of values, specified as a percentage ranging from 0.0 to 1.0.
Returns the relative rank of a value within a group of values, specified as a percentage ranging from 0.0 to 1.0.
- Since
0.1.0
- def pow(l: Double, r: String): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql("select * from (values (0.5), (2), (2.5), (4)) as T(exponent)") df.select(lit(2.0).as("base"), col("exponent"), pow(2.0, "exponent").as("result")).show() -------------------------------------------- |"BASE" |"EXPONENT" |"RESULT" | -------------------------------------------- |2.0 |0.5 |1.4142135623730951 | |2.0 |2.0 |4.0 | |2.0 |2.5 |5.656854249492381 | |2.0 |4.0 |16.0 | --------------------------------------------
- l
The value of the base.
- r
The name of the numeric column representing the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: Double, r: Column): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql("select * from (values (0.5), (2), (2.5), (4)) as T(exponent)") df.select(lit(2.0).as("base"), col("exponent"), pow(2.0, col("exponent")).as("result")) .show() -------------------------------------------- |"BASE" |"EXPONENT" |"RESULT" | -------------------------------------------- |2.0 |0.5 |1.4142135623730951 | |2.0 |2.0 |4.0 | |2.0 |2.5 |5.656854249492381 | |2.0 |4.0 |16.0 | --------------------------------------------
- l
The value of the base.
- r
The numeric column representing the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: String, r: Double): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql("select * from (values (0.5), (2), (2.5), (4)) as T(base)") df.select(col("base"), lit(2.0).as("exponent"), pow("base", 2.0).as("result")).show() ---------------------------------- |"BASE" |"EXPONENT" |"RESULT" | ---------------------------------- |0.5 |2.0 |0.25 | |2.0 |2.0 |4.0 | |2.5 |2.0 |6.25 | |4.0 |2.0 |16.0 | ----------------------------------
- l
The name of the numeric column representing the base.
- r
The value of the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: Column, r: Double): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql("select * from (values (0.5), (2), (2.5), (4)) as T(base)") df.select(col("base"), lit(2.0).as("exponent"), pow(col("base"), 2.0).as("result")).show() ---------------------------------- |"BASE" |"EXPONENT" |"RESULT" | ---------------------------------- |0.5 |2.0 |0.25 | |2.0 |2.0 |4.0 | |2.5 |2.0 |6.25 | |4.0 |2.0 |16.0 | ----------------------------------
- l
The numeric column representing the base.
- r
The value of the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: String, r: String): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql( "select * from (values (0.1, 2), (2, 3), (2, 0.5), (2, -1)) as T(base, exponent)") df.select(col("base"), col("exponent"), pow("base", "exponent").as("result")).show() ---------------------------------------------- |"BASE" |"EXPONENT" |"RESULT" | ---------------------------------------------- |0.1 |2.0 |0.010000000000000002 | |2.0 |3.0 |8.0 | |2.0 |0.5 |1.4142135623730951 | |2.0 |-1.0 |0.5 | ----------------------------------------------
- l
The name of the numeric column representing the base.
- r
The name of the numeric column representing the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: String, r: Column): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql( "select * from (values (0.1, 2), (2, 3), (2, 0.5), (2, -1)) as T(base, exponent)") df.select(col("base"), col("exponent"), pow("base", col("exponent")).as("result")).show() ---------------------------------------------- |"BASE" |"EXPONENT" |"RESULT" | ---------------------------------------------- |0.1 |2.0 |0.010000000000000002 | |2.0 |3.0 |8.0 | |2.0 |0.5 |1.4142135623730951 | |2.0 |-1.0 |0.5 | ----------------------------------------------
- l
The name of the numeric column representing the base.
- r
The numeric column representing the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: Column, r: String): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
Example:
val df = session.sql( "select * from (values (0.1, 2), (2, 3), (2, 0.5), (2, -1)) as T(base, exponent)") df.select(col("base"), col("exponent"), pow(col("base"), "exponent").as("result")).show() ---------------------------------------------- |"BASE" |"EXPONENT" |"RESULT" | ---------------------------------------------- |0.1 |2.0 |0.010000000000000002 | |2.0 |3.0 |8.0 | |2.0 |0.5 |1.4142135623730951 | |2.0 |-1.0 |0.5 | ----------------------------------------------
- l
The numeric column representing the base.
- r
The name of the numeric column representing the exponent.
- returns
A column containing the result of raising
lto the power ofr.
- Since
1.15.0
- def pow(l: Column, r: Column): Column
Returns a number (l) raised to the specified power (r).
Returns a number (l) raised to the specified power (r).
- Since
0.1.0
- def previous_day(date: Column, dayOfWeek: Column): Column
Returns the date of the first specified DOW (day of week) that occurs before the input date.
Returns the date of the first specified DOW (day of week) that occurs before the input date.
- Since
0.1.0
- def quarter(e: Column): Column
Extracts the quarter from a date or timestamp.
Extracts the quarter from a date or timestamp.
- Since
0.1.0
- def radians(e: Column): Column
Converts degrees to radians.
Converts degrees to radians.
- Since
0.1.0
- def randn(seed: Long): Column
Generate a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution.
Generate a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution. Calls to the Snowflake RANDOM function. NOTE: Snowflake returns integers of 17-19 digits. Example
val df = session.createDataFrame(Seq((1), (2), (3))).toDF("a") df.withColumn("randn_with_seed", randn(123L)).select("randn_with_seed").show() ------------------------ |"RANDN_WITH_SEED" | ------------------------ |5777523539921853504 | |-8190739547906189845 | |-1138438814981368515 | ------------------------
- seed
Seed to use in the random function.
- returns
Random number.
- Since
1.14.0
- def randn(): Column
Generate a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution.
Generate a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution. Return a call to the Snowflake RANDOM function. NOTE: Snowflake returns integers of 17-19 digits. Example
val df = session.createDataFrame(Seq((1), (2), (3))).toDF("a") df.withColumn("randn", randn()).select("randn").show() ------------------------ |"RANDN" | ------------------------ |-2093909082984812541 | |-1379817492278593383 | |-1231198046297539927 | ------------------------
- returns
Random number.
- Since
1.14.0
- def random(): Column
Each call returns a pseudo-random 64-bit integer.
Each call returns a pseudo-random 64-bit integer.
- Since
0.1.0
- def random(seed: Long): Column
Each call returns a pseudo-random 64-bit integer.
Each call returns a pseudo-random 64-bit integer.
- Since
0.1.0
- def rank(): Column
Returns the rank of a value within an ordered group of values.
Returns the rank of a value within an ordered group of values. The rank value starts at 1 and continues up.
- Since
0.1.0
- def regexp_count(strExpr: Column, pattern: Column): Column
Returns the number of times that a pattern occurs in a strExpr.
- def regexp_count(strExpr: Column, pattern: Column, position: Column, parameters: Column): Column
Returns the number of times that a pattern occurs in a strExpr.
- def regexp_extract(colName: Column, exp: String, position: Int, Occurences: Int, grpIdx: Int): Column
Signature -
Signature -
snowflake.snowpark.functions.regexp_extract (value: Union[Column, str], regexp: Union[Column, str], idx: int) Column
Extract a specific group matched by a regex, from the specified string column. If the regex did not match, or the specified group did not match, an empty string is returned. <pr> Example:
from snowflake.snowpark.functions import regexp_extract df = session.createDataFrame([["id_20_30", 10], ["id_40_50", 30]], ["id", "age"]) df.select(regexp_extract("id", r"(\d+)", 1).alias("RES")).show() </pr> <pr> --------- |"RES" | --------- |20 | |40 | ---------
</pr> Note: non-greedy tokens such as are not supported
- returns
Column object.
- Since
1.14.0
- def regexp_replace(strExpr: Column, pattern: Column, replacement: Column): Column
Returns the subject with the specified pattern (or all occurrences of the pattern) replaced by a replacement string.
Returns the subject with the specified pattern (or all occurrences of the pattern) replaced by a replacement string. If no matches are found, returns the original subject.
- Since
1.9.0
- def regexp_replace(strExpr: Column, pattern: Column): Column
Returns the subject with the specified pattern (or all occurrences of the pattern) removed.
Returns the subject with the specified pattern (or all occurrences of the pattern) removed. If no matches are found, returns the original subject.
- Since
1.9.0
- def repeat(str: Column, n: Column): Column
Builds a string by repeating the input for the specified number of times.
Builds a string by repeating the input for the specified number of times.
- Since
0.1.0
- def replace(strExpr: Column, pattern: Column): Column
Removes all occurrences of a specified strExpr, and optionally replaces them with replacement.
Removes all occurrences of a specified strExpr, and optionally replaces them with replacement.
- Since
0.1.0
- def replace(strExpr: Column, pattern: Column, replacement: Column): Column
Removes all occurrences of a specified strExpr, and optionally replaces them with replacement.
Removes all occurrences of a specified strExpr, and optionally replaces them with replacement.
- Since
0.1.0
- def reverse(c: Column): Column
Wrapper for Snowflake built-in reverse function.
Wrapper for Snowflake built-in reverse function. Gets the reversed string. Reverses the order of characters in a string, or of bytes in a binary value. The returned value is the same length as the input, but with the characters/bytes in reverse order. If subject is NULL, the result is also NULL. Example:
SELECT REVERSE('Hello, world!'); +--------------------------+ | REVERSE('HELLO, WORLD!') | |--------------------------| | !dlrow ,olleH | +--------------------------+- c
Column to be reverse.
- returns
Column object.
- Since
1.14.0
- def right(strExpr: Column, lengthExpr: Column): Column
Returns a right most substring of strExpr.
Returns a right most substring of strExpr.
- Since
0.1.0
- def round(e: Column, scale: Int): Column
Rounds the numeric values of the given column
eto thescaledecimal places using the half away from zero rounding mode.Rounds the numeric values of the given column
eto thescaledecimal places using the half away from zero rounding mode.Example:
val df = session.sql( "select * from (values (-3.78), (-2.55), (1.23), (2.55), (3.78)) as T(a)") df.select(round(col("a"), 1).alias("round")).show() ----------- |"ROUND" | ----------- |-3.8 | |-2.6 | |1.2 | |2.6 | |3.8 | -----------
- e
The column of numeric values to round.
- scale
The number of decimal places to which
eshould be rounded.- returns
A new column containing the rounded numeric values.
- Since
1.14.0
- def round(e: Column): Column
Rounds the numeric values of the given column
eto 0 decimal places using the half away from zero rounding mode.Rounds the numeric values of the given column
eto 0 decimal places using the half away from zero rounding mode.Example:
val df = session.sql("select * from (values (-3.7), (-2.5), (1.2), (2.5), (3.7)) as T(a)") df.select(round(col("a")).alias("round")).show() ----------- |"ROUND" | ----------- |-4 | |-3 | |1 | |3 | |4 | -----------
- e
The column of numeric values to round.
- returns
A new column containing the rounded numeric values.
- Since
0.1.0
- def round(e: Column, scale: Column): Column
Rounds the numeric values of the given column
eto thescaledecimal places using the half away from zero rounding mode.Rounds the numeric values of the given column
eto thescaledecimal places using the half away from zero rounding mode.Example:
val df = session.sql( "select * from (values (-3.78), (-2.55), (1.23), (2.55), (3.78)) as T(a)") df.select(round(col("a"), lit(1)).alias("round")).show() ----------- |"ROUND" | ----------- |-3.8 | |-2.6 | |1.2 | |2.6 | |3.8 | -----------
- e
The column of numeric values to round.
- scale
A column representing the number of decimal places to which
eshould be rounded.- returns
A new column containing the rounded numeric values.
- Since
0.1.0
- def row_number(): Column
Returns a unique row number for each row within a window partition.
Returns a unique row number for each row within a window partition. The row number starts at 1 and continues up sequentially.
- Since
0.1.0
- def rpad(str: Column, len: Int, pad: Array[Byte]): Column
Right-pads a binary value with bytes from another binary value.
Right-pads a binary value with bytes from another binary value.
Examples:
val df = Seq(Array[Byte](0x41, 0x42)).toDF("a") df.select(rpad(col("a"), 5, Array[Byte](0x00))).show() ------------------------------------ |"RPAD(""A"", 5, '00' :: BINARY)" | ------------------------------------ |'4142000000' | ------------------------------------
- str
The binary column to pad.
- len
The target length of the resulting binary value (in bytes).
- pad
The byte array to use for padding.
- returns
A new column containing the right-padded binary value.
- Since
1.17.0
- def rpad(str: Column, len: Int, pad: String): Column
Right-pads a string with characters from another string.
Right-pads a string with characters from another string.
Examples:
val df = Seq("hello", "world").toDF("a") df.select(rpad(col("a"), 10, "*")).show() -------------------------- |"RPAD(""A"", 10, '*')" | -------------------------- |hello***** | |world***** | --------------------------
- str
The string column to pad.
- len
The target length of the resulting string value (in characters).
- pad
The string literal to use for padding.
- returns
A new column containing the right-padded string.
- Since
1.17.0
- def rpad(str: Column, len: Column, pad: Column): Column
Right-pads a string with characters from another string, or right-pads a binary value with bytes from another binary value.
Right-pads a string with characters from another string, or right-pads a binary value with bytes from another binary value.
- Since
0.1.0
- def rtrim(e: Column): Column
Removes trailing characters, including whitespace, from a string.
Removes trailing characters, including whitespace, from a string.
- Since
0.1.0
- def rtrim(e: Column, trimString: Column): Column
Removes trailing characters, including whitespace, from a string.
Removes trailing characters, including whitespace, from a string.
- Since
0.1.0
- def second(e: Column): Column
Extracts the second from a date or timestamp.
Extracts the second from a date or timestamp.
- Since
0.1.0
- def seq1(startsFromZero: Boolean): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 1 byte.
- startsFromZero
if true, the sequence continues at 0 after wrap-around, otherwise, continues at the smallest representable number based on the given integer width.
- Since
0.11.0
- def seq1(): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 1 byte. the sequence continues at 0 after wrap-around.
- Since
0.11.0
- def seq2(startsFromZero: Boolean): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 2 byte.
- startsFromZero
if true, the sequence continues at 0 after wrap-around, otherwise, continues at the smallest representable number based on the given integer width.
- Since
0.11.0
- def seq2(): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 2 byte. the sequence continues at 0 after wrap-around.
- Since
0.11.0
- def seq4(startsFromZero: Boolean): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 4 byte.
- startsFromZero
if true, the sequence continues at 0 after wrap-around, otherwise, continues at the smallest representable number based on the given integer width.
- Since
0.11.0
- def seq4(): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 4 byte. the sequence continues at 0 after wrap-around.
- Since
0.11.0
- def seq8(startsFromZero: Boolean): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 8 byte.
- startsFromZero
if true, the sequence continues at 0 after wrap-around, otherwise, continues at the smallest representable number based on the given integer width.
- Since
0.11.0
- def seq8(): Column
Generates a sequence of monotonically increasing integers, with wrap-around.
Generates a sequence of monotonically increasing integers, with wrap-around. Wrap-around occurs after the largest representable integer of the integer width 8 byte. the sequence continues at 0 after wrap-around.
- Since
0.11.0
- def sha1(e: Column): Column
Returns a 40-character hex-encoded string containing the 160-bit SHA-1 message digest.
Returns a 40-character hex-encoded string containing the 160-bit SHA-1 message digest.
- Since
0.1.0
- def sha2(e: Column, numBits: Int): Column
Returns a hex-encoded string containing the N-bit SHA-2 message digest, where N is the specified output digest size.
Returns a hex-encoded string containing the N-bit SHA-2 message digest, where N is the specified output digest size.
- Since
0.1.0
- def shiftleft(c: Column, numBits: Int): Column
Shift the given value numBits left.
Shift the given value numBits left. If the given value is a long value, this function will return a long value else it will return an integer value. Example
val df = session.createDataFrame(Seq((1), (2), (3))).toDF("a") df.select(shiftleft(col("A"), 1).as("shiftleft")).show() --------------- |"SHIFTLEFT" | --------------- |2 | |4 | |6 | ---------------
- c
Column to modify.
- numBits
Number of bits to shift.
- returns
Column object.
- Since
1.14.0
- def shiftright(c: Column, numBits: Int): Column
Shift the given value numBits right.
Shift the given value numBits right. If the given value is a long value, it will return a long value else it will return an integer value. Example
val df = session.createDataFrame(Seq((1), (2), (3))).toDF("a") df.select(shiftright(col("A"), 1).as("shiftright")).show() ---------------- |"SHIFTRIGHT" | ---------------- |0 | |1 | |1 | ----------------
- c
Column to modify.
- numBits
Number of bits to shift.
- returns
Column object.
- Since
1.14.0
- def sign(colName: Column): Column
Returns the sign of its argument as mentioned :
Returns the sign of its argument as mentioned :
- -1 if the argument is negative.
- 1 if it is positive.
- 0 if it is 0.
Args: col: The column to evaluate its sign <pr> Example::
>>> df = session.create_dataframe([(-2, 2, 0)], ["a", "b", "c"]) >>> df.select(sign("a").alias("a_sign"), sign("b").alias("b_sign"), sign("c").alias("c_sign")).show() ---------------------------------- |"A_SIGN" |"B_SIGN" |"C_SIGN" | ---------------------------------- |-1 |1 |0 | ----------------------------------
</pr>
- returns
Column object.
- Since
1.14.0
- def signum(columnName: String): Column
Returns the sign of the given column.
Returns the sign of the given column. Returns either 1 for positive, 0 for 0 or NaN, -1 for negative and null for null. NOTE: if string values are provided snowflake will attempts to cast. If it casts correctly, returns the calculation, if not an error will be thrown
- columnName
Name of the column to calculate the sign.
- returns
Column object.
- Since
1.14.0
- def signum(colName: Column): Column
Returns the sign of its argument:
Returns the sign of its argument:
- -1 if the argument is negative.
- 1 if it is positive.
- 0 if it is 0.
Args: col: The column to evaluate its sign <pr> Example:: >>>
>>> df = session.create_dataframe([(-2, 2, 0)], ["a", "b", "c"]) >>> df.select(sign("a").alias("a_sign"), sign("b").alias("b_sign"), sign("c").alias("c_sign")).show() ---------------------------------- |"A_SIGN" |"B_SIGN" |"C_SIGN" | ---------------------------------- |-1 |1 |0 | ----------------------------------
</pr>
- returns
Column object.
- Since
1.14.0
- def sin(e: Column): Column
Computes the sine of its argument; the argument should be expressed in radians.
Computes the sine of its argument; the argument should be expressed in radians.
- Since
0.1.0
- def sinh(e: Column): Column
Computes the hyperbolic sine of its argument.
Computes the hyperbolic sine of its argument.
- Since
0.1.0
- def size(c: Column): Column
Returns the size of the input ARRAY.
Returns the size of the input ARRAY.
If the specified column contains a VARIANT value that contains an ARRAY, the size of the ARRAY is returned; otherwise, NULL is returned if the value is not an ARRAY.
Example:
val df = session.createDataFrame(Seq(Array(1, 2, 3))).toDF("id") df.select(size(col("id"))).show() ------------------------ |"ARRAY_SIZE(""ID"")" | ------------------------ |3 | ------------------------
- c
Column to get the size.
- returns
Size of array column.
- Since
1.14.0
- def skew(e: Column): Column
Returns the sample skewness of non-NULL records.
Returns the sample skewness of non-NULL records. If all records inside a group are NULL, the function returns NULL.
- Since
0.1.0
- def soundex(e: Column): Column
Returns a string that contains a phonetic representation of the input string.
Returns a string that contains a phonetic representation of the input string.
- Since
0.1.0
- def split(str: Column, pattern: Column): Column
Splits a given string with a given separator and returns the result in an array of strings.
Splits a given string with a given separator and returns the result in an array of strings. To specify a string separator, use the lit() function.
Example 1:
val df = session.createDataFrame( Seq(("many-many-words", "-"), ("hello--hello", "--"))).toDF("V", "D") df.select(split(col("V"), col("D"))).show() ------------------------- |"SPLIT(""V"", ""D"")" | ------------------------- |[ | | "many", | | "many", | | "words" | |] | |[ | | "hello", | | "hello" | |] | -------------------------
Example 2:
val df = session.createDataFrame(Seq("many-many-words", "hello-hi-hello")).toDF("V") df.select(split(col("V"), lit("-"))).show() ------------------------- |"SPLIT(""V"", ""D"")" | ------------------------- |[ | | "many", | | "many", | | "words" | |] | |[ | | "hello", | | "hello" | |] | -------------------------
- Since
0.1.0
- def sqlExpr(sqlText: String): Column
Creates a Column expression from raw SQL text.
Creates a Column expression from raw SQL text.
Note that the function does not interpret or check the SQL text.
- Since
0.1.0
- def sqrt(e: Column): Column
Returns the square-root of a non-negative numeric expression.
Returns the square-root of a non-negative numeric expression.
- Since
0.1.0
- def startswith(col: Column, str: Column): Column
Returns true if col starts with str.
Returns true if col starts with str.
- Since
0.1.0
- def stddev(e: Column): Column
Returns the sample standard deviation (square root of sample variance) of non-NULL values.
Returns the sample standard deviation (square root of sample variance) of non-NULL values. If all records inside a group are NULL, returns NULL.
- Since
0.1.0
- def stddev_pop(e: Column): Column
Returns the population standard deviation (square root of variance) of non-NULL values.
Returns the population standard deviation (square root of variance) of non-NULL values. If all records inside a group are NULL, returns NULL.
- Since
0.1.0
- def stddev_samp(e: Column): Column
Returns the sample standard deviation (square root of sample variance) of non-NULL values.
Returns the sample standard deviation (square root of sample variance) of non-NULL values. If all records inside a group are NULL, returns NULL. Alias of stddev
- Since
0.1.0
- def strip_null_value(col: Column): Column
Converts a JSON "null" value in the specified column to a SQL NULL value.
Converts a JSON "null" value in the specified column to a SQL NULL value. All other VARIANT values in the column are returned unchanged.
- Since
0.2.0
- def strtok_to_array(array: Column, delimiter: Column): Column
Tokenizes the given string using the given set of delimiters and returns the tokens as an array.
Tokenizes the given string using the given set of delimiters and returns the tokens as an array. If either parameter is a NULL, a NULL is returned. An empty array is returned if tokenization produces no tokens.
- Since
0.2.0
- def strtok_to_array(array: Column): Column
Tokenizes the given string using the given set of delimiters and returns the tokens as an array.
Tokenizes the given string using the given set of delimiters and returns the tokens as an array. If either parameter is a NULL, a NULL is returned. An empty array is returned if tokenization produces no tokens.
- Since
0.2.0
- def substring(str: Column, pos: Int, len: Int): Column
Returns the portion of the string or binary value from
str, starting from the character/byte specified bypos, with limited length.Returns the portion of the string or binary value from
str, starting from the character/byte specified bypos, with limited length.This function is a wrapper over the Snowflake SQL
SUBSTR/SUBSTRINGfunction. For detailed behavior documentation, see: substrExamples:
val df = Seq( "SKU-12345-ABC", "PRD-67890-XYZ", "ITM-11111-DEF", ).toDF("product_id") // Extract product code (characters 5-9) df.select(substring(col("product_id"), 5, 5)).show() ------------------------------------- |"SUBSTRING(""PRODUCT_ID"", 5, 5)" | ------------------------------------- |12345 | |67890 | |11111 | ------------------------------------- // Extract category suffix (last 3 characters) df.select(substring(col("product_id"), 11, 3)).show() -------------------------------------- |"SUBSTRING(""PRODUCT_ID"", 11, 3)" | -------------------------------------- |ABC | |XYZ | |DEF | --------------------------------------
- str
The input string or binary value to extract a substring from.
- pos
The starting position of the substring (1-based index).
- If
posis 0, it is treated as 1 (start from the first character/byte). - If
posis negative, it counts backward from the end of the string (e.g., -1 starts at the last character/byte, -2 starts at the second-to-last character/byte). - If
posis greater than the length ofstr, the result is an empty string.
- If
- len
The maximum number of characters/bytes to return.
- If
lenis 0 or negative, the result is an empty string. - If
lenexceeds the remaining length frompos, the result contains characters/bytes fromposto the end.
- If
- returns
A Column containing the extracted substring.
- Since
1.17.0
- def substring(str: Column, pos: Column, len: Column): Column
Returns the portion of the string or binary value from
str, starting from the character/byte specified bypos, with limited length.Returns the portion of the string or binary value from
str, starting from the character/byte specified bypos, with limited length.This function is a wrapper over the Snowflake SQL
SUBSTR/SUBSTRINGfunction. For detailed behavior documentation, see: substrExamples:
val df = Seq( "john.doe@company.com", "user123@domain.org", "admin@test.net", ).toDF("email") // Extract first 4 characters (1-based indexing) df.select(substring(col("email"), lit(1), lit(4))).show() -------------------------------- |"SUBSTRING(""EMAIL"", 1, 4)" | -------------------------------- |john | |user | |admi | -------------------------------- // Extract domain part (starting from position after @) df.select(substring(col("email"), expr("POSITION('@' IN email) + 1"), lit(20))).show() ---------------------------------------------------------- |"SUBSTRING(""EMAIL"", POSITION('@' IN EMAIL) + 1, 20)" | ---------------------------------------------------------- |company.com | |domain.org | |test.net | ----------------------------------------------------------
- str
The input string or binary value to extract a substring from.
- pos
The starting position of the substring (1-based index).
- If
posis 0, it is treated as 1 (start from the first character/byte). - If
posis negative, it counts backward from the end of the string (e.g., -1 starts at the last character/byte, -2 starts at the second-to-last character/byte). - If
posis greater than the length ofstr, the result is an empty string.
- If
- len
The maximum number of characters/bytes to return.
- If
lenis 0 or negative, the result is an empty string. - If
lenexceeds the remaining length frompos, the result contains characters/bytes fromposto the end.
- If
- returns
A Column containing the extracted substring.
- Since
0.1.0
- def substring_index(str: String, delim: String, count: Int): Column
Returns the substring from string str before count occurrences of the delimiter delim.
Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything the left of the final delimiter (counting from left) is returned. If count is negative, every to the right of the final delimiter (counting from the right) is returned. substring_index performs a case-sensitive match when searching for delim.
- Since
1.14.0
- def sum(colName: String): Column
Returns the sum of non-NULL records in a group.
Returns the sum of non-NULL records in a group. If all records inside a group are NULL, the function returns NULL.
- colName
The input column name
- returns
The result column
- Since
1.12.0
- def sum(e: Column): Column
Returns the sum of non-NULL records in a group.
Returns the sum of non-NULL records in a group. If all records inside a group are NULL, the function returns NULL.
- Since
0.1.0
- def sum_distinct(e: Column): Column
Returns the sum of non-NULL distinct records in a group.
Returns the sum of non-NULL distinct records in a group. You can use the DISTINCT keyword to compute the sum of unique non-null values. If all records inside a group are NULL, the function returns NULL.
- Since
0.1.0
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def sysdate(): Column
Returns the current timestamp for the system, but in the UTC time zone.
Returns the current timestamp for the system, but in the UTC time zone.
- Since
0.1.0
- def tan(e: Column): Column
Computes the tangent of its argument; the argument should be expressed in radians.
Computes the tangent of its argument; the argument should be expressed in radians.
- Since
0.1.0
- def tanh(e: Column): Column
Computes the hyperbolic tangent of its argument.
Computes the hyperbolic tangent of its argument.
- Since
0.1.0
- def time_from_parts(hour: Column, minute: Column, second: Column): Column
Creates a time from individual numeric components.
Creates a time from individual numeric components.
- Since
0.1.0
- def time_from_parts(hour: Column, minute: Column, second: Column, nanoseconds: Column): Column
Creates a time from individual numeric components.
Creates a time from individual numeric components.
- Since
0.1.0
- def timestamp_from_parts(dateExpr: Column, timeExpr: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column, nanosecond: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_ltz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column, nanosecond: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_ltz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_ntz_from_parts(dateExpr: Column, timeExpr: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_ntz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column, nanosecond: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_ntz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_tz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column, nanosecond: Column, timeZone: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_tz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column, nanosecond: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def timestamp_tz_from_parts(year: Column, month: Column, day: Column, hour: Column, minute: Column, second: Column): Column
Creates a timestamp from individual numeric components.
Creates a timestamp from individual numeric components. If no time zone is in effect, the function can be used to create a timestamp from a date expression and a time expression.
- Since
0.1.0
- def toScalar(df: DataFrame): Column
Generate a Column representing the result of the input DataFrame.
Generate a Column representing the result of the input DataFrame. The parameter
dfshould have one column and must produce one row.For Example:
import functions._ val df1 = session.sql("select * from values(1,1,1),(2,2,3) as T(c1,c2,c3)") val df2 = session.sql("select * from values(2) as T(a)") df1.select(Column("c1"), toScalar(df2)).show() df1.filter(Column("c1") < toScalar(df2)).show()
- Since
0.4.0
- def toString(): String
- Definition Classes
- AnyRef → Any
- def to_array(col: Column): Column
Converts the input expression into an array:
Converts the input expression into an array:
If the input is an ARRAY, or VARIANT containing an array value, the result is unchanged. For NULL or a JSON null input, returns NULL. For any other value, the result is a single-element array containing this value.
- Since
0.2.0
- def to_date(e: Column, fmt: Column): Column
Converts an input expression to a date.
Converts an input expression to a date.
- Since
0.1.0
- def to_date(e: Column): Column
Converts an input expression to a date.
Converts an input expression to a date.
- Since
0.1.0
- def to_decimal(expr: Column, precision: Int, scale: Int): Column
Converts an input expression to a decimal
Converts an input expression to a decimal
- Since
0.5.0
- def to_json(col: Column): Column
Converts any VARIANT value to a string containing the JSON representation of the value.
Converts any VARIANT value to a string containing the JSON representation of the value. If the input is NULL, the result is also NULL.
- Since
0.2.0
- def to_number(e: Column, format: Column, precision: Int, scale: Int): Column
Converts string 'e' to a number based on the string format 'format' with specified precision and scale.
Converts string 'e' to a number based on the string format 'format' with specified precision and scale.
- e
The input expression to convert.
- format
The format to use to convert numeric values.
- precision
The precision (total number of digits).
- scale
The scale (number of digits after the decimal point).
- returns
A Column with the numeric value.
- Since
1.19.0
- def to_number(e: Column, format: Column): Column
Converts string 'e' to a number based on the string format 'format'.
Converts string 'e' to a number based on the string format 'format'.
Precision and scale are automatically derived from the format string.
- e
The input expression to convert.
- format
The format to use to convert numeric values.
- returns
A Column with the numeric value.
- Since
1.19.0
- def to_number(e: Column): Column
Converts an input expression to a NUMBER value.
Converts an input expression to a NUMBER value.
Uses default precision (38) and scale (0).
- e
The input expression to convert.
- returns
A Column with the numeric value.
- Since
1.19.0
- def to_object(col: Column): Column
Converts the input value to an object:
Converts the input value to an object:
For a variant value containing an object, returns this object (in a value of type OBJECT). For a variant value containing JSON null or for NULL input, returns NULL. For all other input values, reports an error.
- Since
0.2.0
- def to_timestamp(s: Column, fmt: Column): Column
Converts an input expression into the corresponding timestamp.
Converts an input expression into the corresponding timestamp.
- Since
0.1.0
- def to_timestamp(s: Column): Column
Converts an input expression into the corresponding timestamp.
Converts an input expression into the corresponding timestamp.
- Since
0.1.0
- def to_utc_timestamp(ts: Column): Column
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in the given time zone, and renders that time as a timestamp in UTC.
Given a timestamp like '2017-07-14 02:40:00.0', interprets it as a time in the given time zone, and renders that time as a timestamp in UTC. For example, 'GMT+1' would yield '2017-07-14 01:40:00.0'.
- ts
A date, timestamp or string. If a string, the data must be in a format that can be cast to a timestamp, such as
yyyy-MM-ddoryyyy-MM-dd HH:mm:ss.SSSSA string detailing the time zone ID that the input should be adjusted to. It should be in the format of either region-based zone IDs or zone offsets. Region IDs must have the form 'area/city', such as 'America/Los_Angeles'. Zone offsets must be in the format '(+|-)HH:mm', for example '-08:00' or '+01:00'. Also 'UTC' and 'Z' are supported as aliases of '+00:00'. Other short names are not recommended to use because they can be ambiguous.- returns
A timestamp, or null if
tswas a string that could not be cast to a timestamp ortzwas an invalid value
- Since
1.15.0
- def to_variant(col: Column): Column
Converts any value to VARIANT value or NULL (if input is NULL).
Converts any value to VARIANT value or NULL (if input is NULL).
- Since
0.2.0
- def to_xml(col: Column): Column
Converts any VARIANT value to a string containing the XML representation of the value.
Converts any VARIANT value to a string containing the XML representation of the value. If the input is NULL, the result is also NULL.
- Since
0.2.0
- def translate(src: Column, matchingString: Column, replaceString: Column): Column
Translates src from the characters in matchingString to the characters in replaceString.
Translates src from the characters in matchingString to the characters in replaceString.
- Since
0.1.0
- def trim(e: Column, trimString: Column): Column
Removes leading and trailing characters from a string.
Removes leading and trailing characters from a string.
- Since
0.1.0
- def trunc(expr: Column, scale: Column): Column
Rounds the input expression down to the nearest (or equal) integer closer to zero, or to the nearest equal or smaller value with the specified number of places after the decimal point.
Rounds the input expression down to the nearest (or equal) integer closer to zero, or to the nearest equal or smaller value with the specified number of places after the decimal point.
- Since
0.1.0
- def try_to_date(e: Column, fmt: String): Column
Wrapper for Snowflake built-in try_to_date function.
Wrapper for Snowflake built-in try_to_date function. Converts an input expression to a date, but with error-handling support, if the conversion cannot be performed, it returns a NULL value instead of raising an error.
Example
val df = session.sql("select * from values('2020.07.23'),('INVALID') as T(a)") df.select(try_to_date(col("a"), "YYYY.MM.DD")).show() -------------------------------------- |"TRY_TO_DATE(""A"", 'YYYY.MM.DD')" | -------------------------------------- |2020-07-23 | |NULL | --------------------------------------
- e
The input value to be converted to date.
- fmt
The time format as String
- returns
The result column.
- Since
1.18.0
- def try_to_date(e: Column, fmt: Column): Column
Wrapper for Snowflake built-in try_to_date function.
Wrapper for Snowflake built-in try_to_date function. Converts an input expression to a date, but with error-handling support, if the conversion cannot be performed, it returns a NULL value instead of raising an error.
Example
val df = session.sql("select * from values('2020.07.23'),('INVALID') as T(a)") df.select(try_to_date(col("a"), lit("YYYY.MM.DD"))).show() -------------------------------------- |"TRY_TO_DATE(""A"", 'YYYY.MM.DD')" | -------------------------------------- |2020-07-23 | |NULL | --------------------------------------
- e
The input value to be converted to date.
- fmt
The time format as Column
- returns
The result column.
- Since
1.17.0
- def try_to_date(e: Column): Column
Wrapper for Snowflake built-in try_to_date function.
Wrapper for Snowflake built-in try_to_date function. Converts an input expression to a date, but with error-handling support, if the conversion cannot be performed, it returns a NULL value instead of raising an error.
Example
SELECT TRY_TO_DATE("2020-05-11") as valid, TRY_TO_DATE("invalid") as invalid; +------------+---------+ | VALID | INVALID | |------------+---------| | 2020-05-11 | NULL | +------------+---------+
- e
The input value to be converted to date.
- returns
The result column.
- Since
1.17.0
- def try_to_number(e: Column, format: String): Column
Convenience overload of
try_to_numberthat accepts a String format and wraps it withlit.Convenience overload of
try_to_numberthat accepts a String format and wraps it withlit.- e
The input expression to convert.
- format
The format string to use to convert numeric values.
- returns
A Column with the numeric value, or NULL if conversion fails.
- def try_to_number(e: Column, format: Column, precision: Int, scale: Int): Column
Converts string 'e' to a number based on the string format 'format' with specified precision and scale, with error-handling support.
Converts string 'e' to a number based on the string format 'format' with specified precision and scale, with error-handling support. If the conversion cannot be performed, it returns NULL instead of raising an error.
- e
The input expression to convert.
- format
The format to use to convert numeric values.
- precision
The precision (total number of digits).
- scale
The scale (number of digits after the decimal point).
- returns
A Column with the numeric value, or NULL if conversion fails.
- Since
1.19.0
- def try_to_number(e: Column, format: Column): Column
Converts string 'e' to a number based on the string format 'format', with error-handling support.
Converts string 'e' to a number based on the string format 'format', with error-handling support. If the conversion cannot be performed, it returns NULL instead of raising an error.
Precision and scale are automatically derived from the format string.
- e
The input expression to convert.
- format
The format to use to convert numeric values.
- returns
A Column with the numeric value, or NULL if conversion fails.
- Since
1.19.0
- def try_to_number(e: Column): Column
Converts an input expression to a NUMBER value, with error-handling support.
Converts an input expression to a NUMBER value, with error-handling support. If the conversion cannot be performed, it returns NULL instead of raising an error.
Uses default precision (38) and scale (0).
- e
The input expression to convert.
- returns
A Column with the numeric value, or NULL if conversion fails.
- Since
1.19.0
- def try_to_timestamp(s: Column, fmt: String): Column
Wrapper for Snowflake built-in try_to_timestamp function.
Wrapper for Snowflake built-in try_to_timestamp function. Converts an input expression into the corresponding timestamp, but with error-handling support, if the conversion cannot be performed, it returns a NULL value instead of raising an error.
Example
val df = session.sql("select * from (values ('04/05/2020 01:02:03'), ('invalid')) as T(a)") df.select(try_to_timestamp(col("a"), "mm/dd/yyyy hh24:mi:ss")).show() ------------------------------------------------------ |"TRY_TO_TIMESTAMP(""A"", 'MM/DD/YYYY HH24:MI:SS')" | ------------------------------------------------------ |2020-04-05 01:02:03.0 | |NULL | ------------------------------------------------------
- s
The input value to be converted to timestamp.
- fmt
The time format as String
- returns
The result column.
- Since
1.18.0
- def try_to_timestamp(s: Column, fmt: Column): Column
Wrapper for Snowflake built-in try_to_timestamp function.
Wrapper for Snowflake built-in try_to_timestamp function. Converts an input expression into the corresponding timestamp, but with error-handling support, if the conversion cannot be performed, it returns a NULL value instead of raising an error.
Example
val df = session.sql("select * from (values ('04/05/2020 01:02:03'), ('invalid')) as T(a)") df.select(try_to_timestamp(col("a"), lit("mm/dd/yyyy hh24:mi:ss"))).show() ------------------------------------------------------ |"TRY_TO_TIMESTAMP(""A"", 'MM/DD/YYYY HH24:MI:SS')" | ------------------------------------------------------ |2020-04-05 01:02:03.0 | |NULL | ------------------------------------------------------
- s
The input value to be converted to timestamp.
- fmt
The time format as Column
- returns
The result column.
- Since
1.17.0
- def try_to_timestamp(s: Column): Column
Wrapper for Snowflake built-in try_to_timestamp function.
Wrapper for Snowflake built-in try_to_timestamp function. Converts an input expression into the corresponding timestamp, but with error-handling support, if the conversion cannot be performed, it returns a NULL value instead of raising an error.
Example
SELECT TRY_TO_TIMESTAMP('2024-01-15 12:30:00') as valid, TRY_TO_TIMESTAMP('1561479557') as valid, TRY_TO_TIMESTAMP('INVALID') as invalid; +-------------------------+---------+ | VALID | INVALID | |-------------------------+---------| | 2024-01-15 12:30:00.000 | NULL | +-------------------------+---------+- s
The input value to be converted to timestamp.
- returns
The result column.
- Since
1.17.0
- def typedLit[T](literal: T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Column
Creates a Column expression for a literal value.
Creates a Column expression for a literal value.
- Since
0.1.0
- def udf(funcName: String)(func: => UserDefinedFunction): UserDefinedFunction
- Attributes
- protected
- Annotations
- @inline()
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16], arg17: scala.reflect.api.JavaUniverse.TypeTag[A17], arg18: scala.reflect.api.JavaUniverse.TypeTag[A18], arg19: scala.reflect.api.JavaUniverse.TypeTag[A19], arg20: scala.reflect.api.JavaUniverse.TypeTag[A20], arg21: scala.reflect.api.JavaUniverse.TypeTag[A21], arg22: scala.reflect.api.JavaUniverse.TypeTag[A22]): UserDefinedFunction
Registers a Scala closure of 22 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 22 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16], arg17: scala.reflect.api.JavaUniverse.TypeTag[A17], arg18: scala.reflect.api.JavaUniverse.TypeTag[A18], arg19: scala.reflect.api.JavaUniverse.TypeTag[A19], arg20: scala.reflect.api.JavaUniverse.TypeTag[A20], arg21: scala.reflect.api.JavaUniverse.TypeTag[A21]): UserDefinedFunction
Registers a Scala closure of 21 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 21 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16], arg17: scala.reflect.api.JavaUniverse.TypeTag[A17], arg18: scala.reflect.api.JavaUniverse.TypeTag[A18], arg19: scala.reflect.api.JavaUniverse.TypeTag[A19], arg20: scala.reflect.api.JavaUniverse.TypeTag[A20]): UserDefinedFunction
Registers a Scala closure of 20 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 20 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16], arg17: scala.reflect.api.JavaUniverse.TypeTag[A17], arg18: scala.reflect.api.JavaUniverse.TypeTag[A18], arg19: scala.reflect.api.JavaUniverse.TypeTag[A19]): UserDefinedFunction
Registers a Scala closure of 19 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 19 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16], arg17: scala.reflect.api.JavaUniverse.TypeTag[A17], arg18: scala.reflect.api.JavaUniverse.TypeTag[A18]): UserDefinedFunction
Registers a Scala closure of 18 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 18 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16], arg17: scala.reflect.api.JavaUniverse.TypeTag[A17]): UserDefinedFunction
Registers a Scala closure of 17 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 17 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15], arg16: scala.reflect.api.JavaUniverse.TypeTag[A16]): UserDefinedFunction
Registers a Scala closure of 16 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 16 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14], arg15: scala.reflect.api.JavaUniverse.TypeTag[A15]): UserDefinedFunction
Registers a Scala closure of 15 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 15 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13], arg14: scala.reflect.api.JavaUniverse.TypeTag[A14]): UserDefinedFunction
Registers a Scala closure of 14 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 14 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12], arg13: scala.reflect.api.JavaUniverse.TypeTag[A13]): UserDefinedFunction
Registers a Scala closure of 13 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 13 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11], arg12: scala.reflect.api.JavaUniverse.TypeTag[A12]): UserDefinedFunction
Registers a Scala closure of 12 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 12 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10], arg11: scala.reflect.api.JavaUniverse.TypeTag[A11]): UserDefinedFunction
Registers a Scala closure of 11 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 11 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.12.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9], arg10: scala.reflect.api.JavaUniverse.TypeTag[A10]): UserDefinedFunction
Registers a Scala closure of 10 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 10 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8, A9](func: (A1, A2, A3, A4, A5, A6, A7, A8, A9) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8], arg9: scala.reflect.api.JavaUniverse.TypeTag[A9]): UserDefinedFunction
Registers a Scala closure of 9 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 9 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7, A8](func: (A1, A2, A3, A4, A5, A6, A7, A8) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7], arg8: scala.reflect.api.JavaUniverse.TypeTag[A8]): UserDefinedFunction
Registers a Scala closure of 8 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 8 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3, A4, A5, A6, A7](func: (A1, A2, A3, A4, A5, A6, A7) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6], arg7: scala.reflect.api.JavaUniverse.TypeTag[A7]): UserDefinedFunction
Registers a Scala closure of 7 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 7 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3, A4, A5, A6](func: (A1, A2, A3, A4, A5, A6) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5], arg6: scala.reflect.api.JavaUniverse.TypeTag[A6]): UserDefinedFunction
Registers a Scala closure of 6 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 6 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3, A4, A5](func: (A1, A2, A3, A4, A5) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4], arg5: scala.reflect.api.JavaUniverse.TypeTag[A5]): UserDefinedFunction
Registers a Scala closure of 5 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 5 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3, A4](func: (A1, A2, A3, A4) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3], arg4: scala.reflect.api.JavaUniverse.TypeTag[A4]): UserDefinedFunction
Registers a Scala closure of 4 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 4 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2, A3](func: (A1, A2, A3) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2], arg3: scala.reflect.api.JavaUniverse.TypeTag[A3]): UserDefinedFunction
Registers a Scala closure of 3 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 3 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1, A2](func: (A1, A2) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1], arg2: scala.reflect.api.JavaUniverse.TypeTag[A2]): UserDefinedFunction
Registers a Scala closure of 2 arguments as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 2 arguments as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT, A1](func: (A1) => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT], arg1: scala.reflect.api.JavaUniverse.TypeTag[A1]): UserDefinedFunction
Registers a Scala closure of 1 argument as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 1 argument as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def udf[RT](func: () => RT)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[RT]): UserDefinedFunction
Registers a Scala closure of 0 argument as a Snowflake Java UDF and returns the UDF.
Registers a Scala closure of 0 argument as a Snowflake Java UDF and returns the UDF.
- RT
return type of UDF.
- Since
0.1.0
- def unbase64(col: Column): Column
Decodes a BASE64 encoded string column and returns it as a column.
Decodes a BASE64 encoded string column and returns it as a column. Example
val df = session.createDataFrame(Seq("dGVzdA==")).toDF("a") df.select(unbase64(col("a")).as("unbase64")).show() -------------- |"UNBASE64" | -------------- |test | --------------
- returns
the decoded value of the given encoded value.
- Since
1.14.0
- def unhex(c: Column): Column
Inverse of hex.
Inverse of hex. Interprets each pair of characters as a hexadecimal number and converts to the byte representation of number. Example
val df = session.createDataFrame(Seq((31), (32), (33))).toDF("a") df.withColumn("unhex_col", unhex(col("A"))).select("unhex_col").show() --------------- |"UNHEX_COL" | --------------- |1 | |2 | |3 | ---------------
- c
Column to encode.
- returns
Encoded string.
- Since
1.14.0
- def uniform(min: Column, max: Column, gen: Column): Column
Returns a uniformly random number, in the inclusive range (
min,max)Returns a uniformly random number, in the inclusive range (
min,max)For example:
import com.snowflake.snowpark.functions._ session.generator(10, seq4(), uniform(lit(1), lit(5), random())).show()
- min
The lower bound
- max
The upper bound
- gen
The generator expression for the function. for more information, see https://docs.snowflake.com/en/sql-reference/functions-data-generation.html#label-rand-dist-functions
- Since
0.11.0
- def unix_timestamp(c: Column): Column
Returns the current Unix timestamp (in seconds) as a long.
Returns the current Unix timestamp (in seconds) as a long. Extracts a specified date or time portion from a date, time, or timestamp. how:
EXTRACT , HOUR / MINUTE / SECOND , YEAR* / DAY* / WEEK* / MONTH / QUARTER Construction - DATE_PART( <date_or_time_part> , <date_or_time_expr> ) SELECT TO_TIMESTAMP('2013-05-08T23:39:20.123-07:00') AS "TIME_STAMP1", DATE_PART(EPOCH_SECOND, "TIME_STAMP1") AS "EXTRACTED EPOCH SECOND"; +-------------------------+------------------------+ | TIME_STAMP1 | EXTRACTED EPOCH SECOND | |-------------------------+------------------------| | 2013-05-08 23:39:20.123 | 1368056360 | +-------------------------+------------------------+- Since
1.14.0
- Note
All calls of
unix_timestampwithin the same query return the same value
- def upper(e: Column): Column
Returns the input string with all characters converted to uppercase.
Returns the input string with all characters converted to uppercase.
- Since
0.1.0
- def var_pop(e: Column): Column
Returns the population variance of non-NULL records in a group.
Returns the population variance of non-NULL records in a group. If all records inside a group are NULL, a NULL is returned.
- Since
0.1.0
- def var_samp(e: Column): Column
Returns the sample variance of non-NULL records in a group.
Returns the sample variance of non-NULL records in a group. If all records inside a group are NULL, a NULL is returned. Alias of var_samp
- Since
0.1.0
- def variance(e: Column): Column
Returns the sample variance of non-NULL records in a group.
Returns the sample variance of non-NULL records in a group. If all records inside a group are NULL, a NULL is returned.
- Since
0.1.0
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def weekofyear(e: Column): Column
Extracts the week of year from a date or timestamp.
Extracts the week of year from a date or timestamp.
- Since
0.1.0
- def when(condition: Column, value: Any): CaseExpr
Works like a cascading if-then-else statement.
Works like a cascading if-then-else statement. A series of conditions are evaluated in sequence. When a condition evaluates to TRUE, the evaluation stops and the associated result (after THEN) is returned. If none of the conditions evaluate to TRUE, then the result after the optional OTHERWISE is returned, if present; otherwise NULL is returned.
Example
import functions._ val df = session.sql("SELECT * FROM values (null, 5), (1, 10), (2, 15) as T(col, numeric_col)") val result = df.select( when(col("col").is_null, lit(1)) .when(col("col") === 1, lit(2)) .when(col("col") === 1, col("numeric_col") * 0.10) .otherwise(lit(3)) )
- condition
The case condition.
- value
The result value, which can be any literal (e.g., String, Int, Boolean) or a
Column.- returns
The result case expression.
- Since
0.2.0
- def xmlget(xml: Column, tag: Column): Column
Extracts the first XML element object (often referred to as simply a tag) from a content of outer XML element object by the name of the tag
Extracts the first XML element object (often referred to as simply a tag) from a content of outer XML element object by the name of the tag
- Since
0.2.0
- def xmlget(xml: Column, tag: Column, instance: Column): Column
Extracts an XML element object (often referred to as simply a tag) from a content of outer XML element object by the name of the tag and its instance number (counting from 0).
Extracts an XML element object (often referred to as simply a tag) from a content of outer XML element object by the name of the tag and its instance number (counting from 0).
- Since
0.2.0
- def year(e: Column): Column
Extracts the year from a date or timestamp.
Extracts the year from a date or timestamp.
- Since
0.1.0
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)