You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/08/31 03:13:02 UTC

[GitHub] [spark] zhengruifeng opened a new pull request, #42743: [SPARK-45018][PYTHON][CONNECT] Add CalendarIntervalType to Python Client

zhengruifeng opened a new pull request, #42743:
URL: https://github.com/apache/spark/pull/42743

   ### What changes were proposed in this pull request?
   Add CalendarIntervalType to Python Client
   
   
   ### Why are the changes needed?
   for feature parity
   
   
   ### Does this PR introduce _any_ user-facing change?
   yes
   
   before this PR:
   ```
   In [1]: from pyspark.sql import functions as sf
   
   In [2]: spark.range(1).select(sf.make_interval(sf.lit(1))).schema
   ---------------------------------------------------------------------------
   Exception                                 Traceback (most recent call last)
   Cell In[2], line 1
   ----> 1 spark.range(1).select(sf.make_interval(sf.lit(1))).schema
   
   File ~/Dev/spark/python/pyspark/sql/connect/dataframe.py:1687, in DataFrame.schema(self)
      1685     if self._session is None:
      1686         raise Exception("Cannot analyze without SparkSession.")
   -> 1687     return self._session.client.schema(query)
      1688 else:
      1689     raise Exception("Empty plan.")
   
   ...
   
   Exception: Unsupported data type calendar_interval 
   ```
   
   after this PR:
   ```
   Welcome to
         ____              __
        / __/__  ___ _____/ /__
       _\ \/ _ \/ _ `/ __/  '_/
      /__ / .__/\_,_/_/ /_/\_\   version 4.0.0.dev0
         /_/
   
   Using Python version 3.10.11 (main, May 17 2023 14:30:36)
   Client connected to the Spark Connect server at localhost
   SparkSession available as 'spark'.
   
   In [1]: from pyspark.sql import functions as sf
   
   In [2]: spark.range(1).select(sf.make_interval(sf.lit(1))).schema
   Out[2]: StructType([StructField('make_interval(1, 0, 0, 0, 0, 0, 0)', CalendarIntervalType(), True)])
   ```
   
   
   ### How was this patch tested?
   added UT
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   NO


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


[GitHub] [spark] zhengruifeng commented on a diff in pull request #42743: [SPARK-45018][PYTHON][CONNECT] Add CalendarIntervalType to Python Client

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on code in PR #42743:
URL: https://github.com/apache/spark/pull/42743#discussion_r1311046624


##########
python/pyspark/sql/tests/connect/test_parity_types.py:
##########
@@ -86,7 +86,7 @@ def test_rdd_with_udt(self):
     def test_udt(self):
         super().test_udt()
 
-    @unittest.skip("SPARK-45018: should support CalendarIntervalType")
+    @unittest.skip("SPARK-45026: spark.sql should support datatypes not compatible with arrow")

Review Comment:
   ```
   spark.sql("SELECT make_interval(100, 11, 1, 1, 12, 30, 01.001001)")
   
   ...
   
   pyspark.errors.exceptions.connect.UnsupportedOperationException: [UNSUPPORTED_DATATYPE] Unsupported data type "INTERVAL".
   
   ```
   
   `spark.sql("SELECT make_interval(100, 11, 1, 1, 12, 30, 01.001001)")` won't work in python client, not because of the newly added `CalendarIntervalType` itself, but because the `spark.sql` internally creates arrow batch while `CalendarIntervalType` is [not arrow-compatible now](https://github.com/apache/spark/blob/3dcee0ccf7e02acd162da652450b85d34dc4e297/sql/api/src/main/scala/org/apache/spark/sql/util/ArrowUtils.scala#L62-L63).
   
   here needs further investigation, so I create a new ticket for it.



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


[GitHub] [spark] zhengruifeng closed pull request #42743: [SPARK-45018][PYTHON][CONNECT] Add CalendarIntervalType to Python Client

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #42743: [SPARK-45018][PYTHON][CONNECT] Add CalendarIntervalType to Python Client
URL: https://github.com/apache/spark/pull/42743


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


[GitHub] [spark] zhengruifeng commented on pull request #42743: [SPARK-45018][PYTHON][CONNECT] Add CalendarIntervalType to Python Client

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #42743:
URL: https://github.com/apache/spark/pull/42743#issuecomment-1700323374

   CI link: https://github.com/zhengruifeng/spark/actions/runs/6032590329


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


[GitHub] [spark] zhengruifeng commented on pull request #42743: [SPARK-45018][PYTHON][CONNECT] Add CalendarIntervalType to Python Client

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #42743:
URL: https://github.com/apache/spark/pull/42743#issuecomment-1700510006

   thanks, merged to master


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