[ https://issues.apache.org/jira/browse/CALCITE-4085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17143113#comment-17143113 ]
Dawid Wysakowicz commented on CALCITE-4085: ------------------------------------------- I created a PR, but unfortunately I faced problems with {{JavaType}} because it behaves very differently to other {{RelDataType}}. There is couple of problems with them: * tests in TableFunctionTest fail because the table function returns a nullable {{JavaType}}. This in turn with a change that keeps the original nullability of an aliased record changes the nested types. * tests that operate on linq4j fail, because it mismatches what comes from the {{JavaType}} stack and the RexNode. Take for example a class: {code} public static class Dependent { public final int empid; public final int deptno; } public static class Employee { public final int empid; public final int deptno; public final Dependent dependent } // Java type returns JavaType(int), whereas going through the modified RexBuilder the type // will be equal to JavaType(java.lang.Integer), because I implemented a logic that fixes the // nullability. I think in this case it make more sense to treat it as java.lang.Integer, because if // the Employee class is null, the empid will also be null SELECT t.dependent.empid from Employee; {code} I know I did not explain that too clearly, but I tried :( Do you have any suggestion how could I fix it? > Improve nullability support for fields of structured type > --------------------------------------------------------- > > Key: CALCITE-4085 > URL: https://issues.apache.org/jira/browse/CALCITE-4085 > Project: Calcite > Issue Type: Improvement > Components: core > Reporter: Dawid Wysakowicz > Assignee: Dawid Wysakowicz > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > As discussed in > https://lists.apache.org/thread.html/r602ac95fff23dd1ef974fb396df7be061ab861384ec42f5c57ce0bc2%40%3Cdev.calcite.apache.org%3E > I would like to change the way a type of a field of a record is derived at > couple of locations. This helps frameworks such as Apache Flink to build > support for nullable records with not null fields. > I suggest to change: > * SqlDotOperator#deriveType > * SqlItemOperator#inferReturnType > * AliasNamespace#validateImpl > * RexBuilder#makeFieldAccessInternal > * SqlValidatorImpl.DeriveTypeVisitor#visit(SqlIdentifier) -- This message was sent by Atlassian Jira (v8.3.4#803005)