You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/12/10 20:22:00 UTC

[jira] [Commented] (CALCITE-4436) Use the fields order from the struct type for 'ITEM(STRUCT, INDEX)' access

    [ https://issues.apache.org/jira/browse/CALCITE-4436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17247491#comment-17247491 ] 

Julian Hyde commented on CALCITE-4436:
--------------------------------------

Makes sense. The fields in SQL types are indeed deterministically ordered, and we can use that.

The real bug is in converting a Java class to a SQL type. There ought to be a way to make that deterministic (e.g. an annotation that says order the fields by name). Can you add a case for that?

> Use the fields order from the struct type for 'ITEM(STRUCT, INDEX)' access
> --------------------------------------------------------------------------
>
>                 Key: CALCITE-4436
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4436
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Minor
>
> The index-based access via the "ITEM" operator for operands of row/struct type is currently experimental and disabled by default (introduced in CALCITE-4354).
> Its implementation uses the fields order from `getDeclaredFields()`, a JVM-specific feature, this might lead to silent data corruption (see [PR-2230|https://github.com/apache/calcite/pull/2230]).
> The aim of the ticket is to improve the feature by relying on the safer fields order 
>  from the struct field type itself (_i.e._, `relType.getFields()[index]`) so that we can enable it by default.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)