Skip to content

Commit d13818b

Browse files
committed
Feat: support covar, corr functions
1 parent 782a826 commit d13818b

File tree

9 files changed

+1116
-1
lines changed

9 files changed

+1116
-1
lines changed

traindb-core/src/main/codegen/templates/Parser.jj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7027,6 +7027,7 @@ SqlIdentifier ReservedFunctionName() :
70277027
| <CHARACTER_LENGTH>
70287028
| <COALESCE>
70297029
| <COLLECT>
7030+
| <CORR>
70307031
| <COVAR_POP>
70317032
| <COVAR_SAMP>
70327033
| <CUME_DIST>

traindb-core/src/main/java/traindb/jdbc/TrainDBMetaImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import java.util.List;
8282
import java.util.Map;
8383
import java.util.regex.Pattern;
84+
import traindb.sql.fun.TrainDBAggregateOperatorTable;
8485
import traindb.sql.fun.TrainDBSpatialOperatorTable;
8586

8687
import static java.util.Objects.requireNonNull;
@@ -531,6 +532,7 @@ Enumerable<MetaFunction> functions(final MetaSchema schema_, final String catalo
531532
SqlOperatorTable opTable = getConnection().config()
532533
.fun(SqlOperatorTable.class,
533534
SqlOperatorTables.chain(SqlStdOperatorTable.instance(),
535+
TrainDBAggregateOperatorTable.instance(),
534536
TrainDBSpatialOperatorTable.instance()));
535537
List<SqlOperator> q = opTable.getOperatorList();
536538
opTableFunctions = Linq4j.asEnumerable(q)

traindb-core/src/main/java/traindb/planner/TrainDBPlanner.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public void initPlanner() {
107107
RelOptUtil.registerDefaultRules(this, true, Hook.ENABLE_BINDABLE.get(false));
108108
removeRule(CoreRules.FILTER_REDUCE_EXPRESSIONS);
109109
removeRule(CoreRules.AGGREGATE_CASE_TO_FILTER);
110+
removeRule(CoreRules.AGGREGATE_REDUCE_FUNCTIONS);
111+
addRule(TrainDBRules.AGGREGATE_REDUCE_FUNCTIONS);
110112
addRelTraitDef(ConventionTraitDef.INSTANCE);
111113
addRelTraitDef(RelCollationTraitDef.INSTANCE);
112114
setTopDownOpt(false);

0 commit comments

Comments
 (0)