Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions sql/core/src/main/scala/org/apache/spark/sql/Column.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql

import scala.language.implicitConversions

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.internal.Logging
import org.apache.spark.sql.catalyst.analysis._
import org.apache.spark.sql.catalyst.encoders.{encoderFor, ExpressionEncoder}
Expand Down Expand Up @@ -1181,13 +1181,11 @@ class Column(protected[sql] val expr: Expression) extends Logging {


/**
* :: Experimental ::
* A convenient class used for constructing schema.
*
* @since 1.3.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
class ColumnName(name: String) extends Column(name) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ import java.{lang => jl}

import scala.collection.JavaConverters._

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.types._


/**
* :: Experimental ::
* Functionality for working with missing data in [[DataFrame]]s.
*
* @since 1.3.1
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
final class DataFrameNaFunctions private[sql](df: DataFrame) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ import java.{lang => jl, util => ju}

import scala.collection.JavaConverters._

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.execution.stat._
import org.apache.spark.sql.types._
import org.apache.spark.util.sketch.{BloomFilter, CountMinSketch}

/**
* :: Experimental ::
* Statistic functions for [[DataFrame]]s.
*
* @since 1.4.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
final class DataFrameStatFunctions private[sql](df: DataFrame) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.spark.sql.expressions

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.sql.catalyst.expressions.ScalaUDF
import org.apache.spark.sql.Column
import org.apache.spark.sql.functions
Expand All @@ -39,13 +39,17 @@ import org.apache.spark.sql.types.DataType
*
* @since 1.3.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
case class UserDefinedFunction protected[sql] (
f: AnyRef,
dataType: DataType,
inputTypes: Option[Seq[DataType]]) {

/**
* Returns an expression that invokes the UDF, using the given arguments.
*
* @since 1.3.0
*/
def apply(exprs: Column*): Column = {
Column(ScalaUDF(f, dataType, exprs.map(_.expr), inputTypes.getOrElse(Nil)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@

package org.apache.spark.sql.expressions

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.sql.Column
import org.apache.spark.sql.catalyst.expressions._

/**
* :: Experimental ::
* Utility functions for defining window in DataFrames.
*
* {{{
Expand All @@ -36,8 +35,7 @@ import org.apache.spark.sql.catalyst.expressions._
*
* @since 1.4.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
object Window {

/**
Expand Down Expand Up @@ -164,7 +162,6 @@ object Window {
}

/**
* :: Experimental ::
* Utility functions for defining window in DataFrames.
*
* {{{
Expand All @@ -177,6 +174,5 @@ object Window {
*
* @since 1.4.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
class Window private() // So we can see Window in JavaDoc.
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@

package org.apache.spark.sql.expressions

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.sql.Column
import org.apache.spark.sql.catalyst.expressions._

/**
* :: Experimental ::
* A window specification that defines the partitioning, ordering, and frame boundaries.
*
* Use the static methods in [[Window]] to create a [[WindowSpec]].
*
* @since 1.4.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
class WindowSpec private[sql](
partitionSpec: Seq[Expression],
orderSpec: Seq[SortOrder],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@

package org.apache.spark.sql.expressions

import org.apache.spark.annotation.{Experimental, InterfaceStability}
import org.apache.spark.annotation.InterfaceStability
import org.apache.spark.sql.{Column, Row}
import org.apache.spark.sql.catalyst.expressions.aggregate.{AggregateExpression, Complete}
import org.apache.spark.sql.execution.aggregate.ScalaUDAF
import org.apache.spark.sql.types._

/**
* :: Experimental ::
* The base class for implementing user-defined aggregate functions (UDAF).
*
* @since 1.5.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
abstract class UserDefinedAggregateFunction extends Serializable {

/**
Expand All @@ -46,6 +44,8 @@ abstract class UserDefinedAggregateFunction extends Serializable {
*
* The name of a field of this [[StructType]] is only used to identify the corresponding
* input argument. Users can choose names to identify the input arguments.
*
* @since 1.5.0
*/
def inputSchema: StructType

Expand All @@ -63,17 +63,23 @@ abstract class UserDefinedAggregateFunction extends Serializable {
*
* The name of a field of this [[StructType]] is only used to identify the corresponding
* buffer value. Users can choose names to identify the input arguments.
*
* @since 1.5.0
*/
def bufferSchema: StructType

/**
* The [[DataType]] of the returned value of this [[UserDefinedAggregateFunction]].
*
* @since 1.5.0
*/
def dataType: DataType

/**
* Returns true iff this function is deterministic, i.e. given the same input,
* always return the same output.
*
* @since 1.5.0
*/
def deterministic: Boolean

Expand All @@ -83,31 +89,41 @@ abstract class UserDefinedAggregateFunction extends Serializable {
* The contract should be that applying the merge function on two initial buffers should just
* return the initial buffer itself, i.e.
* `merge(initialBuffer, initialBuffer)` should equal `initialBuffer`.
*
* @since 1.5.0
*/
def initialize(buffer: MutableAggregationBuffer): Unit

/**
* Updates the given aggregation buffer `buffer` with new input data from `input`.
*
* This is called once per input row.
*
* @since 1.5.0
*/
def update(buffer: MutableAggregationBuffer, input: Row): Unit

/**
* Merges two aggregation buffers and stores the updated buffer values back to `buffer1`.
*
* This is called when we merge two partially aggregated data together.
*
* @since 1.5.0
*/
def merge(buffer1: MutableAggregationBuffer, buffer2: Row): Unit

/**
* Calculates the final result of this [[UserDefinedAggregateFunction]] based on the given
* aggregation buffer.
*
* @since 1.5.0
*/
def evaluate(buffer: Row): Any

/**
* Creates a [[Column]] for this UDAF using given [[Column]]s as input arguments.
*
* @since 1.5.0
*/
@scala.annotation.varargs
def apply(exprs: Column*): Column = {
Expand All @@ -122,6 +138,8 @@ abstract class UserDefinedAggregateFunction extends Serializable {
/**
* Creates a [[Column]] for this UDAF using the distinct values of the given
* [[Column]]s as input arguments.
*
* @since 1.5.0
*/
@scala.annotation.varargs
def distinct(exprs: Column*): Column = {
Expand All @@ -135,15 +153,13 @@ abstract class UserDefinedAggregateFunction extends Serializable {
}

/**
* :: Experimental ::
* A [[Row]] representing a mutable aggregation buffer.
*
* This is not meant to be extended outside of Spark.
*
* @since 1.5.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
abstract class MutableAggregationBuffer extends Row {

/** Update the ith value of this buffer. */
Expand Down
4 changes: 1 addition & 3 deletions sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import org.apache.spark.util.Utils


/**
* :: Experimental ::
* Functions available for DataFrame operations.
*
* @groupname udf_funcs UDF functions
Expand All @@ -53,8 +52,7 @@ import org.apache.spark.util.Utils
* @groupname Ungrouped Support functions for DataFrames
* @since 1.3.0
*/
@Experimental
@InterfaceStability.Evolving
@InterfaceStability.Stable
// scalastyle:off
object functions {
// scalastyle:on
Expand Down
Loading