[
https://issues.apache.org/jira/browse/CALCITE-7512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18079769#comment-18079769
]
Zhen Chen commented on CALCITE-7512:
------------------------------------
Thank you for suggesting this feature! I quickly glanced at the "@>" operator,
and it seems it's not limited to ARRAY. I successfully executed "SELECT
'\{"a":1,"b":2}'::jsonb @> '\{"a":1}'::jsonb;" in PostgreSQL, suggesting it
supports other types. So, should we discuss the scope of support for this
operator? Should it remain consistent with PostgreSQL, or should it adapt to
all complex types supported by Calcite (such as MULTISET, JSON, etc.; I'm
unsure if MAP is also supported)? Another question is whether it should be
supported in Babel or the default Calcite parser? I also quickly reviewed your
PR, and I think it's more appropriate to discuss these issues before reviewing
the PR, as I noticed the PR uses "ARRAY_" as a prefix for naming, which I'm
unsure is suitable.
> Support array operators for PostgreSql
> --------------------------------------
>
> Key: CALCITE-7512
> URL: https://issues.apache.org/jira/browse/CALCITE-7512
> Project: Calcite
> Issue Type: New Feature
> Components: babel
> Affects Versions: 1.41.0
> Reporter: terran2010
> Priority: Major
> Labels: pull-request-available
>
> When execute sql with babel:
> {code:java}
> SELECT ARRAY[1,2,3] @> ARRAY[1,2] {code}
> now will run error:
> {code:java}
> Caused by: org.apache.calcite.sql.parser.babel.TokenMgrError: Lexical error
> at line 1, column 21. Encountered: "@" (64), after : "" at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImplTokenManager.getNextToken(SqlBabelParserImplTokenManager.java:26853)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.jj_scan_token(SqlBabelParserImpl.java:41652)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.jj_3_414(SqlBabelParserImpl.java:31680)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.jj_2_414(SqlBabelParserImpl.java:14651)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.AddExpression2b(SqlBabelParserImpl.java:4917)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression2(SqlBabelParserImpl.java:4956)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.Expression(SqlBabelParserImpl.java:4805)
> at
> org.apache.calcite.sql.parser.babel.SqlBabelParserImpl.SelectExpression(SqlBabelParserImpl.java:2816)
> {code}
> We can refer postgresql document about Position:
> [https://www.postgresql.org/docs/current/functions-array.html]
> We can consider supporting the above situation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)