Class

org.tresamigos.smv

ColumnHelper

Related Doc: package smv

Permalink

class ColumnHelper extends AnyRef

ColumnHelper class provides additional methods/operators on Column

import org.tresamigos.smv

will import the implicit convertion from Column to ColumnHelper

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ColumnHelper
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ColumnHelper(column: Column)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def containsAll[T](candidates: T*)(implicit tt: ClassTag[T]): Column

    Permalink

    A boolean, which is true if ALL of the given parameters are contained in the Array column

    A boolean, which is true if ALL of the given parameters are contained in the Array column

    df.smvSelectPlus($"arrayCol".containsAll(seqVals: _*) as "isFound")
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def getName: String

    Permalink

    Get the name of the column.

    Get the name of the column.

    returns

    column alias for aliased columns, or expression string representation for unaliased columns

  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. def smvBinMode(): Column

    Permalink

    Compute the mode given a double bin histogram

    Compute the mode given a double bin histogram

    df_with_double_histogram_bin.select('bin_histogram.smvBinMode())
  18. def smvBinPercentile(percentile: Double): Column

    Permalink

    Compute a given percentile given a double bin histogram

    Compute a given percentile given a double bin histogram

    df_with_double_histogram_bin.select('bin_histogram.smvBinPercentile(50.0))
  19. def smvCoarseGrain(bin: Double): Column

    Permalink

    Map double to the lower bound of bins with bin-size specified

    Map double to the lower bound of bins with bin-size specified

    $"amt".smvCoarseGrain(100)  // 122.34 => 100.0, 2230.21 => 2200.0

    TODO: need to rename this function as this is just a special case of rounding!!!

  20. def smvDay70: Column

    Permalink

    Convert a timestamp to the number of months from 1970-01-01.

    Convert a timestamp to the number of months from 1970-01-01.

    lit("2012-02-29").smvStrToTimestamp("yyyy-MM-dd").smvDay70 // 15399
    returns

    number of days from 1970-01-01 (start from 0)

  21. def smvDayOfMonth: Column

    Permalink

    Extract day of month component from a timestamp.

    Extract day of month component from a timestamp.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvDayOfMonth // 25
    returns

    The day of month component as an integer (range 1-31) or null if input column is null

  22. def smvDayOfWeek: Column

    Permalink

    Extract day of the week component from a timestamp.

    Extract day of the week component from a timestamp.

    lit("2015-09-16").smvStrToTimestamp("yyyy-MM-dd").smvDayOfWeek // 3 (Wed)
    returns

    The day of the week component as an integer (range 1-7, 1 being Monday) or null if input column is null

  23. def smvHour: Column

    Permalink

    Extract hour component from a timestamp.

    Extract hour component from a timestamp.

    lit("2014-04-25 13:45").smvStrToTimestamp("yyyy-MM-dd HH:mm").smvHour // 13
    returns

    The hour component as an integer or null if input column is null

  24. def smvIsAllIn[T](candidates: T*)(implicit tt: ClassTag[T]): Column

    Permalink

    A boolean, which is true if ALL of the Array column's elements are in the given paraneter sequence

    A boolean, which is true if ALL of the Array column's elements are in the given paraneter sequence

    df.smvSelectPlus($"arrayCol".smvIsAllIn(seqVals: _*) as "isFound")
  25. def smvIsAnyIn[T](candidates: T*)(implicit tt: ClassTag[T]): Column

    Permalink

    A boolean, which is ture if ANY one of the Array column element is in the given parameter sequence

    A boolean, which is ture if ANY one of the Array column element is in the given parameter sequence

    df.smvSelectPlus($"arrayCol".smvIsAnyIn(seqVals: _*) as "isFound")
  26. def smvMetaphone: Column

    Permalink

    Map a string to it's Metaphone

  27. def smvMonth: Column

    Permalink

    Extract month component from a timestamp.

    Extract month component from a timestamp.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvMonth //4
    returns

    The month component as an integer or null if input column is null

  28. def smvMonth70: Column

    Permalink

    Convert a timestamp to the number of months from 1970-01.

    Convert a timestamp to the number of months from 1970-01.

    lit("2012-02-29").smvStrToTimestamp("yyyy-MM-dd").smvMonth70 // 505
    returns

    number of months from 1970-01 (start from 0)

  29. def smvPlusDays(days: Column): Column

    Permalink

    Add N days to Timestamp column.

    Add N days to Timestamp column.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusDays($"ColumnName")
    returns

    The incremented Timestamp or null if input was null

  30. def smvPlusDays(n: Int): Column

    Permalink

    Add N days to Timestamp column.

    Add N days to Timestamp column.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusDays(3)
    returns

    The incremented Timestamp or null if input was null

  31. def smvPlusMonths(months: Column): Column

    Permalink

    Add N months to Timestamp column.

    Add N months to Timestamp column.

    The calculation will do its best to only change the month field retaining the same day of month. However, in certain circumstances, it may be necessary to alter smaller fields. For example, 2007-03-31 plus one month cannot result in 2007-04-31, so the day of month is adjusted to 2007-04-30.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusMonths($"ColumnName")
    returns

    The incremented Timestamp or null if input was null

  32. def smvPlusMonths(n: Int): Column

    Permalink

    Add N months to Timestamp column.

    Add N months to Timestamp column.

    The calculation will do its best to only change the month field retaining the same day of month. However, in certain circumstances, it may be necessary to alter smaller fields. For example, 2007-03-31 plus one month cannot result in 2007-04-31, so the day of month is adjusted to 2007-04-30.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusMonths(1)
    returns

    The incremented Timestamp or null if input was null

  33. def smvPlusWeeks(weeks: Column): Column

    Permalink

    Add N weeks to Timestamp column.

    Add N weeks to Timestamp column.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusWeeks($"ColumnName")
    returns

    The incremented Timestamp or null if input was null

  34. def smvPlusWeeks(n: Int): Column

    Permalink

    Add N weeks to Timestamp column.

    Add N weeks to Timestamp column.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusWeeks(2)
    returns

    The incremented Timestamp or null if input was null

  35. def smvPlusYears(years: Column): Column

    Permalink

    Add N years to Timestamp column.

    Add N years to Timestamp column.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusYears($"ColumnName")
    returns

    The incremented Timestamp or null if input was null

  36. def smvPlusYears(n: Int): Column

    Permalink

    Add N years to Timestamp column.

    Add N years to Timestamp column.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvPlusYears(2)
    returns

    The incremented Timestamp or null if input was null

  37. def smvQuarter: Column

    Permalink

    Extract quarter component from a timestamp.

    Extract quarter component from a timestamp.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvQuarter // 2
    returns

    The quarter component as an integer (1 based) or null if input column is null

  38. def smvSafeDiv(other: Column, defaultv: Double): Column

    Permalink

    Safely divide one column value by a Double constant.

  39. def smvSafeDiv(denom: Column, defaultValue: Column): Column

    Permalink

    Safely divide one column value by another.

    Safely divide one column value by another. Note: only applies to columns of type Double

    lit(1.0).smvSafeDiv(lit(0.0), 1000.0) => 1000.0
    lit(1.0).smvSafeDiv(lit(null), 1000.0) => null
    null.smvSafeDiv(?,?) => null
    denom

    The denomenator to divide by.

    defaultValue

    Default value to use if denom is 0.0

    Annotations
    @Experimental()
  40. def smvStrToTimestamp(fmt: String): Column

    Permalink

    Build a timestamp from a string.

    Build a timestamp from a string. The format is the same as the Java Date format.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd")
    returns

    The timestamp or null if input string is null

  41. def smvTimeToIndex: Column

    Permalink

    smvTime helper to convert smvTime column to time index integer Example smvTime values (as String): "Q201301", "M201512", "D20141201" Example output 172, 551, 16405 (# of quarters, months, and days from 19700101)

  42. def smvTimeToLabel: Column

    Permalink

    smvTime helper to convert smvTime column to time index integer Example smvTime values (as String): "Q201301", "M201512", "D20141201" Example output 172, 551, 16405 (# of quarters, months, and days from 19700101)

  43. def smvTimeToTimestamp: Column

    Permalink

    smvTime helper to convert smvTime column to a timestamp at the beginning of the given time pireod.

    smvTime helper to convert smvTime column to a timestamp at the beginning of the given time pireod. Example smvTime values (as String): "Q201301", "M201512", "D20141201" Example output "2013-01-01 00:00:00.0", "2015-12-01 00:00:00.0", "2014-12-01 00:00:00.0"

  44. def smvTimeToType: Column

    Permalink

    smvTime helper to convert smvTime column to time type string Example smvTime values (as String): "Q201301", "M201512", "D20141201" Example output type "quarter", "month", "day"

  45. def smvYear: Column

    Permalink

    Extract year component from a timestamp.

    Extract year component from a timestamp.

    lit("2014-04-25").smvStrToTimestamp("yyyy-MM-dd").smvYear // 2014
    returns

    The year component as an integer or null if input column is null

  46. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  47. def toExpr: Expression

    Permalink

    Convert Column to catalyst Expression.

    Convert Column to catalyst Expression. This is needed here as the internal Expression in Column is marked spark private but we sometimes need access to the expression.

    ($"v" * 5).toExpr
    Annotations
    @DeveloperApi()
  48. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  49. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped