-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-3814][SQL] Bitwise & does not work in Hive #2736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,36 +275,45 @@ abstract class IntegralType extends NumericType { | |
| private[sql] val integral: Integral[JvmType] | ||
| } | ||
|
|
||
| case object LongType extends IntegralType { | ||
| /** Matcher for any expressions that evaluate which do bitwise operations */ | ||
| trait BitwiseOpsType[T] { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the standard Scala numeric doesn't support the operation, I think I'd prefer we just put the logic in the expression's |
||
| def bitwiseAND(x: T, y: T): T | ||
| } | ||
|
|
||
| case object LongType extends IntegralType with BitwiseOpsType[Long] { | ||
| private[sql] type JvmType = Long | ||
| @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized { typeTag[JvmType] } | ||
| private[sql] val numeric = implicitly[Numeric[Long]] | ||
| private[sql] val integral = implicitly[Integral[Long]] | ||
| private[sql] val ordering = implicitly[Ordering[JvmType]] | ||
| def bitwiseAND(x: JvmType, y: JvmType): JvmType = x & y | ||
| } | ||
|
|
||
| case object IntegerType extends IntegralType { | ||
| case object IntegerType extends IntegralType with BitwiseOpsType[Int] { | ||
| private[sql] type JvmType = Int | ||
| @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized { typeTag[JvmType] } | ||
| private[sql] val numeric = implicitly[Numeric[Int]] | ||
| private[sql] val integral = implicitly[Integral[Int]] | ||
| private[sql] val ordering = implicitly[Ordering[JvmType]] | ||
| def bitwiseAND(x: JvmType, y: JvmType): JvmType = x & y | ||
| } | ||
|
|
||
| case object ShortType extends IntegralType { | ||
| case object ShortType extends IntegralType with BitwiseOpsType[Short] { | ||
| private[sql] type JvmType = Short | ||
| @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized { typeTag[JvmType] } | ||
| private[sql] val numeric = implicitly[Numeric[Short]] | ||
| private[sql] val integral = implicitly[Integral[Short]] | ||
| private[sql] val ordering = implicitly[Ordering[JvmType]] | ||
| def bitwiseAND(x: JvmType, y: JvmType): JvmType = (x & y).toShort | ||
| } | ||
|
|
||
| case object ByteType extends IntegralType { | ||
| case object ByteType extends IntegralType with BitwiseOpsType[Byte] { | ||
| private[sql] type JvmType = Byte | ||
| @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized { typeTag[JvmType] } | ||
| private[sql] val numeric = implicitly[Numeric[Byte]] | ||
| private[sql] val integral = implicitly[Integral[Byte]] | ||
| private[sql] val ordering = implicitly[Ordering[JvmType]] | ||
| def bitwiseAND(x: JvmType, y: JvmType): JvmType = (x & y).toByte | ||
| } | ||
|
|
||
| /** Matcher for any expressions that evaluate to [[FractionalType]]s */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BitwiseAnd