Constructor
new Column(column)
Parameters:
Name | Type | Description |
---|---|---|
column |
string | name of the column |
- Source:
Methods
alias(alias) → {module:eclairjs/sql.Column}
Gives the column an alias. Same as as.
Parameters:
Name | Type | Description |
---|---|---|
alias |
string |
- Source:
Returns:
Example
// Renames colA to colB in select output.
df.select(df.col("colA").alias("colB"))
and(other) → {module:eclairjs/sql.Column}
Boolean AND.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Source:
Returns:
Example
people.select( people.col("inSchool").and(people.col("isEmployed")));
as(aliases,, metadata) → {module:eclairjs/sql.Column}
Gives the column an alias.
Parameters:
Name | Type | Description |
---|---|---|
aliases, |
string | Array.<string> | if array of strings assigns the given aliases to the results of a table generating function. |
metadata |
module:eclairjs/sql/types.Metadata | not valid with string array |
- Source:
Returns:
asc() → {module:eclairjs/sql.Column}
Returns an ordering used in sorting.
- Source:
Returns:
Example
df.sort(df.col("age").asc());
between(lowerBound, upperBound) → {module:eclairjs/sql.Column}
True if the current column is between the lower bound and upper bound, inclusive.
Parameters:
Name | Type | Description |
---|---|---|
lowerBound |
object | |
upperBound |
object |
- Source:
Returns:
Example
var col = new Column("age");
var testCol = col.between(10, 29);
var results = peopleDataFrame.select(testCol);
bitwiseAND(other) → {module:eclairjs/sql.Column}
Compute bitwise AND of this expression with another expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.4.0
- Source:
Returns:
Example
df.select(df.col("colA").bitwiseAND(df.col("colB")));
bitwiseOR(other) → {module:eclairjs/sql.Column}
Compute bitwise OR of this expression with another expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.4.0
- Source:
Returns:
Example
df.select(df.col("colA").bitwiseOR(df.col("colB")));
bitwiseXOR(other) → {module:eclairjs/sql.Column}
Compute bitwise XOR of this expression with another expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.4.0
- Source:
Returns:
Example
df.select(df.col("colA").bitwiseXOR(df.col("colB")));
cast(to) → {module:eclairjs/sql.Column}
Casts the column to a different data type.
Parameters:
Name | Type | Description |
---|---|---|
to |
module:eclairjs/sql/types.DataType | string | If string supported types are: `string`, `boolean`, `int`, `float`, `double`, `date`, `timestamp`. |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
// Casts colA to IntegerType.
df.select(df("colA").cast(DataTpes.IntegerType))
// equivalent to
df.select(df.col("colA").cast("int"))
contains(other) → {module:eclairjs/sql.Column}
Contains the other element.
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
desc() → {module:eclairjs/sql.Column}
Returns an ordering used in sorting.
- Source:
Returns:
Example
df.sort(df.col("age").desc());
divide(other) → {module:eclairjs/sql.Column}
Division this expression by another expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
people.select( people.col("height").divide(people.col("weight")) );
endsWith(other,) → {module:eclairjs/sql.Column}
String ends with.
with another string literal
Parameters:
Name | Type | Description |
---|---|---|
other, |
string | module:eclairjs/sql.Column | if string ends with another string literal. |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
eqNullSafe(other) → {module:eclairjs/sql.Column}
Equality test that is safe for null values.
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
equals(that) → {boolean}
Equality test
Parameters:
Name | Type | Description |
---|---|---|
that |
object |
- Source:
Returns:
- Type
- boolean
equalTo(obj) → {module:eclairjs/sql.Column}
Equality test
Parameters:
Name | Type | Description |
---|---|---|
obj |
object |
- Source:
Returns:
explain()
Prints the expression to the console for debugging purpose.
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
geq(obj) → {module:eclairjs/sql.Column}
Greater than or equal to an expression.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object |
- Source:
Returns:
Example
people.select( people.col("age").geq(21) )
getField(fieldName) → {module:eclairjs/sql.Column}
An expression that gets a field by name in a StructType.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
getItem(key) → {module:eclairjs/sql.Column}
An expression that gets an item at position `ordinal` out of an array,
or gets a value by key `key` in a MapType.
Parameters:
Name | Type | Description |
---|---|---|
key |
object |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
gt(obj) → {module:eclairjs/sql.Column}
Greater than.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object |
- Source:
Returns:
Example
people.select( people.col("age").gt(21) );
hashCode() → {integer}
- Source:
Returns:
- Type
- integer
isin(list) → {module:eclairjs/sql.Column}
A boolean expression that is evaluated to true if the value of this expression is contained
by the evaluated values of the arguments.
Parameters:
Name | Type | Description |
---|---|---|
list |
array |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
var col = peopleDataFrame.col("age");
var testCol = col.isin([20, 19]);
var results = peopleDataFrame.select(testCol);
isNaN() → {module:eclairjs/sql.Column}
True if the current expression is NaN.
- Since:
- EclairJS 0.1 Spark 1.5.0
- Source:
Returns:
isNotNull() → {module:eclairjs/sql.Column}
True if the current expression is NOT null.
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
isNull() → {module:eclairjs/sql.Column}
True if the current expression is null.
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
leq(other) → {module:eclairjs/sql.Column}
Less than or equal to.
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
people.select( people.col("age").leq(21) );
like(literal) → {module:eclairjs/sql.Column}
SQL like expression.
Parameters:
Name | Type | Description |
---|---|---|
literal |
string |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
lt(other) → {module:eclairjs/sql.Column}
Less than.
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
people.select( people.col("age").lt(21) );
minus(other) → {module:eclairjs/sql.Column}
Subtraction. Subtract the other expression from this expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
people.select( people.col("height").minus(people.col("weight")) );
mod(other) → {module:eclairjs/sql.Column}
Modulo (a.k.a. remainder) expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
multiply(other) → {module:eclairjs/sql.Column}
Multiplication of this expression and another expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
people.select( people.col("height").multiply(people.col("weight")) );
notEqual(other) → {module:eclairjs/sql.Column}
Inequality test.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
df.filter( df.col("colA").notEqual(df.col("colB")) );
or(other) → {module:eclairjs/sql.Column}
Boolean OR.
Parameters:
Name | Type | Description |
---|---|---|
other |
module:eclairjs/sql.Column |
- Since:
- EclairJS 0.1 Spark 1.3.0
- Source:
Returns:
Example
people.filter( people.col("inSchool").or(people.col("isEmployed")) );
otherwise(value) → {module:eclairjs/sql.Column}
Evaluates a list of conditions and returns one of multiple possible result expressions.
If otherwise is not defined at the end, null is returned for unmatched conditions.
Parameters:
Name | Type | Description |
---|---|---|
value |
object |
- Since:
- EclairJS 0.1 Spark 1.4.0
- Source:
Returns:
Example
people.select(functions.when(people.col("gender").equalTo("male"), 0)
.when(people.col("gender").equalTo("female"), 1)
.otherwise(2))
plus(other) → {module:eclairjs/sql.Column}
Sum of this expression and another expression.
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Since:
- EclairJS 0.7 Spark 1.3.0
- Source:
Returns:
Example
// Scala: The following selects the sum of a person's height and weight.
people.select( people("height") + people("weight") )
// Java:
people.select( people("height").plus(people("weight")) );
when() → {module:eclairjs/sql.Column}
Evaluates a list of conditions and returns one of multiple possible result expressions.
If otherwise is not defined at the end, null is returned for unmatched conditions.
- Since:
- EclairJS 0.1 Spark 1.4.0
- Source:
Returns:
Example
people.select(functions.when(people.col("gender").equalTo("male"), 0)
.when(people.col("gender").equalTo("female"), 1)
.otherwise(2))