Hi, devs. I have noticed that currently calcite default maximum precision and scale is 19. If we set Decimal(50,2), it will reduce to Decimal(19,2). while other mature database systems or bigdata engines have more bigger value.
For consistency and to give calcite users a standard value that meets most engines, can we adjust the value of calcite to 38? Besides, the sql standard defines the meaning of precision and scale, letting each system customize the maximum precision and scale. (sql1999, page 125) engine precision range scale range calcite [1,19] [1,19] oracle [1,38] [-84,127] sqlserver [1,38] [0,38] mysql [1,65] [0,30] spark [1,38] [0,38] hive [1,38] [0,38] flink [1,38] [0,38] We can see many systems or engines follow the sql standard to make maximum precision and scale to be 38, except oracle and mysql. If anyone can share some history or reasons why calcite set 19, i will appreciate it. [1] https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlqr/Data-Types.html#GUID-DCCC6F18-15A0-4ECC-BA48-16F73F844844 [2] https://learn.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-ver15 [3] https://dev.mysql.com/doc/refman/8.0/en/precision-math-decimal-characteristics.html [4] https://spark.apache.org/docs/3.2.0/api/java/org/apache/spark/sql/types/DecimalType.html [5] https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=82706456#LanguageManualTypes-decimal [6] https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/table/api/DataTypes.html Best Regards, Ran Tao https://github.com/chucheng92