@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { RelDataTypeFactory factory = validator.getTypeFactory(); return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.ANY), true); }
public ParseResult(CalcitePrepareImpl prepare, SqlValidator validator, String sql, SqlNode sqlNode, RelDataType rowType) { super(); this.prepare = prepare; this.sql = sql; this.sqlNode = sqlNode; this.rowType = rowType; this.typeFactory = validator.getTypeFactory(); }
public ParseResult(CalcitePrepareImpl prepare, SqlValidator validator, String sql, SqlNode sqlNode, RelDataType rowType) { super(); this.prepare = prepare; this.sql = sql; this.sqlNode = sqlNode; this.rowType = rowType; this.typeFactory = validator.getTypeFactory(); }
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { return getAny(validator.getTypeFactory()); }
/** * Creates a call binding. * * @param validator Validator * @param scope Scope of call * @param call Call node */ public SqlCallBinding( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { super( validator.getTypeFactory(), call.getOperator()); this.validator = validator; this.scope = scope; this.call = call; }
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { if (NONE.equals(returnType)) { return validator.getTypeFactory().createSqlType(SqlTypeName.ANY); } /* * We return a nullable output type both in validation phase and in * Sql to Rel phase. We don't know the type of the output until runtime * hence have to choose the least restrictive type to avoid any wrong * results. */ return getNullableReturnDataType(validator.getTypeFactory()); }
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { if (NONE.equals(returnType)) { return validator.getTypeFactory().createSqlType(SqlTypeName.ANY); } /* * We return a nullable output type both in validation phase and in * Sql to Rel phase. We don't know the type of the output until runtime * hence have to choose the least restrictive type to avoid any wrong * results. */ return getNullableReturnDataType(validator.getTypeFactory()); }
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { RelDataTypeFactory factory = validator.getTypeFactory(); return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.ANY), true); }
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { final RelDataTypeFactory typeFactory = validator.getTypeFactory(); return typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BIGINT), false); }
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { final RelDataTypeFactory typeFactory = validator.getTypeFactory(); return typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BIGINT), false); }
public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType( SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); }
public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType( SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); }
/** The row type of the found namespace, nullable if the lookup has * looked into outer joins. */ public RelDataType rowType() { return namespace.getValidator().getTypeFactory() .createTypeWithNullability(namespace.getRowType(), nullable); } }
/** The row type of the found namespace, nullable if the lookup has * looked into outer joins. */ public RelDataType rowType() { return namespace.getValidator().getTypeFactory() .createTypeWithNullability(namespace.getRowType(), nullable); } }
public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { SqlSelect subSelect = call.operand(0); subSelect.validateExpr(validator, scope); SqlValidatorNamespace ns = validator.getNamespace(subSelect); assert null != ns.getRowType(); return SqlTypeUtil.createMultisetType( validator.getTypeFactory(), ns.getRowType(), false); }
public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { SqlSelect subSelect = call.operand(0); subSelect.validateExpr(validator, scope); SqlValidatorNamespace ns = validator.getNamespace(subSelect); assert null != ns.getRowType(); return SqlTypeUtil.createMultisetType( validator.getTypeFactory(), ns.getRowType(), false); }
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType(SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); } }
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { // Check for COUNT(*) function. If it is we don't // want to try and derive the "*" if (call.isCountStar()) { return validator.getTypeFactory().createSqlType(SqlTypeName.BIGINT); } return super.deriveType(validator, scope, call); } }
@Test public void testTimestampAddFractionalSeconds() { tester.setFor(SqlStdOperatorTable.TIMESTAMP_ADD); tester.checkType( "timestampadd(SQL_TSI_FRAC_SECOND, 2, timestamp '2016-02-24 12:42:25.000000')", // "2016-02-24 12:42:25.000002", "TIMESTAMP(3) NOT NULL"); // The following test would correctly return "TIMESTAMP(6) NOT NULL" if max // precision were 6 or higher assumeTrue(tester.getValidator().getTypeFactory().getTypeSystem() .getMaxPrecision(SqlTypeName.TIMESTAMP) == 3); tester.checkType( "timestampadd(MICROSECOND, 2, timestamp '2016-02-24 12:42:25.000000')", // "2016-02-24 12:42:25.000002", "TIMESTAMP(3) NOT NULL"); }
@Test public void testTimestampAddFractionalSeconds() { tester.setFor(SqlStdOperatorTable.TIMESTAMP_ADD); tester.checkType( "timestampadd(SQL_TSI_FRAC_SECOND, 2, timestamp '2016-02-24 12:42:25.000000')", // "2016-02-24 12:42:25.000002", "TIMESTAMP(3) NOT NULL"); // The following test would correctly return "TIMESTAMP(6) NOT NULL" if max // precision were 6 or higher assumeTrue(tester.getValidator().getTypeFactory().getTypeSystem() .getMaxPrecision(SqlTypeName.TIMESTAMP) == 3); tester.checkType( "timestampadd(MICROSECOND, 2, timestamp '2016-02-24 12:42:25.000000')", // "2016-02-24 12:42:25.000002", "TIMESTAMP(3) NOT NULL"); }