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 2025/04/21 12:14:30 UTC
[PR] [CALCITE-6974] Decimal precision not correctly in Presto/MySQL/Phoenix [calcite]
xuzifu666 opened a new pull request, #4323:
URL: https://github.com/apache/calcite/pull/4323
As description in JIRA: https://issues.apache.org/jira/browse/CALCITE-6974
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 closed pull request #4323: [CALCITE-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix
URL: https://github.com/apache/calcite/pull/4323
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2057196896
##########
core/src/main/java/org/apache/calcite/sql/dialect/PhoenixSqlDialect.java:
##########
@@ -17,22 +17,51 @@
package org.apache.calcite.sql.dialect;
import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeSystem;
+import org.apache.calcite.rel.type.RelDataTypeSystemImpl;
import org.apache.calcite.sql.SqlAlienSystemTypeNameSpec;
import org.apache.calcite.sql.SqlDataTypeSpec;
import org.apache.calcite.sql.SqlDialect;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.sql.type.AbstractSqlType;
+import org.apache.calcite.sql.type.SqlTypeName;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* A <code>SqlDialect</code> implementation for the Apache Phoenix database.
*/
public class PhoenixSqlDialect extends SqlDialect {
+ public static final RelDataTypeSystem TYPE_SYSTEM =
Review Comment:
Done, had added links for other systems, thanks @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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2054510260
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -71,10 +71,22 @@ public class MysqlSqlDialect extends SqlDialect {
return 65535;
case TIMESTAMP:
return 6;
+ case DECIMAL:
+ return 65;
default:
return super.getMaxPrecision(typeName);
}
}
+
+ @Override public int getMaxScale(SqlTypeName typeName) {
Review Comment:
ideally you can add here links to the documentation and specify also the version of the database, so people can check whether the values are still accurate as things change
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4323:
URL: https://github.com/apache/calcite/pull/4323#issuecomment-2819970102
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323) **Quality Gate passed**
Issues
 [7 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [88.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_coverage&view=list)
 [62.9% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323)
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu merged PR #4323:
URL: https://github.com/apache/calcite/pull/4323
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 closed pull request #4323: [CALCITE-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix
URL: https://github.com/apache/calcite/pull/4323
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2056577535
##########
core/src/main/java/org/apache/calcite/sql/dialect/PhoenixSqlDialect.java:
##########
@@ -17,22 +17,51 @@
package org.apache.calcite.sql.dialect;
import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeSystem;
+import org.apache.calcite.rel.type.RelDataTypeSystemImpl;
import org.apache.calcite.sql.SqlAlienSystemTypeNameSpec;
import org.apache.calcite.sql.SqlDataTypeSpec;
import org.apache.calcite.sql.SqlDialect;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.sql.type.AbstractSqlType;
+import org.apache.calcite.sql.type.SqlTypeName;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* A <code>SqlDialect</code> implementation for the Apache Phoenix database.
*/
public class PhoenixSqlDialect extends SqlDialect {
+ public static final RelDataTypeSystem TYPE_SYSTEM =
Review Comment:
are there links for these other type systems too?
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2053384682
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -71,10 +71,22 @@ public class MysqlSqlDialect extends SqlDialect {
return 65535;
case TIMESTAMP:
return 6;
+ case DECIMAL:
+ return 65;
default:
return super.getMaxPrecision(typeName);
}
}
+
+ @Override public int getMaxScale(SqlTypeName typeName) {
Review Comment:
I think this is wrong: https://dev.mysql.com/doc/refman/8.4/en/precision-math-decimal-characteristics.html
The docs say that 30 is the max value.
Please double check these values before you make the fixes.
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2053390814
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -71,10 +71,22 @@ public class MysqlSqlDialect extends SqlDialect {
return 65535;
case TIMESTAMP:
return 6;
+ case DECIMAL:
+ return 65;
default:
return super.getMaxPrecision(typeName);
}
}
+
+ @Override public int getMaxScale(SqlTypeName typeName) {
Review Comment:
It‘s my mistake! thanks for the correction,I would doube check them again. @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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4323:
URL: https://github.com/apache/calcite/pull/4323#issuecomment-2823479041
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323) **Quality Gate passed**
Issues
 [7 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [88.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_coverage&view=list)
 [60.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323)
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2055491653
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -71,10 +71,22 @@ public class MysqlSqlDialect extends SqlDialect {
return 65535;
case TIMESTAMP:
return 6;
+ case DECIMAL:
+ return 65;
default:
return super.getMaxPrecision(typeName);
}
}
+
+ @Override public int getMaxScale(SqlTypeName typeName) {
Review Comment:
Done,had add document links of MySQL 5.x and 8.x(which are the most used version), thanks for the suggestion. @mihaibudiu
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -71,10 +71,22 @@ public class MysqlSqlDialect extends SqlDialect {
return 65535;
case TIMESTAMP:
return 6;
+ case DECIMAL:
+ return 65;
default:
return super.getMaxPrecision(typeName);
}
}
+
+ @Override public int getMaxScale(SqlTypeName typeName) {
Review Comment:
Done,had added document links of MySQL 5.x and 8.x(which are the most used version), thanks for the suggestion. @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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4323:
URL: https://github.com/apache/calcite/pull/4323#discussion_r2053503279
##########
core/src/main/java/org/apache/calcite/sql/dialect/MysqlSqlDialect.java:
##########
@@ -71,10 +71,22 @@ public class MysqlSqlDialect extends SqlDialect {
return 65535;
case TIMESTAMP:
return 6;
+ case DECIMAL:
+ return 65;
default:
return super.getMaxPrecision(typeName);
}
}
+
+ @Override public int getMaxScale(SqlTypeName typeName) {
Review Comment:
Had changed it after check from documents,and test precision and scale in Presto/MySQL/Phoenix real environment which as expected. PTAL @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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4323:
URL: https://github.com/apache/calcite/pull/4323#issuecomment-2820583530
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323) **Quality Gate passed**
Issues
 [7 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [88.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_coverage&view=list)
 [62.9% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323)
--
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-6974] Default typesystem has incorrect limits for DECIMAL for Presto/MySQL/Phoenix [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4323:
URL: https://github.com/apache/calcite/pull/4323#issuecomment-2825975617
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323) **Quality Gate passed**
Issues
 [7 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [88.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_coverage&view=list)
 [63.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323)
--
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-6974] Decimal precision not correctly in Presto/MySQL/Phoenix [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4323:
URL: https://github.com/apache/calcite/pull/4323#issuecomment-2818327850
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323) **Quality Gate passed**
Issues
 [7 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4323&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4323&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [88.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_coverage&view=list)
 [62.9% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4323&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4323)
--
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