Github user tarekauel commented on a diff in the pull request:
https://github.com/apache/spark/pull/7035#discussion_r33841943
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala
---
@@ -521,6 +521,55 @@ case class ShiftRight(left: Expression, right:
Expression) extends BinaryExpress
}
}
+case class ShiftRightUnsigned(left: Expression, right: Expression) extends
BinaryExpression {
+
+ override def checkInputDataTypes(): TypeCheckResult = {
+ (left.dataType, right.dataType) match {
+ case (NullType, _) | (_, NullType) => return
TypeCheckResult.TypeCheckSuccess
+ case (_, IntegerType) => left.dataType match {
+ case LongType | IntegerType | ShortType | ByteType =>
+ return TypeCheckResult.TypeCheckSuccess
+ case _ => // failed
+ }
+ case _ => // failed
+ }
+ TypeCheckResult.TypeCheckFailure(
+ s"ShiftRightUnsigned expects long, integer, short or byte value as
first argument and an " +
+ s"integer value as second argument, not (${left.dataType},
${right.dataType})")
+ }
+
+ override def eval(input: InternalRow): Any = {
+ val valueLeft = left.eval(input)
+ if (valueLeft != null) {
+ val valueRight = right.eval(input)
+ if (valueRight != null) {
+ left.dataType match {
--- End diff --
That one is interesting. Have you seen my comment? Can you have a look on
that gist: https://gist.github.com/tarekauel/6994983b83a51668c5dc. Am I getting
something wrong?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]