Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19506#discussion_r146124196
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproxCountDistinctForIntervals.scala
---
@@ -239,4 +219,26 @@ case class ApproxCountDistinctForIntervals(
override def dataType: DataType = ArrayType(LongType)
override def prettyName: String = "approx_count_distinct_for_intervals"
+
+ override def serialize(obj: Array[Long]): Array[Byte] = {
+ val byteArray = new Array[Byte](obj.length * 8)
+ obj.indices.foreach { i =>
+ Platform.putLong(byteArray, Platform.BYTE_ARRAY_OFFSET + i * 8,
obj(i))
+ }
+ byteArray
+ }
+
+ override def deserialize(bytes: Array[Byte]): Array[Long] = {
+ val length = bytes.length / 8
--- End diff --
add `assert(bytes.length % 8 == 0)`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]