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 2026/07/15 03:51:35 UTC
[PR] [CALCITE-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
mihaibudiu opened a new pull request, #5103:
URL: https://github.com/apache/calcite/pull/5103
## Jira Link
[CALCITE-7656](https://issues.apache.org/jira/browse/CALCITE-7656)
## Changes Proposed
The result of these statistical functions can be nullable even if no input is nullable.
--
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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5103:
URL: https://github.com/apache/calcite/pull/5103#issuecomment-4986915716
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5103) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5103&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5103&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=5103&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [92.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5103&metric=new_coverage&view=list)
 [11.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5103&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5103)
--
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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #5103:
URL: https://github.com/apache/calcite/pull/5103#discussion_r3585069816
##########
core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java:
##########
@@ -1581,8 +1581,11 @@ private static RelDataType multivalentStringWithSepSumPrecision(
final RelDataType relDataType =
typeFactory.getTypeSystem().deriveAvgAggType(typeFactory,
opBinding.getOperandType(0));
+ final SqlKind kind = opBinding.getOperator().kind;
if (opBinding.hasEmptyGroup() || opBinding.hasFilter()
- || opBinding.getOperator().kind == SqlKind.STDDEV_SAMP) {
+ || kind == SqlKind.STDDEV_SAMP
+ || kind == SqlKind.VAR_SAMP
+ || kind == SqlKind.COVAR_SAMP) {
Review Comment:
Here have a question: `AVG_AGG_FUNCTION` has been updated to include `|| kind == SqlKind.COVAR_SAMP`, but `COVAR_SAMP` actually uses `SqlCovarAggFunction` and `ReturnTypes.COVAR_REGR_FUNCTION`, so it shouldn't fall under `AVG_AGG_FUNCTION`.
Does this mean we also need to make adjustments for `COVAR_REGR_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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #5103:
URL: https://github.com/apache/calcite/pull/5103#discussion_r3589442694
##########
core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java:
##########
@@ -1581,8 +1581,11 @@ private static RelDataType multivalentStringWithSepSumPrecision(
final RelDataType relDataType =
typeFactory.getTypeSystem().deriveAvgAggType(typeFactory,
opBinding.getOperandType(0));
+ final SqlKind kind = opBinding.getOperator().kind;
if (opBinding.hasEmptyGroup() || opBinding.hasFilter()
- || opBinding.getOperator().kind == SqlKind.STDDEV_SAMP) {
+ || kind == SqlKind.STDDEV_SAMP
+ || kind == SqlKind.VAR_SAMP
+ || kind == SqlKind.COVAR_SAMP) {
Review Comment:
Great catch, I will push another commit
--
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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu merged PR #5103:
URL: https://github.com/apache/calcite/pull/5103
--
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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5103:
URL: https://github.com/apache/calcite/pull/5103#issuecomment-4976803458
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5103) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5103&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5103&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=5103&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5103&metric=new_coverage&view=list)
 [14.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5103&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5103)
--
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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5103:
URL: https://github.com/apache/calcite/pull/5103#issuecomment-4983763747
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5103) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5103&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5103&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=5103&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [92.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5103&metric=new_coverage&view=list)
 [11.1% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5103&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5103)
--
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-7656] Result type inferred for VAR_SAMP is incorrect [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #5103:
URL: https://github.com/apache/calcite/pull/5103#issuecomment-4986760458
I plan to merge this after CI completes
--
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