Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.34.0
Description
// code placeholder // code placeholder sql("select cast(array[1,null,2] as int array) from (values (1))") .columnType("INTEGER NOT NULL ARRAY NOT NULL"); it is not correct, it should return INTEGER ARRAY NOT NULL
according the sql standard, cast to type, which can not be nulable and nullable is tabel level attribute which can not changed by cast.
current the calcite cast will using nullable of expr to replace target type , it is true. but it shoud also set array element type
// code placeholder /** Derives the type of "CAST(expression AS targetType)". */ public static RelDataType deriveType(RelDataTypeFactory typeFactory, RelDataType expressionType, RelDataType targetType, boolean safe) { return typeFactory.createTypeWithNullability(targetType, expressionType.isNullable() || safe); }
Attachments
Issue Links
- links to