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

Stamatis Zampetakis commented on CALCITE-4293:
----------------------------------------------

I think its a good idea to open a new ticket.

If you want to check the standard to see where square brackets ([]) are allowed 
search {{<left bracket}} or just {{left bracket}}. Related to this discussion I 
see they are used for ARRAY and MULTISET creation.

Now the ITEM operator in Calcite, as you already mentioned, is a way to access 
elements. The array part I think it is covered by the standard with {{<array 
element reference>}}.  

{noformat}
<array element reference> ::=
<array value expression>
<left bracket or trigraph> <numeric value expression> <right bracket or 
trigraph>
{noformat}

I am skipping the details but basically it applies only on array types and the 
argument is strictly numeric.

I don't remember seeing anywhere in the standard the brackets used for 
extracting elements from ROW/STRUCT types. 

Most of the tests you mentioned were added by CALCITE-3393 so you can ping the 
author to see what he had in mind. You can also test with Postgres to see if it 
throws an error or not. Postgres follows closely the standard so it is a good 
reference point.

> cassandra adapter returns null when selecting non-null tuple elements
> ---------------------------------------------------------------------
>
>                 Key: CALCITE-4293
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4293
>             Project: Calcite
>          Issue Type: Bug
>          Components: cassandra-adapter
>    Affects Versions: 1.25.0
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Major
>
> The following test currently fails due to the _EXPR$i_ elements are null and 
> don't match their actual value within the _f_tuple_ field:
> {code:java}
> @Test void testTupleInnerValues() {
>  CalciteAssert.that()
>  .with(DTCASSANDRA)
>  .query("select x['1'], x['2'], x['3'] from "
>  + "(select \"f_tuple\" from \"test_collections\") as T(x)")
>  .returns("EXPR$0=3000000000"
>  + "; EXPR$1=30ff87"
>  + "; EXPR$2=2015-05-03 13:30:54\n");
> }{code}



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

Reply via email to