@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { RelDataType nodeType = validator.deriveType(scope, call.getOperandList().get(0)); assert nodeType != null; final String fieldName = call.getOperandList().get(1).toString(); RelDataTypeField field = nodeType.getField(fieldName, false, false); if (field == null) { throw SqlUtil.newContextException(SqlParserPos.ZERO, Static.RESOURCE.unknownField(fieldName)); } RelDataType type = field.getType(); // Validate and determine coercibility and resulting collation // name of binary operator if needed. type = adjustType(validator, call, type); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type; }
charset, collation); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type;
charset, collation); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type;
charset, collation); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type;
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { final SqlNode operand = call.getOperandList().get(0); final RelDataType nodeType = validator.deriveType(scope, operand); assert nodeType != null; if (!nodeType.isStruct()) { throw SqlUtil.newContextException(operand.getParserPosition(), Static.RESOURCE.incompatibleTypes()); } final SqlNode fieldId = call.operand(1); final String fieldName = fieldId.toString(); final RelDataTypeField field = nodeType.getField(fieldName, false, false); if (field == null) { throw SqlUtil.newContextException(fieldId.getParserPosition(), Static.RESOURCE.unknownField(fieldName)); } RelDataType type = field.getType(); // Validate and determine coercibility and resulting collation // name of binary operator if needed. type = adjustType(validator, call, type); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type; }
SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type;
SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type;