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
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class ExpressionInfo {
"bitwise_funcs", "collection_funcs", "predicate_funcs", "conditional_funcs",
"conversion_funcs", "csv_funcs", "datetime_funcs", "generator_funcs", "hash_funcs",
"json_funcs", "lambda_funcs", "map_funcs", "math_funcs", "misc_funcs",
"protobuf_funcs", "string_funcs", "struct_funcs", "window_funcs", "xml_funcs",
"table_funcs", "url_funcs", "variant_funcs", "vector_funcs", "st_funcs"));
"protobuf_funcs", "sketch_funcs", "string_funcs", "struct_funcs", "window_funcs",
"xml_funcs", "table_funcs", "url_funcs", "variant_funcs", "vector_funcs", "st_funcs"));

private static final Set<String> validSources =
new HashSet<>(Arrays.asList("built-in", "hive", "python_udf", "scala_udf", "sql_udf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import org.apache.spark.sql.types._
> SELECT _FUNC_(approx_top_k_accumulate(expr), 2) FROM VALUES 'a', 'b', 'c', 'c', 'c', 'c', 'd', 'd' tab(expr);
[{"item":"c","count":4},{"item":"d","count":2}]
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
// scalastyle:on line.size.limit
case class ApproxTopKEstimate(state: Expression, k: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.apache.spark.sql.types.{AbstractDataType, BinaryType, BooleanType, Da
> SELECT _FUNC_(hll_sketch_agg(col)) FROM VALUES (1), (1), (2), (2), (3) tab(col);
3
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "3.5.0")
case class HllSketchEstimate(child: Expression)
extends UnaryExpression
Expand Down Expand Up @@ -75,7 +75,7 @@ case class HllSketchEstimate(child: Expression)
> SELECT hll_sketch_estimate(_FUNC_(hll_sketch_agg(col1), hll_sketch_agg(col2))) FROM VALUES (1, 4), (1, 4), (2, 5), (2, 5), (3, 6) tab(col1, col2);
6
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "3.5.0")
// scalastyle:on line.size.limit
case class HllUnion(first: Expression, second: Expression, third: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.apache.spark.unsafe.types.UTF8String
> SELECT LENGTH(_FUNC_(kll_sketch_agg_bigint(col))) > 0 FROM VALUES (1), (2), (3), (4), (5) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchToStringBigint(child: Expression) extends KllSketchToStringBase {
override protected def withNewChildInternal(newChild: Expression): KllSketchToStringBigint =
Expand Down Expand Up @@ -66,7 +66,7 @@ case class KllSketchToStringBigint(child: Expression) extends KllSketchToStringB
> SELECT LENGTH(_FUNC_(kll_sketch_agg_float(col))) > 0 FROM VALUES (CAST(1.0 AS FLOAT)), (CAST(2.0 AS FLOAT)), (CAST(3.0 AS FLOAT)), (CAST(4.0 AS FLOAT)), (CAST(5.0 AS FLOAT)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchToStringFloat(child: Expression) extends KllSketchToStringBase {
override protected def withNewChildInternal(newChild: Expression): KllSketchToStringFloat =
Expand Down Expand Up @@ -94,7 +94,7 @@ case class KllSketchToStringFloat(child: Expression) extends KllSketchToStringBa
> SELECT LENGTH(_FUNC_(kll_sketch_agg_double(col))) > 0 FROM VALUES (CAST(1.0 AS DOUBLE)), (CAST(2.0 AS DOUBLE)), (CAST(3.0 AS DOUBLE)), (CAST(4.0 AS DOUBLE)), (CAST(5.0 AS DOUBLE)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchToStringDouble(child: Expression) extends KllSketchToStringBase {
override protected def withNewChildInternal(newChild: Expression): KllSketchToStringDouble =
Expand Down Expand Up @@ -132,7 +132,7 @@ abstract class KllSketchToStringBase
> SELECT _FUNC_(kll_sketch_agg_bigint(col)) FROM VALUES (1), (2), (3), (4), (5) tab(col);
5
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetNBigint(child: Expression) extends KllSketchGetNBase {
override protected def withNewChildInternal(newChild: Expression): KllSketchGetNBigint =
Expand Down Expand Up @@ -160,7 +160,7 @@ case class KllSketchGetNBigint(child: Expression) extends KllSketchGetNBase {
> SELECT _FUNC_(kll_sketch_agg_float(col)) FROM VALUES (CAST(1.0 AS FLOAT)), (CAST(2.0 AS FLOAT)), (CAST(3.0 AS FLOAT)), (CAST(4.0 AS FLOAT)), (CAST(5.0 AS FLOAT)) tab(col);
5
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetNFloat(child: Expression) extends KllSketchGetNBase {
override protected def withNewChildInternal(newChild: Expression): KllSketchGetNFloat =
Expand Down Expand Up @@ -188,7 +188,7 @@ case class KllSketchGetNFloat(child: Expression) extends KllSketchGetNBase {
> SELECT _FUNC_(kll_sketch_agg_double(col)) FROM VALUES (CAST(1.0 AS DOUBLE)), (CAST(2.0 AS DOUBLE)), (CAST(3.0 AS DOUBLE)), (CAST(4.0 AS DOUBLE)), (CAST(5.0 AS DOUBLE)) tab(col);
5
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetNDouble(child: Expression) extends KllSketchGetNBase {
override protected def withNewChildInternal(newChild: Expression): KllSketchGetNDouble =
Expand Down Expand Up @@ -226,7 +226,7 @@ abstract class KllSketchGetNBase
> SELECT LENGTH(kll_sketch_to_string_bigint(_FUNC_(kll_sketch_agg_bigint(col), kll_sketch_agg_bigint(col)))) > 0 FROM VALUES (1), (2), (3), (4), (5) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchMergeBigint(left: Expression, right: Expression) extends KllSketchMergeBase {
override def withNewChildrenInternal(newLeft: Expression, newRight: Expression): Expression =
Expand Down Expand Up @@ -257,7 +257,7 @@ case class KllSketchMergeBigint(left: Expression, right: Expression) extends Kll
> SELECT LENGTH(kll_sketch_to_string_float(_FUNC_(kll_sketch_agg_float(col), kll_sketch_agg_float(col)))) > 0 FROM VALUES (CAST(1.0 AS FLOAT)), (CAST(2.0 AS FLOAT)), (CAST(3.0 AS FLOAT)), (CAST(4.0 AS FLOAT)), (CAST(5.0 AS FLOAT)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchMergeFloat(left: Expression, right: Expression) extends KllSketchMergeBase {
override def withNewChildrenInternal(newLeft: Expression, newRight: Expression): Expression =
Expand Down Expand Up @@ -288,7 +288,7 @@ case class KllSketchMergeFloat(left: Expression, right: Expression) extends KllS
> SELECT LENGTH(kll_sketch_to_string_double(_FUNC_(kll_sketch_agg_double(col), kll_sketch_agg_double(col)))) > 0 FROM VALUES (CAST(1.0 AS DOUBLE)), (CAST(2.0 AS DOUBLE)), (CAST(3.0 AS DOUBLE)), (CAST(4.0 AS DOUBLE)), (CAST(5.0 AS DOUBLE)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchMergeDouble(left: Expression, right: Expression) extends KllSketchMergeBase {
override def withNewChildrenInternal(newLeft: Expression, newRight: Expression): Expression =
Expand Down Expand Up @@ -332,7 +332,7 @@ abstract class KllSketchMergeBase
> SELECT _FUNC_(kll_sketch_agg_bigint(col), 0.5) > 1 FROM VALUES (1), (2), (3), (4), (5) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetQuantileBigint(left: Expression, right: Expression)
extends KllSketchGetQuantileBase {
Expand Down Expand Up @@ -364,7 +364,7 @@ case class KllSketchGetQuantileBigint(left: Expression, right: Expression)
> SELECT _FUNC_(kll_sketch_agg_float(col), 0.5) > 1 FROM VALUES (CAST(1.0 AS FLOAT)), (CAST(2.0 AS FLOAT)), (CAST(3.0 AS FLOAT)), (CAST(4.0 AS FLOAT)), (CAST(5.0 AS FLOAT)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetQuantileFloat(left: Expression, right: Expression)
extends KllSketchGetQuantileBase {
Expand Down Expand Up @@ -396,7 +396,7 @@ case class KllSketchGetQuantileFloat(left: Expression, right: Expression)
> SELECT _FUNC_(kll_sketch_agg_double(col), 0.5) > 1 FROM VALUES (CAST(1.0 AS DOUBLE)), (CAST(2.0 AS DOUBLE)), (CAST(3.0 AS DOUBLE)), (CAST(4.0 AS DOUBLE)), (CAST(5.0 AS DOUBLE)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetQuantileDouble(left: Expression, right: Expression)
extends KllSketchGetQuantileBase {
Expand Down Expand Up @@ -528,7 +528,7 @@ abstract class KllSketchGetQuantileBase
> SELECT _FUNC_(kll_sketch_agg_bigint(col), 3) > 0.3 FROM VALUES (1), (2), (3), (4), (5) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetRankBigint(left: Expression, right: Expression)
extends KllSketchGetRankBase {
Expand Down Expand Up @@ -556,7 +556,7 @@ case class KllSketchGetRankBigint(left: Expression, right: Expression)
> SELECT _FUNC_(kll_sketch_agg_float(col), 3.0) > 0.3 FROM VALUES (CAST(1.0 AS FLOAT)), (CAST(2.0 AS FLOAT)), (CAST(3.0 AS FLOAT)), (CAST(4.0 AS FLOAT)), (CAST(5.0 AS FLOAT)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetRankFloat(left: Expression, right: Expression)
extends KllSketchGetRankBase {
Expand Down Expand Up @@ -584,7 +584,7 @@ case class KllSketchGetRankFloat(left: Expression, right: Expression)
> SELECT _FUNC_(kll_sketch_agg_double(col), 3.0) > 0.3 FROM VALUES (CAST(1.0 AS DOUBLE)), (CAST(2.0 AS DOUBLE)), (CAST(3.0 AS DOUBLE)), (CAST(4.0 AS DOUBLE)), (CAST(5.0 AS DOUBLE)) tab(col);
true
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class KllSketchGetRankDouble(left: Expression, right: Expression)
extends KllSketchGetRankBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.apache.spark.sql.types.{AbstractDataType, BinaryType, DataType, Integ
> SELECT _FUNC_(theta_sketch_agg(col)) FROM VALUES (1), (1), (2), (2), (3) tab(col);
3
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
case class ThetaSketchEstimate(child: Expression)
extends UnaryExpression
Expand Down Expand Up @@ -71,7 +71,7 @@ case class ThetaSketchEstimate(child: Expression)
> SELECT theta_sketch_estimate(_FUNC_(theta_sketch_agg(col1), theta_sketch_agg(col2))) FROM VALUES (1, 4), (1, 4), (2, 5), (2, 5), (3, 6) tab(col1, col2);
6
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
// scalastyle:on line.size.limit
case class ThetaUnion(first: Expression, second: Expression, third: Expression)
Expand Down Expand Up @@ -130,7 +130,7 @@ case class ThetaUnion(first: Expression, second: Expression, third: Expression)
> SELECT theta_sketch_estimate(_FUNC_(theta_sketch_agg(col1), theta_sketch_agg(col2))) FROM VALUES (5, 4), (1, 4), (2, 5), (2, 5), (3, 1) tab(col1, col2);
2
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
// scalastyle:on line.size.limit
case class ThetaDifference(first: Expression, second: Expression)
Expand Down Expand Up @@ -178,7 +178,7 @@ case class ThetaDifference(first: Expression, second: Expression)
> SELECT theta_sketch_estimate(_FUNC_(theta_sketch_agg(col1), theta_sketch_agg(col2))) FROM VALUES (5, 4), (1, 4), (2, 5), (2, 5), (3, 1) tab(col1, col2);
2
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.1.0")
// scalastyle:on line.size.limit
case class ThetaIntersection(first: Expression, second: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import org.apache.spark.sql.types.{AbstractDataType, BinaryType, DataType}
> SELECT tuple_sketch_estimate_double(_FUNC_(tuple_sketch_agg_double(col1, val1), tuple_sketch_agg_double(col2, val2))) FROM VALUES (5, 5.0D, 4, 4.0D), (1, 1.0D, 4, 4.0D), (2, 2.0D, 5, 5.0D), (3, 3.0D, 1, 1.0D) tab(col1, val1, col2, val2);
2.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleDifferenceDouble(left: Expression, right: Expression)
Expand Down Expand Up @@ -72,7 +72,7 @@ case class TupleDifferenceDouble(left: Expression, right: Expression)
> SELECT tuple_sketch_estimate_integer(_FUNC_(tuple_sketch_agg_integer(col1, val1), tuple_sketch_agg_integer(col2, val2))) FROM VALUES (5, 5, 4, 4), (1, 1, 4, 4), (2, 2, 5, 5), (3, 3, 1, 1) tab(col1, val1, col2, val2);
2.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleDifferenceInteger(left: Expression, right: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import org.apache.spark.unsafe.types.UTF8String
> SELECT tuple_sketch_estimate_double(_FUNC_(tuple_sketch_agg_double(col1, val1), tuple_sketch_agg_double(col2, val2))) FROM VALUES (1, 1.0D, 1, 4.0D), (2, 2.0D, 2, 5.0D), (3, 3.0D, 4, 6.0D) tab(col1, val1, col2, val2);
2.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleIntersectionDouble(first: Expression, second: Expression, third: Expression)
Expand Down Expand Up @@ -84,7 +84,7 @@ case class TupleIntersectionDouble(first: Expression, second: Expression, third:
> SELECT tuple_sketch_estimate_integer(_FUNC_(tuple_sketch_agg_integer(col1, val1), tuple_sketch_agg_integer(col2, val2))) FROM VALUES (1, 1, 1, 4), (2, 2, 2, 5), (3, 3, 4, 6) tab(col1, val1, col2, val2);
2.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleIntersectionInteger(first: Expression, second: Expression, third: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.apache.spark.sql.types.{AbstractDataType, BinaryType, DataType, Doubl
> SELECT _FUNC_(tuple_sketch_agg_double(key, summary)) FROM VALUES (1, 1.0D), (1, 2.0D), (2, 3.0D) tab(key, summary);
2.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleSketchEstimateDouble(child: Expression)
Expand Down Expand Up @@ -69,7 +69,7 @@ case class TupleSketchEstimateDouble(child: Expression)
> SELECT _FUNC_(tuple_sketch_agg_integer(key, summary)) FROM VALUES (1, 1), (1, 2), (2, 3) tab(key, summary);
2.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleSketchEstimateInteger(child: Expression)
Expand Down Expand Up @@ -106,7 +106,7 @@ case class TupleSketchEstimateInteger(child: Expression)
> SELECT _FUNC_(tuple_sketch_agg_double(key, summary)) FROM VALUES (1, 1.0D), (2, 2.0D), (3, 3.0D) tab(key, summary);
1.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleSketchThetaDouble(child: Expression)
Expand Down Expand Up @@ -143,7 +143,7 @@ case class TupleSketchThetaDouble(child: Expression)
> SELECT _FUNC_(tuple_sketch_agg_integer(key, summary)) FROM VALUES (1, 1), (2, 2), (3, 3) tab(key, summary);
1.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleSketchThetaInteger(child: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import org.apache.spark.unsafe.types.UTF8String
> SELECT _FUNC_(tuple_sketch_agg_double(key, summary)) FROM VALUES (1, 1.0D), (1, 2.0D), (2, 3.0D) tab(key, summary);
6.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleSketchSummaryDouble(left: Expression, right: Expression)
Expand Down Expand Up @@ -103,7 +103,7 @@ case class TupleSketchSummaryDouble(left: Expression, right: Expression)
> SELECT _FUNC_(tuple_sketch_agg_integer(key, summary)) FROM VALUES (1, 1), (1, 2), (2, 3) tab(key, summary);
6
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
case class TupleSketchSummaryInteger(left: Expression, right: Expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ abstract class TupleUnionBase[S <: Summary]
> SELECT tuple_sketch_estimate_double(_FUNC_(tuple_sketch_agg_double(col1, val1), tuple_sketch_agg_double(col2, val2))) FROM VALUES (1, 1.0D, 4, 4.0D), (2, 2.0D, 5, 5.0D), (3, 3.0D, 6, 6.0D) tab(col1, val1, col2, val2);
6.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
object TupleUnionDoubleExpressionBuilder extends ExpressionBuilder {
Expand Down Expand Up @@ -271,7 +271,7 @@ object TupleUnionDoubleExpressionBuilder extends ExpressionBuilder {
> SELECT tuple_sketch_estimate_integer(_FUNC_(tuple_sketch_agg_integer(col1, val1), tuple_sketch_agg_integer(col2, val2))) FROM VALUES (1, 1, 4, 4), (2, 2, 5, 5), (3, 3, 6, 6) tab(col1, val1, col2, val2);
6.0
""",
group = "misc_funcs",
group = "sketch_funcs",
since = "4.2.0")
// scalastyle:on line.size.limit
object TupleUnionIntegerExpressionBuilder extends ExpressionBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ class ExpressionInfoSuite extends SparkFunSuite with SharedSparkSession {
"agg_funcs", "array_funcs", "avro_funcs", "binary_funcs", "bitwise_funcs", "collection_funcs",
"predicate_funcs", "conditional_funcs", "conversion_funcs", "csv_funcs", "datetime_funcs",
"generator_funcs", "hash_funcs", "json_funcs", "lambda_funcs", "map_funcs", "math_funcs",
"misc_funcs", "protobuf_funcs", "string_funcs", "struct_funcs", "window_funcs", "xml_funcs",
"table_funcs", "url_funcs", "variant_funcs", "vector_funcs", "st_funcs").sorted
"misc_funcs", "protobuf_funcs", "sketch_funcs", "string_funcs", "struct_funcs",
"window_funcs", "xml_funcs", "table_funcs", "url_funcs", "variant_funcs", "vector_funcs",
"st_funcs").sorted
val invalidGroupName = "invalid_group_funcs"
checkError(
exception = intercept[SparkIllegalArgumentException] {
Expand Down
2 changes: 1 addition & 1 deletion sql/gen-sql-functions-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"bitwise_funcs", "conversion_funcs", "csv_funcs",
"xml_funcs", "lambda_funcs", "collection_funcs",
"url_funcs", "hash_funcs", "struct_funcs",
"table_funcs", "variant_funcs", "protobuf_funcs"
"table_funcs", "variant_funcs", "protobuf_funcs", "sketch_funcs"
}


Expand Down