Skip to content
Merged
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 @@ -105,6 +105,7 @@ void register_aggregate_function_stddev_variance_pop(AggregateFunctionSimpleFact
factory.register_alias("variance", "variance_pop");
factory.register_function_both("stddev", create_aggregate_function_stddev_pop);
factory.register_alias("stddev", "stddev_pop");
factory.register_alias("stddev", "std");
}

void register_aggregate_function_stddev_variance_samp_old(AggregateFunctionSimpleFactory& factory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public class FunctionCallExpr extends Expr {
public static final ImmutableSet<String> STDDEV_FUNCTION_SET = new ImmutableSortedSet.Builder(
String.CASE_INSENSITIVE_ORDER)
.add("stddev").add("stddev_val").add("stddev_samp").add("stddev_pop").add("variance").add("variance_pop")
.add("variance_pop").add("var_samp").add("var_pop").add("variance_samp").add("avg_weighted").build();
.add("variance_pop").add("var_samp").add("var_pop").add("variance_samp").add("avg_weighted")
.add("std").build();
public static final Map<String, java.util.function.BiFunction<ArrayList<Expr>, Type, Type>> PRECISION_INFER_RULE;
public static final java.util.function.BiFunction<ArrayList<Expr>, Type, Type> DEFAULT_PRECISION_INFER_RULE;
public static final ImmutableSet<String> ROUND_FUNCTION_SET = new ImmutableSortedSet.Builder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public class BuiltinAggregateFunctions implements FunctionHelper {
agg(SequenceCount.class, "sequence_count"),
agg(SequenceMatch.class, "sequence_match"),
agg(Skew.class, "skew", "skew_pop", "skewness"),
agg(Stddev.class, "stddev_pop", "stddev"),
agg(Stddev.class, "stddev_pop", "stddev", "std"),
agg(StddevSamp.class, "stddev_samp"),
agg(Sum.class, "sum"),
agg(Sum0.class, "sum0"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,14 @@ private void initAggregateBuiltins() {
null, null, null,
"",
false, true, false, true));
addBuiltin(AggregateFunction.createBuiltin("stddev",
Lists.newArrayList(t), STDDEV_RETTYPE_SYMBOL.get(t), t,
"",
"",
"",
null, null, null,
"",
false, true, false, true));
addBuiltin(AggregateFunction.createBuiltin("stddev_samp",
Lists.newArrayList(t), STDDEV_RETTYPE_SYMBOL.get(t), t,
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public class GenerateFunction {
.put("any", "any_value")
.put("char_length", "character_length")
.put("stddev_pop", "stddev")
.put("std", "stddev")
.put("percentile_cont", "percentile")
.put("var_pop", "variance")
.put("variance_pop", "variance")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ beijing chengdu shanghai
2 216.5
3 36.0

-- !select29 --
1 0.0
2 216.5
3 36.0

-- !select30 --
1 0.0
2 216.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ suite("test_aggregate_all_functions", "arrow_flight_sql") {
sql "INSERT INTO ${tableName_15} values(1,10), (2,8), (2,441) ,(1,10) ,(3,29) ,(3,101)"

qt_select29 "select id,stddev(level) from ${tableName_15} group by id order by id"
qt_select29 "select id,std(level) from ${tableName_15} group by id order by id"
qt_select30 "select id,stddev_pop(level) from ${tableName_15} group by id order by id"

sql "DROP TABLE IF EXISTS ${tableName_15}"
Expand Down
Loading