Skip to content

Commit

Permalink
Update clickhouse-core/src/main/scala/xenon/clickhouse/hash/HashFunc.…
Browse files Browse the repository at this point in the history
…scala


Add support for raw byte array for executeAny

Co-authored-by: Cheng Pan <pan3793@gmail.com>
  • Loading branch information
Yxang and pan3793 authored Jul 24, 2023
1 parent 8de846c commit b66e4b8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ abstract class HashFunc[T: ClassTag] {

final def executeAny(input: Any): T =
input match {
case input: String => applyHash(input.getBytes)
case bytes: Array[Byte] => applyHash(bytes)
case string: String => applyHash(string.getBytes(StandardCharsets.UTF_8))
case _ => throw new IllegalArgumentException(s"Unsupported input type: ${input.getClass}")
}
final def apply(input: Array[Any]): T = input.map(executeAny).reduce(combineHashes)
Expand Down

0 comments on commit b66e4b8

Please sign in to comment.