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 2021/09/06 08:54:44 UTC

[GitHub] [spark] beobest2 commented on a change in pull request #33744: [SPARK-36403][PYTHON] Implement `Index.putmask`

beobest2 commented on a change in pull request #33744:
URL: https://github.com/apache/spark/pull/33744#discussion_r702726132



##########
File path: python/pyspark/pandas/typedef/typehints.py
##########
@@ -323,7 +323,7 @@ def infer_pd_series_spark_type(pser: pd.Series, dtype: Dtype) -> types.DataType:
     if dtype == np.dtype("object"):
         if len(pser) == 0 or pser.isnull().all():
             return types.NullType()
-        elif hasattr(pser.iloc[0], "__UDT__"):
+        elif hasattr(pser, "iloc") and hasattr(pser.iloc[0], "__UDT__"):

Review comment:
       At this point : https://github.com/apache/spark/pull/33744/files#diff-c19199b1eb4ba73f00acb31a2c2c055be95b697fd08049ee6ba54655392adfa5R1984
   
   If the type of input parameter `value` of  this `putmask` is `Index` , 
   the function `infer_pd_series_spark_type` raises the exception, because  `Index` type doesn't have `iloc` attribute.
   This is why I fix this part. I thought that it had no effect on the operation of the existing `Series` type.




-- 
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