Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[NSE-955] Add Murmur3Hash expression support #1013

Merged
merged 3 commits into from
Jul 8, 2022

Conversation

PHILO-HE
Copy link
Collaborator

@PHILO-HE PHILO-HE commented Jul 5, 2022

What changes were proposed in this pull request?

This is for spark function named "hash" to get the murmur3 hash result for a given input.

How was this patch tested?

UT.

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

#955

child.asInstanceOf[ColumnarExpression].doColumnarCodeGen(args)
val gandivaFuncName = child.dataType match {
case LongType => "hash64_spark"
case DoubleType => "hash64_spark"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for Long/Double, this will generating 64 bit hashes, not align with Spark?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for this late reply. Just checked, "hash64_spark" function we used will return 32 bit values, compatible with Spark. Gandiva has function named "hash64" which return 64 bit values.

      NativeFunction("hash64_spark", {}, DataTypeVector{int64(), int32()}, int32(),
                     kResultNullNever, "hash64_spark_int64_int32"),
      NativeFunction("hash64_spark", {}, DataTypeVector{float64(), int32()}, int32(),
                     kResultNullNever, "hash64_spark_float64_int32"),
      NativeFunction("hashbuf_spark", {}, DataTypeVector{utf8(), int32()}, int32(),
                     kResultNullNever, "hashbuf_spark_utf8_int32"),

@PHILO-HE
Copy link
Collaborator Author

PHILO-HE commented Jul 7, 2022

UT & TPC-H/DS have passed.

@zhouyuan zhouyuan merged commit e3d2a63 into oap-project:main Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants