Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
Description
In interval literals, Drill allows specifying interval types with a leading field precision of 10, but then doesn't allow all 10-digit values. For example:
0: jdbc:drill:zk=local> SELECT INTERVAL '2222222222' YEAR(10) FROM INFORMATION_SCHEMA.CATALOGS; Jun 26, 2015 2:13:53 PM org.apache.calcite.sql.validate.SqlValidatorException <init> SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: Interval field value 2,222,222,222 exceeds precision of YEAR(10) field Jun 26, 2015 2:13:53 PM org.apache.calcite.runtime.CalciteException <init> SEVERE: org.apache.calcite.runtime.CalciteContextException: From line 1, column 9 to line 1, column 38: Interval field value 2,222,222,222 exceeds precision of YEAR(10) field Error: PARSE ERROR: From line 1, column 9 to line 1, column 38: Interval field value 2,222,222,222 exceeds precision of YEAR(10) field [Error Id: dea32980-c1ad-4d7c-9780-5a08714ffcb7 on dev-linux2:31010] (state=,code=0) 0: jdbc:drill:zk=local>
Note that the value does not exceed the declared precision of 10.
If Drill isn't going to allow a 10-digit value, it shouldn't accept a precision of 10 digits.
Either the maximum allowed leading digit precision should be reduced to 9 (because 9-digit values seem to be accepted--although larger 9-digit values are processed wrong) or 10-digit values should be accepted.