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



##########
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:
       Got it!
   
   Then I think we should create the ticket and handle this separately.
   (Or, at least we should change the function name and type of input `pser`, 
and mention this fix in PR description with before & after examples)
   
   btw, actually I think we don't need to use `pandas_udf` here, though.




-- 
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-unsubscr...@spark.apache.org

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



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

Reply via email to