xiedeyantu commented on code in PR #4798:
URL: https://github.com/apache/calcite/pull/4798#discussion_r2820412135


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -1272,6 +1273,66 @@ public static String formatNumber(BigDecimal value, int 
decimalVal) {
     return numberFormat.format(value);
   }
 
+  /** Implements casts from integer to binary values.
+   *
+   * @param value      Value converted; an integer or unsigned value.
+   * @param resultSize Size of result in bytes; negative if unspecified.
+   * @param fixed      True if the result type is BINARY; false for VARBINARY.
+   * @return           A ByteString containing the conversion result.
+   *
+   * <p>Most SQL dialects which support this feature seem to convert integers 
to big endian values,
+   * and then truncate or pad on the left when the size of the target BINARY 
does not exactly
+   * match the integer's size.
+   */
+  public static ByteString intToBinary(Object value, int resultSize, boolean 
fixed) {
+    ByteBuffer buffer;
+    if (value instanceof Byte) {
+      buffer = ByteBuffer.allocate(1)

Review Comment:
   Yes, let's keep things as they are.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to