16 package com.mapd.calcite.parser;
18 import com.google.common.base.Predicate;
19 import com.google.common.collect.ImmutableList;
20 import com.google.common.collect.Multimap;
23 import org.apache.calcite.rel.type.RelDataType;
24 import org.apache.calcite.rel.type.RelDataTypeFactory;
25 import org.apache.calcite.rel.type.RelDataTypeFactory.FieldInfoBuilder;
26 import org.apache.calcite.schema.TranslatableTable;
27 import org.apache.calcite.sql.SqlAggFunction;
28 import org.apache.calcite.sql.SqlCallBinding;
29 import org.apache.calcite.sql.SqlFunction;
30 import org.apache.calcite.sql.SqlFunctionCategory;
31 import org.apache.calcite.sql.SqlIdentifier;
32 import org.apache.calcite.sql.SqlKind;
33 import org.apache.calcite.sql.SqlOperator;
34 import org.apache.calcite.sql.SqlOperatorBinding;
35 import org.apache.calcite.sql.SqlOperatorTable;
36 import org.apache.calcite.sql.SqlSyntax;
37 import org.apache.calcite.sql.SqlTableFunction;
38 import org.apache.calcite.sql.fun.SqlArrayValueConstructor;
39 import org.apache.calcite.sql.fun.SqlStdOperatorTable;
40 import org.apache.calcite.sql.type.OperandTypes;
41 import org.apache.calcite.sql.type.ReturnTypes;
42 import org.apache.calcite.sql.type.SqlReturnTypeInference;
43 import org.apache.calcite.sql.type.SqlTypeFamily;
44 import org.apache.calcite.sql.type.SqlTypeName;
45 import org.apache.calcite.sql.util.ChainedSqlOperatorTable;
46 import org.apache.calcite.sql.util.ListSqlOperatorTable;
47 import org.apache.calcite.sql.util.ReflectiveSqlOperatorTable;
48 import org.apache.calcite.sql.validate.SqlNameMatcher;
49 import org.apache.calcite.util.Optionality;
50 import org.slf4j.Logger;
51 import org.slf4j.LoggerFactory;
53 import java.lang.reflect.Field;
54 import java.util.HashSet;
55 import java.util.Iterator;
56 import java.util.List;
62 SqlFunctionCategory category,
64 List<SqlOperator> operatorList,
65 SqlNameMatcher nameMatcher) {
66 for (SqlOperator
operator : this.getOperatorList()) {
67 if (
operator.getSyntax() != syntax) {
70 if (!opName.isSimple()
71 || !nameMatcher.matches(operator.getName(), opName.getSimple())) {
74 SqlFunctionCategory functionCategory;
75 if (
operator instanceof SqlFunction) {
76 functionCategory = ((SqlFunction)
operator).getFunctionType();
78 functionCategory = SqlFunctionCategory.SYSTEM;
80 if (category != functionCategory
81 && category != SqlFunctionCategory.USER_DEFINED_FUNCTION) {
84 operatorList.add(
operator);
101 Field
f = ReflectiveSqlOperatorTable.class.getDeclaredField(
102 "caseSensitiveOperators");
103 f.setAccessible(
true);
104 Multimap operators = (Multimap) f.get(SqlStdOperatorTable.instance());
105 for (Iterator
i = operators.entries().iterator(); i.hasNext();) {
106 Map.Entry entry = (Map.Entry)
i.next();
107 if (entry.getValue() == SqlStdOperatorTable.APPROX_COUNT_DISTINCT
108 || entry.getValue() == SqlStdOperatorTable.AVG
109 || entry.getValue() == SqlStdOperatorTable.ARRAY_VALUE_CONSTRUCTOR) {
116 Field f = ReflectiveSqlOperatorTable.class.getDeclaredField(
117 "caseInsensitiveOperators");
118 f.setAccessible(
true);
119 Multimap operators = (Multimap) f.get(SqlStdOperatorTable.instance());
120 for (Iterator
i = operators.entries().iterator(); i.hasNext();) {
121 Map.Entry entry = (Map.Entry)
i.next();
122 if (entry.getValue() == SqlStdOperatorTable.APPROX_COUNT_DISTINCT
123 || entry.getValue() == SqlStdOperatorTable.AVG
124 || entry.getValue() == SqlStdOperatorTable.ARRAY_VALUE_CONSTRUCTOR) {
132 }
catch (Exception e) {
133 throw new RuntimeException(e);
140 final static Logger
MAPDLOGGER = LoggerFactory.getLogger(MapDSqlOperatorTable.class);
152 listOpTab = (ListSqlOperatorTable) tableList.get(1);
173 opTab.addOperator(
new Any());
174 opTab.addOperator(
new All());
175 opTab.addOperator(
new Now());
178 opTab.addOperator(
new Dateadd());
182 opTab.addOperator(
new Length());
187 opTab.addOperator(
new PgILike());
189 opTab.addOperator(
new Likely());
191 opTab.addOperator(
new Sign());
208 opTab.addOperator(
new ST_X());
209 opTab.addOperator(
new ST_Y());
210 opTab.addOperator(
new ST_XMin());
211 opTab.addOperator(
new ST_XMax());
212 opTab.addOperator(
new ST_YMin());
213 opTab.addOperator(
new ST_YMax());
219 opTab.addOperator(
new ST_Area());
222 opTab.addOperator(
new ST_SRID());
234 opTab.addOperator(
new MapDAvg());
235 opTab.addOperator(
new Sample());
248 if (extSigs == null) {
251 HashSet<String> demangledNames =
new HashSet<String>();
253 final String demangledName =
dropSuffix(extSig.getKey());
254 final String demangledNameArity =
255 String.format(
"%s-%d", demangledName, extSig.getValue().getArgs().size());
256 if (demangledNames.contains(demangledNameArity)) {
259 demangledNames.add(demangledNameArity);
260 if (extSig.getValue().isRowUdf()) {
261 opTab.addOperator(
new ExtFunction(demangledName, extSig.getValue()));
269 int suffix_idx = str.indexOf(
"__");
270 if (suffix_idx == -1) {
273 assert suffix_idx > 0;
274 return str.substring(0, suffix_idx);
278 extends SqlArrayValueConstructor {
281 RelDataTypeFactory typeFactory, List<RelDataType> argTypes) {
282 if (argTypes.isEmpty()) {
283 return typeFactory.createSqlType(SqlTypeName.NULL);
285 return super.getComponentType(typeFactory, argTypes);
290 if (callBinding.operands().isEmpty()) {
293 return super.checkOperandTypes(callBinding, throwOnFailure);
303 SqlKind.OTHER_FUNCTION,
306 OperandTypes.NUMERIC,
307 SqlFunctionCategory.USER_DEFINED_FUNCTION);
312 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
313 return typeFactory.builder().
add(
"I", SqlTypeName.INTEGER).build();
323 SqlKind.OTHER_FUNCTION,
326 OperandTypes.VARIADIC,
327 SqlFunctionCategory.USER_DEFINED_FUNCTION);
332 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
333 return typeFactory.builder().
add(
"NAME", SqlTypeName.VARCHAR, 1024).build();
344 SqlKind.OTHER_FUNCTION,
347 OperandTypes.STRING_STRING,
348 SqlFunctionCategory.SYSTEM);
353 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
354 return typeFactory.createSqlType(SqlTypeName.BIGINT);
362 SqlKind.OTHER_FUNCTION,
366 SqlFunctionCategory.SYSTEM);
371 assert opBinding.getOperandCount() == 1;
372 RelDataType elem_type = opBinding.getOperandType(0).getComponentType();
373 assert elem_type != null;
379 public static class Any extends SqlFunction {
382 SqlKind.OTHER_FUNCTION,
386 SqlFunctionCategory.SYSTEM);
391 assert opBinding.getOperandCount() == 1;
392 RelDataType elem_type = opBinding.getOperandType(0).getComponentType();
393 assert elem_type != null;
399 public static class All extends SqlFunction {
402 SqlKind.OTHER_FUNCTION,
406 SqlFunctionCategory.SYSTEM);
411 assert opBinding.getOperandCount() == 1;
412 RelDataType elem_type = opBinding.getOperandType(0).getComponentType();
413 assert elem_type != null;
419 public static class Now extends SqlFunction {
422 SqlKind.OTHER_FUNCTION,
425 OperandTypes.NILADIC,
426 SqlFunctionCategory.SYSTEM);
431 assert opBinding.getOperandCount() == 0;
432 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
433 return typeFactory.createSqlType(SqlTypeName.TIMESTAMP);
441 SqlKind.OTHER_FUNCTION,
445 SqlFunctionCategory.SYSTEM);
450 assert opBinding.getOperandCount() == 1;
451 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
452 return typeFactory.createSqlType(
453 SqlTypeName.TIMESTAMP, opBinding.getOperandType(0).getPrecision());
461 SqlKind.OTHER_FUNCTION,
464 OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.DATETIME),
465 SqlFunctionCategory.SYSTEM);
470 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
471 return typeFactory.createTypeWithNullability(
472 typeFactory.createSqlType(SqlTypeName.BIGINT),
473 opBinding.getOperandType(1).isNullable());
480 SqlKind.OTHER_FUNCTION,
483 OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.DATETIME),
484 SqlFunctionCategory.TIMEDATE);
489 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
490 return typeFactory.createTypeWithNullability(
491 typeFactory.createSqlType(SqlTypeName.BIGINT),
492 opBinding.getOperandType(1).isNullable());
496 public static class Dateadd extends SqlFunction {
499 SqlKind.OTHER_FUNCTION,
502 OperandTypes.family(SqlTypeFamily.STRING,
503 SqlTypeFamily.INTEGER,
504 SqlTypeFamily.DATETIME),
505 SqlFunctionCategory.TIMEDATE);
510 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
511 return typeFactory.createTypeWithNullability(
512 typeFactory.createSqlType(
513 SqlTypeName.TIMESTAMP, opBinding.getOperandType(2).getPrecision()),
514 opBinding.getOperandType(2).isNullable());
521 SqlKind.OTHER_FUNCTION,
524 OperandTypes.family(SqlTypeFamily.STRING,
525 SqlTypeFamily.DATETIME,
526 SqlTypeFamily.DATETIME),
527 SqlFunctionCategory.TIMEDATE);
532 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
533 return typeFactory.createTypeWithNullability(
534 typeFactory.createSqlType(SqlTypeName.BIGINT),
535 opBinding.getOperandType(1).isNullable()
536 || opBinding.getOperandType(2).isNullable());
543 super(
"PG_DATE_TRUNC",
544 SqlKind.OTHER_FUNCTION,
547 OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.DATETIME),
548 SqlFunctionCategory.SYSTEM);
553 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
554 return typeFactory.createTypeWithNullability(
555 typeFactory.createSqlType(
556 SqlTypeName.TIMESTAMP, opBinding.getOperandType(1).getPrecision()),
557 opBinding.getOperandType(1).isNullable());
561 public static class Length extends SqlFunction {
564 SqlKind.OTHER_FUNCTION,
568 SqlFunctionCategory.SYSTEM);
573 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
574 return typeFactory.createSqlType(SqlTypeName.INTEGER);
581 SqlKind.OTHER_FUNCTION,
585 SqlFunctionCategory.SYSTEM);
590 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
591 return typeFactory.createSqlType(SqlTypeName.INTEGER);
597 super(
"KEY_FOR_STRING",
598 SqlKind.OTHER_FUNCTION,
602 SqlFunctionCategory.SYSTEM);
607 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
608 return typeFactory.createTypeWithNullability(
609 typeFactory.createSqlType(SqlTypeName.INTEGER),
610 opBinding.getOperandType(0).isNullable());
616 super(
"SAMPLE_RATIO",
617 SqlKind.OTHER_FUNCTION,
621 SqlFunctionCategory.SYSTEM);
626 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
627 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
630 private static java.util.List<SqlTypeFamily>
signature() {
631 java.util.ArrayList<SqlTypeFamily> families =
632 new java.util.ArrayList<SqlTypeFamily>();
633 families.add(SqlTypeFamily.NUMERIC);
640 super(
"ARRAY_LENGTH",
641 SqlKind.OTHER_FUNCTION,
645 SqlFunctionCategory.SYSTEM);
650 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
651 return typeFactory.createSqlType(SqlTypeName.INTEGER);
655 public static class PgILike extends SqlFunction {
658 SqlKind.OTHER_FUNCTION,
662 SqlFunctionCategory.SYSTEM);
666 java.util.ArrayList<SqlTypeFamily> families =
667 new java.util.ArrayList<SqlTypeFamily>();
675 implements java.util.function.Predicate<Integer>, Predicate<Integer> {
689 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
690 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
697 SqlKind.OTHER_FUNCTION,
701 SqlFunctionCategory.SYSTEM);
705 java.util.ArrayList<SqlTypeFamily> families =
706 new java.util.ArrayList<SqlTypeFamily>();
714 implements java.util.function.Predicate<Integer>, Predicate<Integer> {
727 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
728 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
732 public static class Likely extends SqlFunction {
735 SqlKind.OTHER_FUNCTION,
738 OperandTypes.BOOLEAN,
739 SqlFunctionCategory.SYSTEM);
744 return opBinding.getOperandType(0);
751 SqlKind.OTHER_FUNCTION,
754 OperandTypes.BOOLEAN,
755 SqlFunctionCategory.SYSTEM);
760 return opBinding.getOperandType(0);
764 public static class Sign extends SqlFunction {
767 SqlKind.OTHER_FUNCTION,
770 OperandTypes.NUMERIC,
771 SqlFunctionCategory.NUMERIC);
776 return opBinding.getOperandType(0);
783 SqlKind.OTHER_FUNCTION,
787 SqlFunctionCategory.NUMERIC);
792 assert opBinding.getOperandCount() == 2;
793 return opBinding.getOperandType(0);
796 private static java.util.List<SqlTypeFamily>
signature() {
797 java.util.List<SqlTypeFamily> truncate_sig =
798 new java.util.ArrayList<SqlTypeFamily>();
799 truncate_sig.add(SqlTypeFamily.NUMERIC);
800 truncate_sig.add(SqlTypeFamily.INTEGER);
808 SqlKind.OTHER_FUNCTION,
812 SqlFunctionCategory.SYSTEM);
817 assert opBinding.getOperandCount() == 1;
818 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
819 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
822 private static java.util.List<SqlTypeFamily>
signature() {
823 java.util.List<SqlTypeFamily> st_isempty_sig =
824 new java.util.ArrayList<SqlTypeFamily>();
825 st_isempty_sig.add(SqlTypeFamily.ANY);
826 return st_isempty_sig;
833 SqlKind.OTHER_FUNCTION,
837 SqlFunctionCategory.SYSTEM);
842 assert opBinding.getOperandCount() == 1;
843 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
844 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
847 private static java.util.List<SqlTypeFamily>
signature() {
848 java.util.List<SqlTypeFamily> st_isvalid_sig =
849 new java.util.ArrayList<SqlTypeFamily>();
850 st_isvalid_sig.add(SqlTypeFamily.ANY);
851 return st_isvalid_sig;
858 SqlKind.OTHER_FUNCTION,
862 SqlFunctionCategory.SYSTEM);
867 assert opBinding.getOperandCount() == 2;
868 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
869 return typeFactory.createTypeWithNullability(
870 typeFactory.createSqlType(SqlTypeName.BOOLEAN),
871 opBinding.getOperandType(0).isNullable()
872 || opBinding.getOperandType(1).isNullable());
875 private static java.util.List<SqlTypeFamily>
signature() {
876 java.util.List<SqlTypeFamily> st_contains_sig =
877 new java.util.ArrayList<SqlTypeFamily>();
878 st_contains_sig.add(SqlTypeFamily.ANY);
879 st_contains_sig.add(SqlTypeFamily.ANY);
880 return st_contains_sig;
886 super(
"ST_Intersects",
887 SqlKind.OTHER_FUNCTION,
891 SqlFunctionCategory.SYSTEM);
896 assert opBinding.getOperandCount() == 2;
897 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
898 return typeFactory.createTypeWithNullability(
899 typeFactory.createSqlType(SqlTypeName.BOOLEAN),
900 opBinding.getOperandType(0).isNullable()
901 || opBinding.getOperandType(1).isNullable());
904 private static java.util.List<SqlTypeFamily>
signature() {
905 java.util.List<SqlTypeFamily> st_intersects_sig =
906 new java.util.ArrayList<SqlTypeFamily>();
907 st_intersects_sig.add(SqlTypeFamily.ANY);
908 st_intersects_sig.add(SqlTypeFamily.ANY);
909 return st_intersects_sig;
916 SqlKind.OTHER_FUNCTION,
920 SqlFunctionCategory.SYSTEM);
925 assert opBinding.getOperandCount() == 2;
926 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
927 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
930 private static java.util.List<SqlTypeFamily>
signature() {
931 java.util.List<SqlTypeFamily> st_overlaps_sig =
932 new java.util.ArrayList<SqlTypeFamily>();
933 st_overlaps_sig.add(SqlTypeFamily.ANY);
934 st_overlaps_sig.add(SqlTypeFamily.ANY);
935 return st_overlaps_sig;
941 super(
"ST_Approx_Overlaps",
942 SqlKind.OTHER_FUNCTION,
946 SqlFunctionCategory.SYSTEM);
951 assert opBinding.getOperandCount() == 2;
952 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
953 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
956 private static java.util.List<SqlTypeFamily>
signature() {
957 java.util.List<SqlTypeFamily> st_overlaps_sig =
958 new java.util.ArrayList<SqlTypeFamily>();
959 st_overlaps_sig.add(SqlTypeFamily.ANY);
960 st_overlaps_sig.add(SqlTypeFamily.ANY);
961 return st_overlaps_sig;
968 SqlKind.OTHER_FUNCTION,
972 SqlFunctionCategory.SYSTEM);
977 assert opBinding.getOperandCount() == 2;
978 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
979 return typeFactory.createTypeWithNullability(
980 typeFactory.createSqlType(SqlTypeName.BOOLEAN),
981 opBinding.getOperandType(0).isNullable()
982 || opBinding.getOperandType(1).isNullable());
985 private static java.util.List<SqlTypeFamily>
signature() {
986 java.util.List<SqlTypeFamily> st_disjoint_sig =
987 new java.util.ArrayList<SqlTypeFamily>();
988 st_disjoint_sig.add(SqlTypeFamily.ANY);
989 st_disjoint_sig.add(SqlTypeFamily.ANY);
990 return st_disjoint_sig;
997 SqlKind.OTHER_FUNCTION,
1001 SqlFunctionCategory.SYSTEM);
1006 assert opBinding.getOperandCount() == 2;
1007 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1008 return typeFactory.createTypeWithNullability(
1009 typeFactory.createSqlType(SqlTypeName.BOOLEAN),
1010 opBinding.getOperandType(0).isNullable()
1011 || opBinding.getOperandType(1).isNullable());
1015 java.util.List<SqlTypeFamily> st_within_sig =
1016 new java.util.ArrayList<SqlTypeFamily>();
1017 st_within_sig.add(SqlTypeFamily.ANY);
1018 st_within_sig.add(SqlTypeFamily.ANY);
1019 return st_within_sig;
1026 SqlKind.OTHER_FUNCTION,
1030 SqlFunctionCategory.SYSTEM);
1035 assert opBinding.getOperandCount() == 3;
1036 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1037 return typeFactory.createTypeWithNullability(
1038 typeFactory.createSqlType(SqlTypeName.BOOLEAN),
1039 opBinding.getOperandType(0).isNullable()
1040 || opBinding.getOperandType(1).isNullable()
1041 || opBinding.getOperandType(2).isNullable());
1045 java.util.List<SqlTypeFamily> st_dwithin_sig =
1046 new java.util.ArrayList<SqlTypeFamily>();
1047 st_dwithin_sig.add(SqlTypeFamily.ANY);
1048 st_dwithin_sig.add(SqlTypeFamily.ANY);
1049 st_dwithin_sig.add(SqlTypeFamily.NUMERIC);
1050 return st_dwithin_sig;
1056 super(
"ST_DFullyWithin",
1057 SqlKind.OTHER_FUNCTION,
1061 SqlFunctionCategory.SYSTEM);
1066 assert opBinding.getOperandCount() == 3;
1067 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1068 return typeFactory.createTypeWithNullability(
1069 typeFactory.createSqlType(SqlTypeName.BOOLEAN),
1070 opBinding.getOperandType(0).isNullable()
1071 || opBinding.getOperandType(1).isNullable()
1072 || opBinding.getOperandType(2).isNullable());
1076 java.util.List<SqlTypeFamily> st_dwithin_sig =
1077 new java.util.ArrayList<SqlTypeFamily>();
1078 st_dwithin_sig.add(SqlTypeFamily.ANY);
1079 st_dwithin_sig.add(SqlTypeFamily.ANY);
1080 st_dwithin_sig.add(SqlTypeFamily.NUMERIC);
1081 return st_dwithin_sig;
1087 super(
"ST_Distance",
1088 SqlKind.OTHER_FUNCTION,
1092 SqlFunctionCategory.SYSTEM);
1097 assert opBinding.getOperandCount() == 2;
1098 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1099 return typeFactory.createTypeWithNullability(
1100 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1101 opBinding.getOperandType(0).isNullable()
1102 || opBinding.getOperandType(1).isNullable());
1106 java.util.List<SqlTypeFamily> st_distance_sig =
1107 new java.util.ArrayList<SqlTypeFamily>();
1108 st_distance_sig.add(SqlTypeFamily.ANY);
1109 st_distance_sig.add(SqlTypeFamily.ANY);
1110 return st_distance_sig;
1116 super(
"ST_MaxDistance",
1117 SqlKind.OTHER_FUNCTION,
1121 SqlFunctionCategory.SYSTEM);
1126 assert opBinding.getOperandCount() == 2;
1127 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1128 return typeFactory.createTypeWithNullability(
1129 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1130 opBinding.getOperandType(0).isNullable()
1131 || opBinding.getOperandType(1).isNullable());
1135 java.util.List<SqlTypeFamily> st_maxdistance_sig =
1136 new java.util.ArrayList<SqlTypeFamily>();
1137 st_maxdistance_sig.add(SqlTypeFamily.ANY);
1138 st_maxdistance_sig.add(SqlTypeFamily.ANY);
1139 return st_maxdistance_sig;
1145 super(
"ST_GeogFromText",
1146 SqlKind.OTHER_FUNCTION,
1149 OperandTypes.or(OperandTypes.family(SqlTypeFamily.ANY),
1150 OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER)),
1151 SqlFunctionCategory.SYSTEM);
1156 assert opBinding.getOperandCount() == 1;
1157 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1158 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1164 super(
"ST_GeomFromText",
1165 SqlKind.OTHER_FUNCTION,
1168 OperandTypes.or(OperandTypes.family(SqlTypeFamily.ANY),
1169 OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER)),
1170 SqlFunctionCategory.SYSTEM);
1175 assert opBinding.getOperandCount() == 1;
1176 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1177 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1183 super(
"ST_Transform",
1184 SqlKind.OTHER_FUNCTION,
1187 OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER),
1188 SqlFunctionCategory.SYSTEM);
1193 assert opBinding.getOperandCount() == 1;
1194 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1195 return typeFactory.createTypeWithNullability(
1196 typeFactory.createSqlType(SqlTypeName.INTEGER),
1197 opBinding.getOperandType(0).isNullable());
1201 static class ST_X extends SqlFunction {
1204 SqlKind.OTHER_FUNCTION,
1207 OperandTypes.family(SqlTypeFamily.ANY),
1208 SqlFunctionCategory.SYSTEM);
1213 assert opBinding.getOperandCount() == 1;
1214 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1215 return typeFactory.createTypeWithNullability(
1216 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1217 opBinding.getOperandType(0).isNullable());
1221 static class ST_Y extends SqlFunction {
1224 SqlKind.OTHER_FUNCTION,
1227 OperandTypes.family(SqlTypeFamily.ANY),
1228 SqlFunctionCategory.SYSTEM);
1233 assert opBinding.getOperandCount() == 1;
1234 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1235 return typeFactory.createTypeWithNullability(
1236 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1237 opBinding.getOperandType(0).isNullable());
1244 SqlKind.OTHER_FUNCTION,
1247 OperandTypes.family(SqlTypeFamily.ANY),
1248 SqlFunctionCategory.SYSTEM);
1253 assert opBinding.getOperandCount() == 1;
1254 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1255 return typeFactory.createTypeWithNullability(
1256 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1257 opBinding.getOperandType(0).isNullable());
1264 SqlKind.OTHER_FUNCTION,
1267 OperandTypes.family(SqlTypeFamily.ANY),
1268 SqlFunctionCategory.SYSTEM);
1273 assert opBinding.getOperandCount() == 1;
1274 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1275 return typeFactory.createTypeWithNullability(
1276 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1277 opBinding.getOperandType(0).isNullable());
1284 SqlKind.OTHER_FUNCTION,
1287 OperandTypes.family(SqlTypeFamily.ANY),
1288 SqlFunctionCategory.SYSTEM);
1293 assert opBinding.getOperandCount() == 1;
1294 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1295 return typeFactory.createTypeWithNullability(
1296 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1297 opBinding.getOperandType(0).isNullable());
1304 SqlKind.OTHER_FUNCTION,
1307 OperandTypes.family(SqlTypeFamily.ANY),
1308 SqlFunctionCategory.SYSTEM);
1313 assert opBinding.getOperandCount() == 1;
1314 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1315 return typeFactory.createTypeWithNullability(
1316 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1317 opBinding.getOperandType(0).isNullable());
1324 SqlKind.OTHER_FUNCTION,
1327 OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER),
1328 SqlFunctionCategory.SYSTEM);
1333 assert opBinding.getOperandCount() == 1;
1334 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1335 return typeFactory.createTypeWithNullability(
1336 typeFactory.createSqlType(SqlTypeName.INTEGER),
1337 opBinding.getOperandType(0).isNullable());
1343 super(
"ST_EndPoint",
1344 SqlKind.OTHER_FUNCTION,
1347 OperandTypes.family(SqlTypeFamily.ANY),
1348 SqlFunctionCategory.SYSTEM);
1353 assert opBinding.getOperandCount() == 1;
1354 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1355 return typeFactory.createTypeWithNullability(
1356 typeFactory.createSqlType(SqlTypeName.INTEGER),
1357 opBinding.getOperandType(0).isNullable());
1363 super(
"ST_StartPoint",
1364 SqlKind.OTHER_FUNCTION,
1367 OperandTypes.family(SqlTypeFamily.ANY),
1368 SqlFunctionCategory.SYSTEM);
1373 assert opBinding.getOperandCount() == 1;
1374 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1375 return typeFactory.createTypeWithNullability(
1376 typeFactory.createSqlType(SqlTypeName.INTEGER),
1377 opBinding.getOperandType(0).isNullable());
1384 SqlKind.OTHER_FUNCTION,
1387 OperandTypes.family(SqlTypeFamily.ANY),
1388 SqlFunctionCategory.SYSTEM);
1393 assert opBinding.getOperandCount() == 1;
1394 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1395 return typeFactory.createTypeWithNullability(
1396 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1397 opBinding.getOperandType(0).isNullable());
1403 super(
"ST_Perimeter",
1404 SqlKind.OTHER_FUNCTION,
1407 OperandTypes.family(SqlTypeFamily.ANY),
1408 SqlFunctionCategory.SYSTEM);
1413 assert opBinding.getOperandCount() == 1;
1414 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1415 return typeFactory.createTypeWithNullability(
1416 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1417 opBinding.getOperandType(0).isNullable());
1424 SqlKind.OTHER_FUNCTION,
1427 OperandTypes.family(SqlTypeFamily.ANY),
1428 SqlFunctionCategory.SYSTEM);
1433 assert opBinding.getOperandCount() == 1;
1434 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1435 return typeFactory.createTypeWithNullability(
1436 typeFactory.createSqlType(SqlTypeName.DOUBLE),
1437 opBinding.getOperandType(0).isNullable());
1444 SqlKind.OTHER_FUNCTION,
1447 OperandTypes.family(SqlTypeFamily.ANY),
1448 SqlFunctionCategory.SYSTEM);
1453 assert opBinding.getOperandCount() == 1;
1454 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1455 return typeFactory.createTypeWithNullability(
1456 typeFactory.createSqlType(SqlTypeName.INTEGER),
1457 opBinding.getOperandType(0).isNullable());
1464 SqlKind.OTHER_FUNCTION,
1467 OperandTypes.family(SqlTypeFamily.ANY),
1468 SqlFunctionCategory.SYSTEM);
1473 assert opBinding.getOperandCount() == 1;
1474 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1475 return typeFactory.createTypeWithNullability(
1476 typeFactory.createSqlType(SqlTypeName.INTEGER),
1477 opBinding.getOperandType(0).isNullable());
1484 SqlKind.OTHER_FUNCTION,
1487 OperandTypes.family(SqlTypeFamily.ANY),
1488 SqlFunctionCategory.SYSTEM);
1493 assert opBinding.getOperandCount() == 1;
1494 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1495 return typeFactory.createTypeWithNullability(
1496 typeFactory.createSqlType(SqlTypeName.INTEGER),
1497 opBinding.getOperandType(0).isNullable());
1504 SqlKind.OTHER_FUNCTION,
1507 OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER),
1508 SqlFunctionCategory.SYSTEM);
1513 assert opBinding.getOperandCount() == 1;
1514 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1515 return typeFactory.createTypeWithNullability(
1516 typeFactory.createSqlType(SqlTypeName.INTEGER),
1517 opBinding.getOperandType(0).isNullable());
1524 SqlKind.OTHER_FUNCTION,
1527 OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
1528 SqlFunctionCategory.SYSTEM);
1533 assert opBinding.getOperandCount() == 2;
1534 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1535 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1541 super(
"ST_Centroid",
1542 SqlKind.OTHER_FUNCTION,
1546 SqlFunctionCategory.SYSTEM);
1551 assert opBinding.getOperandCount() == 1;
1552 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1553 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1557 java.util.List<SqlTypeFamily> st_centroid_sig =
1558 new java.util.ArrayList<SqlTypeFamily>();
1559 st_centroid_sig.add(SqlTypeFamily.ANY);
1560 return st_centroid_sig;
1567 SqlKind.OTHER_FUNCTION,
1571 SqlFunctionCategory.SYSTEM);
1576 assert opBinding.getOperandCount() == 2;
1577 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1578 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1582 java.util.List<SqlTypeFamily> st_buffer_sig =
1583 new java.util.ArrayList<SqlTypeFamily>();
1584 st_buffer_sig.add(SqlTypeFamily.ANY);
1585 st_buffer_sig.add(SqlTypeFamily.NUMERIC);
1586 return st_buffer_sig;
1592 super(
"ST_Intersection",
1593 SqlKind.OTHER_FUNCTION,
1597 SqlFunctionCategory.SYSTEM);
1602 assert opBinding.getOperandCount() == 2;
1603 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1604 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1608 java.util.List<SqlTypeFamily> st_intersection_sig =
1609 new java.util.ArrayList<SqlTypeFamily>();
1610 st_intersection_sig.add(SqlTypeFamily.ANY);
1611 st_intersection_sig.add(SqlTypeFamily.ANY);
1612 return st_intersection_sig;
1619 SqlKind.OTHER_FUNCTION,
1623 SqlFunctionCategory.SYSTEM);
1628 assert opBinding.getOperandCount() == 2;
1629 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1630 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1634 java.util.List<SqlTypeFamily> st_union_sig =
1635 new java.util.ArrayList<SqlTypeFamily>();
1636 st_union_sig.add(SqlTypeFamily.ANY);
1637 st_union_sig.add(SqlTypeFamily.ANY);
1638 return st_union_sig;
1644 super(
"ST_Difference",
1645 SqlKind.OTHER_FUNCTION,
1649 SqlFunctionCategory.SYSTEM);
1654 assert opBinding.getOperandCount() == 2;
1655 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1656 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1660 java.util.List<SqlTypeFamily> st_difference_sig =
1661 new java.util.ArrayList<SqlTypeFamily>();
1662 st_difference_sig.add(SqlTypeFamily.ANY);
1663 st_difference_sig.add(SqlTypeFamily.ANY);
1664 return st_difference_sig;
1670 super(
"CastToGeography",
1671 SqlKind.OTHER_FUNCTION,
1674 OperandTypes.family(SqlTypeFamily.ANY),
1675 SqlFunctionCategory.SYSTEM);
1680 assert opBinding.getOperandCount() == 1;
1681 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1682 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1689 super(
"OFFSET_IN_FRAGMENT",
1690 SqlKind.OTHER_FUNCTION,
1693 OperandTypes.NILADIC,
1694 SqlFunctionCategory.SYSTEM);
1699 assert opBinding.getOperandCount() == 0;
1700 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1701 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1707 super(
"APPROX_COUNT_DISTINCT",
1709 SqlKind.OTHER_FUNCTION,
1712 OperandTypes.or(OperandTypes.family(SqlTypeFamily.ANY),
1713 OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER)),
1714 SqlFunctionCategory.SYSTEM,
1717 Optionality.FORBIDDEN);
1722 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1723 return typeFactory.createSqlType(SqlTypeName.BIGINT);
1729 super(
"APPROX_MEDIAN",
1731 SqlKind.OTHER_FUNCTION,
1734 OperandTypes.family(SqlTypeFamily.NUMERIC),
1735 SqlFunctionCategory.SYSTEM,
1738 Optionality.FORBIDDEN);
1743 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1744 return typeFactory.createSqlType(SqlTypeName.DOUBLE);
1752 SqlKind.OTHER_FUNCTION,
1755 OperandTypes.family(SqlTypeFamily.NUMERIC),
1756 SqlFunctionCategory.SYSTEM);
1761 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1762 return typeFactory.createSqlType(SqlTypeName.DOUBLE);
1766 public static class Sample extends SqlAggFunction {
1770 SqlKind.OTHER_FUNCTION,
1774 SqlFunctionCategory.SYSTEM,
1777 Optionality.FORBIDDEN);
1782 return opBinding.getOperandType(0);
1789 super(
"LAST_SAMPLE",
1791 SqlKind.OTHER_FUNCTION,
1795 SqlFunctionCategory.SYSTEM,
1798 Optionality.FORBIDDEN);
1803 return opBinding.getOperandType(0);
1810 SqlKind.OTHER_FUNCTION,
1814 SqlFunctionCategory.SYSTEM);
1815 ret = sig.getSqlRet();
1820 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1821 return typeFactory.createTypeWithNullability(typeFactory.createSqlType(
ret),
true);
1824 private final SqlTypeName
ret;
1830 SqlKind.OTHER_FUNCTION,
1834 SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION);
1835 outs = sig.getSqlOuts();
1840 return opBinding -> {
1841 FieldInfoBuilder ret = opBinding.getTypeFactory().builder();
1842 for (
int out_idx = 0; out_idx < outs.size(); ++out_idx) {
1843 ret = ret.add(
"OUT" + out_idx, outs.get(out_idx));
1849 private final List<SqlTypeName>
outs;
1861 super(
"MapD_GeoPolyBoundsPtr",
1862 SqlKind.OTHER_FUNCTION,
1865 OperandTypes.family(SqlTypeFamily.ANY),
1866 SqlFunctionCategory.SYSTEM);
1871 assert opBinding.getOperandCount() == 1;
1872 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1873 return typeFactory.createSqlType(SqlTypeName.BIGINT);
1879 super(
"MapD_GeoPolyRenderGroup",
1880 SqlKind.OTHER_FUNCTION,
1883 OperandTypes.family(SqlTypeFamily.ANY),
1884 SqlFunctionCategory.SYSTEM);
1889 assert opBinding.getOperandCount() == 1;
1890 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1891 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1897 super(
"OmniSci_Geo_PolyBoundsPtr",
1898 SqlKind.OTHER_FUNCTION,
1901 OperandTypes.family(SqlTypeFamily.ANY),
1902 SqlFunctionCategory.SYSTEM);
1907 assert opBinding.getOperandCount() == 1;
1908 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1909 return typeFactory.createSqlType(SqlTypeName.BIGINT);
1915 super(
"OmniSci_Geo_PolyRenderGroup",
1916 SqlKind.OTHER_FUNCTION,
1919 OperandTypes.family(SqlTypeFamily.ANY),
1920 SqlFunctionCategory.SYSTEM);
1925 assert opBinding.getOperandCount() == 1;
1926 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1927 return typeFactory.createSqlType(SqlTypeName.INTEGER);
1933 super(
"convert_meters_to_pixel_width",
1934 SqlKind.OTHER_FUNCTION,
1937 OperandTypes.family(SqlTypeFamily.NUMERIC,
1939 SqlTypeFamily.NUMERIC,
1940 SqlTypeFamily.NUMERIC,
1941 SqlTypeFamily.NUMERIC,
1942 SqlTypeFamily.NUMERIC),
1943 SqlFunctionCategory.SYSTEM);
1948 assert opBinding.getOperandCount() == 6;
1949 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1950 return typeFactory.createSqlType(SqlTypeName.DOUBLE);
1956 super(
"convert_meters_to_pixel_height",
1957 SqlKind.OTHER_FUNCTION,
1960 OperandTypes.family(SqlTypeFamily.NUMERIC,
1962 SqlTypeFamily.NUMERIC,
1963 SqlTypeFamily.NUMERIC,
1964 SqlTypeFamily.NUMERIC,
1965 SqlTypeFamily.NUMERIC),
1966 SqlFunctionCategory.SYSTEM);
1971 assert opBinding.getOperandCount() == 6;
1972 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1973 return typeFactory.createSqlType(SqlTypeName.DOUBLE);
1979 super(
"is_point_in_view",
1980 SqlKind.OTHER_FUNCTION,
1983 OperandTypes.family(SqlTypeFamily.ANY,
1984 SqlTypeFamily.NUMERIC,
1985 SqlTypeFamily.NUMERIC,
1986 SqlTypeFamily.NUMERIC,
1987 SqlTypeFamily.NUMERIC),
1988 SqlFunctionCategory.SYSTEM);
1993 assert opBinding.getOperandCount() == 5;
1994 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
1995 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
2001 super(
"is_point_size_in_view",
2002 SqlKind.OTHER_FUNCTION,
2005 OperandTypes.family(SqlTypeFamily.ANY,
2006 SqlTypeFamily.NUMERIC,
2007 SqlTypeFamily.NUMERIC,
2008 SqlTypeFamily.NUMERIC,
2009 SqlTypeFamily.NUMERIC,
2010 SqlTypeFamily.NUMERIC),
2011 SqlFunctionCategory.SYSTEM);
2016 assert opBinding.getOperandCount() == 6;
2017 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
2018 return typeFactory.createSqlType(SqlTypeName.BOOLEAN);
2024 super(
"usTIMESTAMP",
2025 SqlKind.OTHER_FUNCTION,
2028 OperandTypes.STRING,
2029 SqlFunctionCategory.SYSTEM);
2034 assert opBinding.getOperandCount() == 1;
2035 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
2036 return typeFactory.createSqlType(SqlTypeName.TIMESTAMP, 6);
2042 super(
"nsTIMESTAMP",
2043 SqlKind.OTHER_FUNCTION,
2046 OperandTypes.STRING,
2047 SqlFunctionCategory.SYSTEM);
2052 assert opBinding.getOperandCount() == 1;
2053 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
2054 return typeFactory.createSqlType(SqlTypeName.TIMESTAMP, 9);
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
EXTENSION_NOINLINE double convert_meters_to_pixel_width(const double meters, int8_t *p, const int64_t psize, const int32_t ic, const int32_t isr, const int32_t osr, const double min_lon, const double max_lon, const int32_t img_width, const double min_width)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
final java.util.List< SqlTypeFamily > toSqlSignature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static final Logger MAPDLOGGER
ExtFunction(final String name, final ExtensionFunction sig)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
final ListSqlOperatorTable listOpTab
static java.util.List< SqlTypeFamily > signature()
EXTENSION_INLINE int32_t OmniSci_Geo_PolyRenderGroup(int32_t render_group)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_NOINLINE double ST_XMax(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
SqlReturnTypeInference getRowTypeInference()
static java.util.List< SqlTypeFamily > getSignatureFamilies()
EXTENSION_NOINLINE bool is_point_size_in_view(int8_t *p, const int64_t psize, const int32_t ic, const double meters, const double min_lon, const double max_lon, const double min_lat, const double max_lat)
EXTENSION_NOINLINE double ST_YMax(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
static String dropSuffix(final String str)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
convert_meters_to_pixel_height()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_NOINLINE double ST_XMin(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
static java.util.List< SqlTypeFamily > getSignatureFamilies()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_NOINLINE double convert_meters_to_pixel_height(const double meters, int8_t *p, const int64_t psize, const int32_t ic, const int32_t isr, const int32_t osr, const double min_lat, const double max_lat, const int32_t img_height, const double min_height)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_INLINE int32_t MapD_GeoPolyRenderGroup(int32_t render_group)
EXTENSION_INLINE int64_t OmniSci_Geo_PolyBoundsPtr(double *bounds, int64_t size)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static final SqlArrayValueConstructorAllowingEmpty ARRAY_VALUE_CONSTRUCTOR
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
EXTENSION_NOINLINE double ST_YMin(int8_t *coords, int64_t size, int32_t ic, int32_t isr, int32_t osr)
ExtTableFunction(final String name, final ExtensionFunction sig)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_INLINE int64_t MapD_GeoPolyBoundsPtr(double *bounds, int64_t size)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
static java.util.List< SqlTypeFamily > signature()
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
void addOperator(SqlOperator op)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_NOINLINE bool is_point_in_view(int8_t *p, const int64_t psize, const int32_t ic, const double min_lon, const double max_lon, const double min_lat, const double max_lat)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
convert_meters_to_pixel_width()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure)
RelDataType getComponentType(RelDataTypeFactory typeFactory, List< RelDataType > argTypes)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
final List< SqlTypeName > outs
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
OmniSci_Geo_PolyBoundsPtr()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_INLINE int32_t ST_NRings(int32_t *poly_ring_sizes, int64_t poly_num_rings)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
MapDSqlOperatorTable(SqlOperatorTable parentTable)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
MapD_GeoPolyRenderGroup()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
EXTENSION_NOINLINE double Truncate(const double x, const int32_t y)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static void addUDF(MapDSqlOperatorTable opTab, final Map< String, ExtensionFunction > extSigs)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
static java.util.List< SqlTypeFamily > signature()
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
OmniSci_Geo_PolyRenderGroup()
EXTENSION_INLINE int32_t ST_NPoints(int8_t *coords, int64_t coords_sz, int32_t ic)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
void lookupOperatorOverloads(SqlIdentifier opName, SqlFunctionCategory category, SqlSyntax syntax, List< SqlOperator > operatorList, SqlNameMatcher nameMatcher)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)
RelDataType inferReturnType(SqlOperatorBinding opBinding)