-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-4670] [SQL] wrong symbol for bitwise not #3528
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
Conversation
Test build #23975 has started for PR 3528 at commit
|
Test build #23975 has finished for PR 3528 at commit
|
Test PASSed. |
case IntegerType => ~(evalE.asInstanceOf[Int]) | ||
case LongType => ~(evalE.asInstanceOf[Long]) | ||
case other => sys.error(s"Unsupported bitwise ~ operation on ${other}") | ||
case ByteType => ~evalE.asInstanceOf[Byte] |
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.
I think this is actually introducing a bug. Above we set def dataType = child.dataType
but this is changing the type to an Int
.
scala> ~1.toByte
res0: Int = -2
Can you fix and add some test cases to the expression evaluation suite to make sure this doesn't regress again?
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.
Thanks for the correction, I'll follow up very soon.
Test build #24022 has started for PR 3528 at commit
|
Test build #24022 has finished for PR 3528 at commit
|
Test FAILed. |
Test build #24029 has started for PR 3528 at commit
|
Test build #24029 has finished for PR 3528 at commit
|
Test PASSed. |
We should use `~` instead of `-` for bitwise NOT. Author: Daoyuan Wang <[email protected]> Closes #3528 from adrian-wang/symbol and squashes the following commits: affd4ad [Daoyuan Wang] fix code gen test case 56efb79 [Daoyuan Wang] ensure bitwise NOT over byte and short persist data type f55fbae [Daoyuan Wang] wrong symbol for bitwise not (cherry picked from commit 1f5ddf1) Signed-off-by: Michael Armbrust <[email protected]>
Thanks for fixing this! Merged to master and 1.2 |
We should use
~
instead of-
for bitwise NOT.