Anton Kovalevsky created CALCITE-6344:
-----------------------------------------

             Summary: RelToSqlConverter invalid quotation for arrays and item 
operator(ansi dialect)
                 Key: CALCITE-6344
                 URL: https://issues.apache.org/jira/browse/CALCITE-6344
             Project: Calcite
          Issue Type: Bug
            Reporter: Anton Kovalevsky


 

The context:
 * Ansi Dialect
 * having array of objects
 * get an object by id and get property

"books"[0]."title" turns into ```books``[0]`.`title`

I added test case to  RelToSqlConverterTest to show what I met:
{code:java}
@Test
void testSqlItemOperator2() {
  new Sql(CalciteAssert.SchemaSpec.BOOKSTORE,
      "SELECT MAP['title', \"books\"[0].\"title\"] from 
\"bookstore\".\"authors\"",
      AnsiSqlDialect.DEFAULT, SqlParser.Config.DEFAULT, ImmutableSet.of(),
      UnaryOperator.identity(), null, ImmutableList.of())
      .withSql("SELECT \"books\"[0].\"title\" from \"bookstore\".\"authors\"")
      .schema(CalciteAssert.SchemaSpec.BOOKSTORE)
      .ok("SELECT `books`[0].`title` FROM `bookstore`.`authors`");
} {code}
 
{noformat}
java.lang.AssertionError: 
Expected: is "SELECT `books`[0].`title` FROM `bookstore`.`authors`"
     but: was "SELECT ```books``[0]`.`title`\nFROM 
`bookstore`.`authors`"{noformat}
 

 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to