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/11/01 05:30:46 UTC

[GitHub] [spark] amaliujia commented on a diff in pull request #38460: [SPARK-40981][CONNECT][PYTHON] Support session.range in Python client

amaliujia commented on code in PR #38460:
URL: https://github.com/apache/spark/pull/38460#discussion_r1010084257


##########
python/pyspark/sql/connect/client.py:
##########
@@ -145,6 +145,39 @@ def _build_metrics(self, metrics: "pb2.Response.Metrics") -> typing.List[PlanMet
     def sql(self, sql_string: str) -> "DataFrame":
         return DataFrame.withPlan(SQL(sql_string), self)
 
+    def range(
+        self,
+        start: int,
+        end: int,
+        step: Optional[int] = None,

Review Comment:
   hmmm we are not marking `step` as required because Scala side implementation does not treat it as required and it has a default value.
   
   ```
     private def transformRange(rel: proto.Range): LogicalPlan = {
       val start = rel.getStart
       val end = rel.getEnd
       val step = if (rel.hasStep) {
         rel.getStep.getStep
       } else {
         1
       }
       val numPartitions = if (rel.hasNumPartitions) {
         rel.getNumPartitions.getNumPartitions
       } else {
         session.leafNodeDefaultParallelism
       }
       logical.Range(start, end, step, numPartitions)
     }
   ```



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