When I override the RelDataTypeSystemImpl#getDefaultPrecision method to force INTERVAL_HOUR type having precision 10, the validation passes, but converting to rel fails.
The problem is SqlLiteral.getValueAs(Long.class) will invoke intervalToMillis and which invokes intervalQualifier.evaluateIntervalLiteral(literal, intervalQualifier.getParserPosition(), RelDataTypeSystem.DEFAULT). and you can find that RelDataTypeSystem.DEFAULT has been hard coded. Yanjing Wang <zhuangzixiao...@gmail.com> 于2022年2月25日周五 16:39写道: > Hello, > > I found the calcite INTERVAL HOUR default type is HOUR(2), and the range > is 0-99. > for example: > @Test void testIntervalHourRange() { > String expr = "interval '100' hour"; > expr(expr).ok(); > } > This test will throw CalciteContextException: From line 1, column 1 to > line 1, column 19: Interval field value 100 exceeds precision of HOUR(2) > field. > > I have tried this test on MYSQL, PG, BigQuery, SparkSql, all of them > succeed and I think they may support out of range INTERVAL HOUR. > > In the PG doc, I found the piece "Functions justify_days and justify_hours are > available for adjusting days and hours that overflow their normal ranges. > ". > > Would calcite support this automatic precision increase? > > > > > >