[
https://issues.apache.org/jira/browse/CALCITE-2677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16737164#comment-16737164
]
Stamatis Zampetakis commented on CALCITE-2677:
----------------------------------------------
Hi [~julianhyde], to illustrate the problem of bad Java types on structs with
one field, let's consider the following query:
{code:sql}
select * from (values
(1, ROW(1)),
(2, ROW(2))) as v(id,struct);
{code}
Without the fix in this PR, this query fails at runtime with a
ClassCastException.
I updated the PR with this test case and I added an additional fix related with
CALCITE-2776.
Can you please have a look when you find some time?
> Struct types with one field are not mapped correctly to Java Classes
> --------------------------------------------------------------------
>
> Key: CALCITE-2677
> URL: https://issues.apache.org/jira/browse/CALCITE-2677
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: Stamatis Zampetakis
> Assignee: Julian Hyde
> Priority: Major
> Labels: easy-fix, pull-request-available
>
> There are various places in the code where given a RelDataType we need to
> obtain the respective Java Class/Type. This is done mainly through
> JavaTypeFactory#getJavaClass. For the Calcite runtime it passes through
> PhysType#fieldClass and PhysType#getJavaFieldType.
> However, when the RelDataType is a struct of one field the returned
> Class/Type is not the correct one since the struct type is simplified to the
> type of its component.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)