You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "mihaibudiu (via GitHub)" <gi...@apache.org> on 2025/06/17 06:33:09 UTC
[PR] [CALCITE-7058] Decorrelator may produce different column names [calcite]
mihaibudiu opened a new pull request, #4422:
URL: https://github.com/apache/calcite/pull/4422
(no comment)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "suibianwanwank (via GitHub)" <gi...@apache.org>.
suibianwanwank commented on code in PR #4422:
URL: https://github.com/apache/calcite/pull/4422#discussion_r2153579795
##########
core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java:
##########
@@ -1419,6 +1419,49 @@ public static boolean equalAsStructSansNullability(
return true;
}
+ /** Returns whether two types are equal, where two ROW types are considered equal
+ * even if the field names differ. */
+ public static boolean equalUpToFieldNames(RelDataType type1, RelDataType type2) {
Review Comment:
Does this method express the same logic as the code below? From what I recall, we should have a similar method:
```
String x = type1.getFullTypeString();
String y = type2.getFullTypeString();
return x.equal(y);
```
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4422:
URL: https://github.com/apache/calcite/pull/4422#discussion_r2153610519
##########
core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java:
##########
@@ -1419,6 +1419,49 @@ public static boolean equalAsStructSansNullability(
return true;
}
+ /** Returns whether two types are equal, where two ROW types are considered equal
+ * even if the field names differ. */
+ public static boolean equalUpToFieldNames(RelDataType type1, RelDataType type2) {
Review Comment:
Maybe it can, maybe it can't, but I don't think that getFullTypeString has a precise contract defined, so I am reluctant to use it based on its implementation. The function I wrote does exactly what is needed.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985127607
That method does not handle arguments to generic types like ARRAY.
But it could work in this case.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985315610
Ok, I will switch to that method, but please note that the method does not have a clear spec. Maybe I will add a more precise specification.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985360209
I guess it's spec is pretty clear, but made it even more explicit.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2981456540
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422) **Quality Gate passed**
Issues
 [4 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [44.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985422636
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "suibianwanwank (via GitHub)" <gi...@apache.org>.
suibianwanwank commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985152077
I'm not very familiar with composite types in Calcite. When it comes to checking the rowType of a RelNode, are there types other than Struct? If so, we should modify this method because it is called by many RelNodes, such as Filter's deepEqual. If not, the inner composite types should not ignore their names either. WDYT
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985026221
This should be easy to review, and it is a blocker for us, since it makes the compiler reject valid queries...
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4422:
URL: https://github.com/apache/calcite/pull/4422#discussion_r2151543317
##########
core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java:
##########
@@ -1419,6 +1419,37 @@ public static boolean equalAsStructSansNullability(
return true;
}
+ /** Returns whether two types are equal, where two ROW types are considered equal
+ * even if the field names differ. */
+ public static boolean equalUpToFieldNames(
+ RelDataType type1,
+ RelDataType type2) {
+ if (type1 == type2) {
+ return true;
+ }
+
+ if (type1.isStruct() != type2.isStruct()) {
+ return false;
+ }
+
+ if (!type1.isStruct()) {
Review Comment:
Put this line before ```if (type1.isStruct() != type2.isStruct())``` should be better? it can reduce the calculation theoretically.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2981937884
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [51.1% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985271101
@suibianwanwank I have slightly generalized the type comparison function.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu merged PR #4422:
URL: https://github.com/apache/calcite/pull/4422
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985846772
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "suibianwanwank (via GitHub)" <gi...@apache.org>.
suibianwanwank commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985050615
I think I understand. There's one more point of confusion: we should only compare each column of the outermost RelDataType (Struct). However, in practice, if one of the columns is itself a Struct, we shouldn't allow its name to be changed (though I believe such changes would hardly ever occur in any optimization rule). So, should we only allow the field names at the first level to differ?
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985165039
Generic types can appear anywhere, including a field of a ROW, and they can be nested, i.e., you can have ROW(INT ARRAY) ARRAY.
I don't know where this method is used and what the intent of the method is, so I cannot comment on changing it. The name should reflect the fact that it does not recurse, but we cannot change that.
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985344807
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422) **Quality Gate passed**
Issues
 [1 New issue](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [48.1% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985358975
Switched to existing method
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "suibianwanwank (via GitHub)" <gi...@apache.org>.
suibianwanwank commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985121480
How about this method
https://github.com/apache/calcite/blob/c4b0b2e7bf859a9b045389f323f7b678226caa04/core/src/main/java/org/apache/calcite/rel/type/RelDataType.java#L265
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2979173846
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4422&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4422&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [70.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4422&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4422)
--
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-7058] Decorrelator may produce different column names [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4422:
URL: https://github.com/apache/calcite/pull/4422#issuecomment-2985059535
I don't know any existing optimization passes that look inside ROW types; I can add a flag for the comparison function whether to recurse inside ROWs or not and call it with the flag set to 'false'.
--
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