Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ object CHExpressionUtil {
URL_DECODE -> DefaultValidator(),
URL_ENCODE -> DefaultValidator(),
FORMAT_STRING -> FormatStringValidator(),
SKEWNESS -> DefaultValidator(),
MAKE_YM_INTERVAL -> DefaultValidator(),
MAP_ZIP_WITH -> DefaultValidator(),
KURTOSIS -> DefaultValidator(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ class GlutenClickhouseCountDistinctSuite extends GlutenClickHouseWholeStageTrans
}

test("check count distinct with agg fallback") {
// skewness agg is not supported, will cause fallback
val sql = "select count(distinct(a,b)) , skewness(b) from " +
"values (0, null,1), (0,null,1), (1, 1,1), (2, 2, 1) ,(2,2,2),(3,3,3) as data(a,b,c)"
assertThrows[UnsupportedOperationException] {
spark.sql(sql).show
}
compareResultsAgainstVanillaSpark(sql, true, { _ => })
Comment thread
taiyang-li marked this conversation as resolved.

val sqlWithKeys = "select a, count(distinct(b)) , skewness(b) from " +
"values (0, null,1), (0,null,1), (1, 1,1), (2, 2, 1) ,(2,2,2),(3,3,3) as data(a,b,c) " +
"group by a"
compareResultsAgainstVanillaSpark(sqlWithKeys, true, { _ => })
}
Comment thread
taiyang-li marked this conversation as resolved.

test("check count distinct with expr fallback") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ class AggregateFunctionParserStddev final : public AggregateFunctionParser
return func_node;
}
};
// for skewness
struct SkewnessNameStruct
{
static constexpr auto spark_name = "skewness";
static constexpr auto ch_name = "skewSamp";
};

static const AggregateFunctionParserRegister<AggregateFunctionParserStddev<SkewnessNameStruct>> registerer_skewness;
Comment thread
taiyang-li marked this conversation as resolved.
Comment thread
taiyang-li marked this conversation as resolved.
static const AggregateFunctionParserRegister<AggregateFunctionParserStddev<StddevNameStruct>> registerer_stddev;
static const AggregateFunctionParserRegister<AggregateFunctionParserStddev<StddevSampNameStruct>> registerer_stddev_samp;
}
Loading