You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "yanjing.wang (Jira)" <ji...@apache.org> on 2022/02/28 08:52:00 UTC
[jira] [Comment Edited] (CALCITE-5024) Big INTERVAL_HOUR precision can't be converted to row expression
[ https://issues.apache.org/jira/browse/CALCITE-5024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498771#comment-17498771 ]
yanjing.wang edited comment on CALCITE-5024 at 2/28/22, 8:51 AM:
-----------------------------------------------------------------
Hi [~julianhyde] , Do you mean I need assign an enough precision when parsing interval expression?
I found the interval precision is dialect-specific, for example,
{code:java}
select interval '100' year {code}
Oracle throws 'ORA-01873: the leading precision of the interval is too small', but BigQuery, PostgreSQL passes.
was (Author: yanjing.wang):
Hi [~julianhyde] , Do you mean I need assign an enough precision when parsing interval expression?
I found the interval precision is dialect-specific, for example,
{code:java}
select interval '100' year {code}
Oracle throws 'ORA-01873: the leading precision of the interval is too small', but BigQuery, PostgreSQL passes.
> Big INTERVAL_HOUR precision can't be converted to row expression
> ----------------------------------------------------------------
>
> Key: CALCITE-5024
> URL: https://issues.apache.org/jira/browse/CALCITE-5024
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.29.0
> Environment: jdk8
> Reporter: yanjing.wang
> Assignee: yanjing.wang
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {code:java}
> @Test void testBigIntervalHourPrecision() {
> String expr = "interval '1000000' hour";
> expr(expr).withFactory(t -> t.withTypeFactoryFactory(
> f -> new JavaTypeFactoryImpl() {
> @Override
> public RelDataTypeSystem getTypeSystem() {
> return new RelDataTypeSystemImpl() {
> @Override
> public int getDefaultPrecision(SqlTypeName typeName) {
> switch (typeName) {
> case INTERVAL_HOUR:
> return SqlTypeName.MAX_INTERVAL_START_PRECISION;
> default:
> break;
> }
> return super.getDefaultPrecision(typeName);
> }
> };
> }
> }
> )).ok();
> } {code}
> This will cause SqlValidatorException: Interval field value 1,000,000 exceeds precision of HOUR(2) field.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)