cfmcgrady commented on a change in pull request #1333:
URL: https://github.com/apache/incubator-kyuubi/pull/1333#discussion_r743367348



##########
File path: 
dev/kyuubi-extension-spark-common/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderBytesUtils.scala
##########
@@ -73,7 +358,23 @@ object ZorderBytesUtils {
     (a ^ (1 << apos)).toByte
   }
 
-  def toByte(a: Any): Array[Byte] = {
+  def toLong(a: Any): Long = {
+    a match {
+      case b: Boolean => (if (b) 1 else 0).toLong ^ BIT_64_MASK
+      case b: Byte => b.toLong ^ BIT_64_MASK
+      case s: Short => s.toLong ^ BIT_64_MASK
+      case i: Int => i.toLong ^ BIT_64_MASK
+      case l: Long => l ^ BIT_64_MASK
+      case f: Float => f.toLong ^ BIT_64_MASK

Review comment:
       ```scala
   java.lang.Float.floatToRawIntBits(f).toLong ^ BIT_64_MASK
   ```

##########
File path: 
dev/kyuubi-extension-spark-common/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderBytesUtils.scala
##########
@@ -73,7 +358,23 @@ object ZorderBytesUtils {
     (a ^ (1 << apos)).toByte
   }
 
-  def toByte(a: Any): Array[Byte] = {
+  def toLong(a: Any): Long = {
+    a match {
+      case b: Boolean => (if (b) 1 else 0).toLong ^ BIT_64_MASK
+      case b: Byte => b.toLong ^ BIT_64_MASK
+      case s: Short => s.toLong ^ BIT_64_MASK
+      case i: Int => i.toLong ^ BIT_64_MASK
+      case l: Long => l ^ BIT_64_MASK
+      case f: Float => f.toLong ^ BIT_64_MASK
+      case d: Double => d.toLong ^ BIT_64_MASK

Review comment:
       ```scala
   java.lang.Double.doubleToRawLongBits(d).toLong ^ BIT_64_MASK
   ```




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