You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/11 02:46:36 UTC

[GitHub] [spark] zhengruifeng commented on a diff in pull request #39016: [SPARK-41477][CONNECT][PYTHON] Correctly infer the datatype of literal integers

zhengruifeng commented on code in PR #39016:
URL: https://github.com/apache/spark/pull/39016#discussion_r1045163077


##########
python/pyspark/sql/connect/column.py:
##########
@@ -180,7 +186,12 @@ def to_plan(self, session: "SparkConnectClient") -> "proto.Expression":
         elif isinstance(self._value, bool):
             expr.literal.boolean = bool(self._value)
         elif isinstance(self._value, int):
-            expr.literal.long = int(self._value)
+            if JVM_INT_MIN <= self._value <= JVM_INT_MAX:

Review Comment:
   I think the conversion [happens here](https://github.com/py4j/py4j/blob/master/py4j-java/src/main/java/py4j/Protocol.java#L281-L316)
   
   It seems py4j doesn't deal with `Byte` and `Short`
   
   If there is an expression only accept a ByteType, then I think it will be the same problem.
   
   also cc @HyukjinKwon @xinrong-meng who knows py4j better then me.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org