You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2020/10/30 10:07:00 UTC
[jira] [Resolved] (CALCITE-4354) Allow ITEM operator on ROW/STRUCT
data types
[ https://issues.apache.org/jira/browse/CALCITE-4354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stamatis Zampetakis resolved CALCITE-4354.
------------------------------------------
Resolution: Fixed
> Allow ITEM operator on ROW/STRUCT data types
> --------------------------------------------
>
> Key: CALCITE-4354
> URL: https://issues.apache.org/jira/browse/CALCITE-4354
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.27.0
> Reporter: Alessandro Solimando
> Assignee: Alessandro Solimando
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.27.0
>
> Time Spent: 4.5h
> Remaining Estimate: 0h
>
> The current implementation of the "ITEM" operator cannot be apply to row/struct type.
> The idea is to extend "ITEM" to support a signature "<ROW>[<CHARACTER|INTEGER>]", allowing to access elements by their position (1-based index), or their name (if available).
>
> The current implementation supports an SQL query as follows:
> {code:java}
> select au."birthPlace"."city" as city from "bookstore"."authors" au;{code}
>
> The extended implementation will also support the following equivalent query:
> {code:java}
> select au."birthPlace"['city'] as city from "bookstore"."authors" au;
> {code}
>
> And since we have that "birthPlace(coords, city, country)", we can also access "city" with its index 2:
> {code:java}
> select au."birthPlace"[2] as city from "bookstore"."authors" au;{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)