[ https://issues.apache.org/jira/browse/CALCITE-6508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17872144#comment-17872144 ]
Ian Bertolacci edited comment on CALCITE-6508 at 8/8/24 10:02 PM: ------------------------------------------------------------------ We extended the parser to use {{`ExprContext.ACCEPT_ALL`}} in the second production and it seems to parse fine. I probably need to narrow down which of these contexts I want to use (probably {{`ACCEPT_SUB_QUERY`}}) I'm curious why it was decided to exclude subqueries. [~julianhyde] You originally [wrote that a long time back|https://github.com/apache/calcite/commit/64523552520635e51fd731b64a13663f45b158d1#diff-5cfcf6099137369e782becd03c58864bec1c439bc0711bd6e151c2e69f4b4106R2923], you wouldn't happen to remember why subqueries were excluded? Looking at CALCITE-5624, this was brought up when adding the Spark version of this function, and they switched to using {{`ACCEPT_ALL`}}, but only for that production. was (Author: ian.bertolacci): We extended the parser to use {{`ExprContext.ACCEPT_ALL`}} in the second production and it seems to parse fine. I probably need to narrow down which of these contexts I want to use (probably ACCEPT_SUB_QUERY) I'm curious why it was decided to exclude subqueries. [~julianhyde] You originally [wrote that a long time back|https://github.com/apache/calcite/commit/64523552520635e51fd731b64a13663f45b158d1#diff-5cfcf6099137369e782becd03c58864bec1c439bc0711bd6e151c2e69f4b4106R2923], you wouldn't happen to remember why subqueries were excluded? Looking at CALCITE-5624, this was brought up when adding the Spark version of this function, and they switched to using {{`ACCEPT_ALL`}}, but only for that production. > Parse error when using scalar sub-query as operant to Array constructor > function > -------------------------------------------------------------------------------- > > Key: CALCITE-6508 > URL: https://issues.apache.org/jira/browse/CALCITE-6508 > Project: Calcite > Issue Type: Bug > Reporter: Ian Bertolacci > Priority: Major > > Using a scalar subquery in the {{`ARRAY[ ... ]`}} function throws "parse > failed: Query expression encountered in illegal context" > (Calcite version 1.36) > For example: > {code:sql} > select ARRAY[ (select 1) ] > select ARRAY[ (select max(x) from table) ] > {code} > Is this something that can be configured or easily altered? -- This message was sent by Atlassian Jira (v8.20.10#820010)