You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "xuzifu666 (via GitHub)" <gi...@apache.org> on 2026/06/22 10:16:00 UTC
[PR] [CALCITE-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
xuzifu666 opened a new pull request, #5037:
URL: https://github.com/apache/calcite/pull/5037
jira: https://issues.apache.org/jira/browse/CALCITE-6027
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 closed pull request #5037: [CALCITE-6027] Simplify the cardinality on map_keys and map_values functions
URL: https://github.com/apache/calcite/pull/5037
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #5037:
URL: https://github.com/apache/calcite/pull/5037#discussion_r3456551174
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -408,6 +408,22 @@ RexNode isFalse(RexNode e) {
private RexNode simplifyGenericNode(RexCall e) {
final List<RexNode> operands = new ArrayList<>(e.operands);
simplifyList(operands, UNKNOWN);
+
+ // Simplify CARDINALITY(MAP_KEYS(m)) -> CARDINALITY(m)
+ // and CARDINALITY(MAP_VALUES(m)) -> CARDINALITY(m)
+ if (e.getOperator().getName().equals("CARDINALITY")
Review Comment:
You are right. This is indeed an overly restrictive optimization, with little value; I currently share this view. Perhaps the value of Jira needs further discussion.
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #5037:
URL: https://github.com/apache/calcite/pull/5037#discussion_r3456559883
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -408,6 +408,22 @@ RexNode isFalse(RexNode e) {
private RexNode simplifyGenericNode(RexCall e) {
final List<RexNode> operands = new ArrayList<>(e.operands);
simplifyList(operands, UNKNOWN);
+
+ // Simplify CARDINALITY(MAP_KEYS(m)) -> CARDINALITY(m)
+ // and CARDINALITY(MAP_VALUES(m)) -> CARDINALITY(m)
+ if (e.getOperator().getName().equals("CARDINALITY")
Review Comment:
I had moved the discussion to jira.
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #5037:
URL: https://github.com/apache/calcite/pull/5037#issuecomment-5637757516
Maybe we can close this issue and PR if we have concluded that this is not a likely scenario to optimize for.
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #5037:
URL: https://github.com/apache/calcite/pull/5037#issuecomment-5642417322
Thanks for the reminder; I have closed the current PR and Jira ticket. @mihaibudiu
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5037:
URL: https://github.com/apache/calcite/pull/5037#issuecomment-4767497084
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5037) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5037&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5037&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=5037&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [94.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5037&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5037&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5037)
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #5037:
URL: https://github.com/apache/calcite/pull/5037#discussion_r3453881309
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -408,6 +408,22 @@ RexNode isFalse(RexNode e) {
private RexNode simplifyGenericNode(RexCall e) {
final List<RexNode> operands = new ArrayList<>(e.operands);
simplifyList(operands, UNKNOWN);
+
+ // Simplify CARDINALITY(MAP_KEYS(m)) -> CARDINALITY(m)
+ // and CARDINALITY(MAP_VALUES(m)) -> CARDINALITY(m)
+ if (e.getOperator().getName().equals("CARDINALITY")
Review Comment:
Do you expect people write such programs?
There's potentially an infinite number of such optimizations we can consider, but are they useful in practice?
--
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-6027] Simplify the cardinality on map_keys and map_values functions [calcite]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5037:
URL: https://github.com/apache/calcite/pull/5037#issuecomment-5054432943
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions.
--
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