anilbash commented on a change in pull request #1859: [CALCITE-3863] Make 
Truncate/Round return type inference overridable through rel data …
URL: https://github.com/apache/calcite/pull/1859#discussion_r397182094
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystem.java
 ##########
 @@ -405,4 +405,103 @@ default RelDataType 
deriveDecimalModType(RelDataTypeFactory typeFactory,
     return null;
   }
 
+  /**
+   * Infers the return type of a decimal truncate operation. Decimal truncate
+   * involves at least one decimal operand.
+   *
+   * <p>The default implementation is SQL:2003 compliant: the declared type of
+   * the result is the declared type of the first operand (decimal to be 
truncated).
+   *
+   * @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.27
+   *
+   * <p>Rules:
+   *
+   * <ul>
+   * <li>Let p1, s1 be the precision and scale of the first operand</li>
+   * <li>Let s2 be the scale value to truncate</li>
+   * <li>Let p, s be the precision and scale of the result</li>
+   * <li>Let d be the number of whole digits in the result</li>
+   * <li>Then the result type is a decimal with:
 
 Review comment:
   removed done.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to