abhishekrb19 commented on code in PR #14378:
URL: https://github.com/apache/druid/pull/14378#discussion_r1227348671
##########
sql/src/main/java/org/apache/druid/sql/calcite/schema/InformationSchema.java:
##########
@@ -469,6 +487,66 @@ public Object[] apply(final RelDataTypeField field)
}
}
+ static class RoutinesTable extends AbstractTable implements ScannableTable
+ {
+ private static final String FUNCTION = "FUNCTION";
+ private final DruidOperatorTable operatorTable;
+
+ public RoutinesTable(
+ DruidOperatorTable operatorTable
+ )
+ {
+ this.operatorTable = operatorTable;
+ }
+
+
+ @Override
+ public RelDataType getRowType(RelDataTypeFactory typeFactory)
+ {
+ return ROUTINES_SIGNATURE;
+ }
+
+ @Override
+ public Statistic getStatistic()
+ {
+ return Statistics.UNKNOWN;
+ }
+
+ @Override
+ public TableType getJdbcTableType()
+ {
+ return TableType.SYSTEM_TABLE;
+ }
+
+ @Override
+ public Enumerable<Object[]> scan(DataContext root)
+ {
+ final List<Object[]> rows = new ArrayList<>();
+ List<SqlOperator> operatorList = operatorTable.getOperatorList();
+
+ for (SqlOperator sqlOperator : operatorList) {
+ if (sqlOperator.getSyntax() != SqlSyntax.FUNCTION &&
Review Comment:
Yeah, good point - I was basically using the inverse of
`DruidOperatorTable#normalizeSyntax` to only consider function syntax. I've
added a static function `DruidOperatorTable#isFunctionSyntax()` that gets used
by `normalizeSyntax` and inside the routine table scan here.
Also, it seems like we don't have test coverage for `DruidOperatorTable`, so
I added a unit test class `DruidOperatorTableTest` to cover some basic
functionality including the new function added. Other existing functionality in
the class is already covered by Calcite tests indirectly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]