File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
traindb-core/src/main/java/traindb Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 20
20
import org .apache .calcite .sql .SqlAlienSystemTypeNameSpec ;
21
21
import org .apache .calcite .sql .SqlDataTypeSpec ;
22
22
import org .apache .calcite .sql .SqlDialect ;
23
+ import org .apache .calcite .sql .SqlKind ;
23
24
import org .apache .calcite .sql .SqlNode ;
24
25
import org .apache .calcite .sql .SqlWriter ;
25
26
import org .apache .calcite .sql .parser .SqlParserPos ;
@@ -49,6 +50,22 @@ public SqlDialect getDefaultSqlDialect() {
49
50
return DEFAULT ;
50
51
}
51
52
53
+ @ Override
54
+ public boolean supportsAggregateFunction (SqlKind kind ) {
55
+ switch (kind ) {
56
+ case COUNT :
57
+ case SUM :
58
+ case SUM0 :
59
+ case MIN :
60
+ case MAX :
61
+ case PERCENTILE_DISC :
62
+ return true ;
63
+ default :
64
+ break ;
65
+ }
66
+ return false ;
67
+ }
68
+
52
69
@ Override
53
70
public boolean supportCatalogs () {
54
71
return false ;
Original file line number Diff line number Diff line change 63
63
import org .apache .calcite .schema .ModifiableTable ;
64
64
import org .apache .calcite .sql .SqlDialect ;
65
65
import org .apache .calcite .sql .SqlFunction ;
66
+ import org .apache .calcite .sql .SqlKind ;
66
67
import org .apache .calcite .sql .SqlOperator ;
68
+ import org .apache .calcite .sql .dialect .Db2SqlDialect ;
69
+ import org .apache .calcite .sql .dialect .MssqlSqlDialect ;
70
+ import org .apache .calcite .sql .dialect .OracleSqlDialect ;
71
+ import org .apache .calcite .sql .dialect .PostgresqlSqlDialect ;
67
72
import org .apache .calcite .sql .validate .SqlValidatorUtil ;
68
73
import org .apache .calcite .tools .RelBuilder ;
69
74
import org .apache .calcite .tools .RelBuilderFactory ;
@@ -663,6 +668,14 @@ protected JdbcAggregateRule(Config config) {
663
668
* function. */
664
669
private static boolean canImplement (AggregateCall aggregateCall ,
665
670
SqlDialect sqlDialect ) {
671
+ if (aggregateCall .getAggregation ().getKind () == SqlKind .PERCENTILE_DISC ) {
672
+ if (sqlDialect instanceof PostgresqlSqlDialect
673
+ || sqlDialect instanceof Db2SqlDialect
674
+ || sqlDialect instanceof MssqlSqlDialect
675
+ || sqlDialect instanceof OracleSqlDialect ) {
676
+ return true ;
677
+ }
678
+ }
666
679
return sqlDialect .supportsAggregateFunction (
667
680
aggregateCall .getAggregation ().getKind ())
668
681
&& aggregateCall .distinctKeys == null ;
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ public class ApproxAggregateUtil {
56
56
"CORR" ,
57
57
"MAX" ,
58
58
"MIN" ,
59
- "MODE"
59
+ "MODE" ,
60
+ "PERCENTILE_DISC"
60
61
);
61
62
62
63
private static final List <String > scalingAggregateFuncList = Arrays .asList (
You can’t perform that action at this time.
0 commit comments