You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "NobiGo (via GitHub)" <gi...@apache.org> on 2024/05/24 07:01:57 UTC
[PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
NobiGo opened a new pull request, #3798:
URL: https://github.com/apache/calcite/pull/3798
…rsed incorrectly for HiveSqlDialect
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #3798:
URL: https://github.com/apache/calcite/pull/3798#discussion_r1615531463
##########
core/src/main/java/org/apache/calcite/util/RelToSqlConverterUtil.java:
##########
@@ -63,6 +63,36 @@ public static void unparseHiveTrim(
}
}
+ /**
+ * Unparses Array and Map value constructor.
+ *
+ * <p>For example :
+ *
+ * <blockquote><pre>
+ * SELECT ARRAY[1, 2, 3] → SELECT ARRAY (1, 2, 3)
+ * SELECT MAP['k1', 'v1', 'k2', 'v2'] → SELECT MAP ('k1', 'v1', 'k2', 'v2')
+ * </pre></blockquote>
+ *
+ * @param writer writer
+ * @param call the call
+ */
+ public static void unparseSparkArrayAndMap(SqlWriter writer,
Review Comment:
Hi @YiwenWu ,I noticed this too. So how about when we merge this after , In another PR ,We can create new SqlNodeToSqlUtil , Then refactor the relative code ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo merged PR #3798:
URL: https://github.com/apache/calcite/pull/3798
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "YiwenWu (via GitHub)" <gi...@apache.org>.
YiwenWu commented on code in PR #3798:
URL: https://github.com/apache/calcite/pull/3798#discussion_r1615421383
##########
core/src/main/java/org/apache/calcite/util/RelToSqlConverterUtil.java:
##########
@@ -63,6 +63,36 @@ public static void unparseHiveTrim(
}
}
+ /**
+ * Unparses Array and Map value constructor.
+ *
+ * <p>For example :
+ *
+ * <blockquote><pre>
+ * SELECT ARRAY[1, 2, 3] → SELECT ARRAY (1, 2, 3)
+ * SELECT MAP['k1', 'v1', 'k2', 'v2'] → SELECT MAP ('k1', 'v1', 'k2', 'v2')
+ * </pre></blockquote>
+ *
+ * @param writer writer
+ * @param call the call
+ */
+ public static void unparseSparkArrayAndMap(SqlWriter writer,
Review Comment:
minor: putting the unparse method in the `RelToSqlConverterUtil` tool class feels a bit ambiguous, because unparse should belong to SqlNode to Sql rather than RelNode to SqlNode.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3798:
URL: https://github.com/apache/calcite/pull/3798#issuecomment-2128828190
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3798) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3798&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3798&resolutions=WONTFIX)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3798&resolved=false&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3798&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3798&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3798)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "YiwenWu (via GitHub)" <gi...@apache.org>.
YiwenWu commented on code in PR #3798:
URL: https://github.com/apache/calcite/pull/3798#discussion_r1616072178
##########
core/src/main/java/org/apache/calcite/util/RelToSqlConverterUtil.java:
##########
@@ -63,6 +63,36 @@ public static void unparseHiveTrim(
}
}
+ /**
+ * Unparses Array and Map value constructor.
+ *
+ * <p>For example :
+ *
+ * <blockquote><pre>
+ * SELECT ARRAY[1, 2, 3] → SELECT ARRAY (1, 2, 3)
+ * SELECT MAP['k1', 'v1', 'k2', 'v2'] → SELECT MAP ('k1', 'v1', 'k2', 'v2')
+ * </pre></blockquote>
+ *
+ * @param writer writer
+ * @param call the call
+ */
+ public static void unparseSparkArrayAndMap(SqlWriter writer,
Review Comment:
I agree, it's a good idea
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #3798:
URL: https://github.com/apache/calcite/pull/3798#discussion_r1613259892
##########
core/src/main/java/org/apache/calcite/sql/dialect/HiveSqlDialect.java:
##########
@@ -80,6 +82,10 @@ public HiveSqlDialect(Context context) {
@Override public void unparseCall(final SqlWriter writer, final SqlCall call,
final int leftPrec, final int rightPrec) {
switch (call.getKind()) {
+ case ARRAY_VALUE_CONSTRUCTOR:
+ case MAP_VALUE_CONSTRUCTOR:
+ unparseSparkArrayAndMap(writer, call, leftPrec, rightPrec);
Review Comment:
Hi, Thanks for the review. This name means we use SparkSQL standard to handle Array and Map, Like SparkSqlDialect and StarRocksSqlDialect use unparseHiveTrim method to handle the Trim. So I think it's Ok.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [CALCITE-6417] Map value constructor and Array value constructor unpa… [calcite]
Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #3798:
URL: https://github.com/apache/calcite/pull/3798#discussion_r1612980525
##########
core/src/main/java/org/apache/calcite/sql/dialect/HiveSqlDialect.java:
##########
@@ -80,6 +82,10 @@ public HiveSqlDialect(Context context) {
@Override public void unparseCall(final SqlWriter writer, final SqlCall call,
final int leftPrec, final int rightPrec) {
switch (call.getKind()) {
+ case ARRAY_VALUE_CONSTRUCTOR:
+ case MAP_VALUE_CONSTRUCTOR:
+ unparseSparkArrayAndMap(writer, call, leftPrec, rightPrec);
Review Comment:
minor: should we think about a different name since it is not only `Spark` after this PR?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org