com.mapd.calcite.parser.HeavyDBSqlOperatorTable.PCAProject.PCAProject |
( |
| ) |
|
|
inline |
boolean com.mapd.calcite.parser.HeavyDBSqlOperatorTable.PCAProject.checkOperandTypes |
( |
SqlCallBinding |
callBinding, |
|
|
boolean |
throwOnFailure |
|
) |
| |
|
inline |
Definition at line 839 of file HeavyDBSqlOperatorTable.java.
845 final SqlValidator validator = callBinding.getValidator();
847 final int num_operands = callBinding.getOperandCount();
848 if (num_operands < 3) {
849 throw new IllegalArgumentException(
850 "At least 3 arguments are required, the model name, one or more features, and the nth principal component to project to.");
852 for (
int operand_idx = 0; operand_idx < num_operands; operand_idx++) {
853 final SqlNode operand = callBinding.operand(operand_idx);
854 final SqlTypeName operand_type =
855 validator.getValidatedNodeType(operand).getSqlTypeName();
856 final SqlTypeFamily operand_type_family = operand_type.getFamily();
857 if (operand_idx == 0) {
858 if (!operand.isA(EnumSet.of(SqlKind.LITERAL))
859 || operand_type_family != SqlTypeFamily.CHARACTER) {
860 throw new IllegalArgumentException(
861 "First argument must be TEXT literal denoting the model name.");
863 }
else if (operand_idx < num_operands - 1) {
864 if (operand.isA(EnumSet.of(SqlKind.LITERAL))) {
865 throw new IllegalArgumentException(
"Literals are not supported as features.");
867 if (!(operand_type_family == SqlTypeFamily.NUMERIC
868 || operand_type_family == SqlTypeFamily.CHARACTER)) {
869 throw new IllegalArgumentException(
870 "Only TEXT and NUMERIC features are supported.");
872 }
else if (!operand.isA(EnumSet.of(SqlKind.LITERAL))
873 || !(operand_type_family == SqlTypeFamily.NUMERIC)
874 || !(operand_type.equals(SqlTypeName.INTEGER))) {
875 throw new IllegalArgumentException(
876 "Last argument to PCA_PROJECT expects integer literal dimension index.");
SqlOperandCountRange com.mapd.calcite.parser.HeavyDBSqlOperatorTable.PCAProject.getOperandCountRange |
( |
| ) |
|
|
inline |
RelDataType com.mapd.calcite.parser.HeavyDBSqlOperatorTable.PCAProject.inferReturnType |
( |
SqlOperatorBinding |
opBinding | ) |
|
|
inline |
Definition at line 827 of file HeavyDBSqlOperatorTable.java.
828 final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
829 return typeFactory.createTypeWithNullability(
830 typeFactory.createSqlType(SqlTypeName.DOUBLE),
true);
The documentation for this class was generated from the following file: