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 2020/09/07 05:03:26 UTC

[GitHub] [spark] zero323 commented on a change in pull request #29591: [SPARK-32714][PYTHON] Initial pyspark-stubs port.

zero323 commented on a change in pull request #29591:
URL: https://github.com/apache/spark/pull/29591#discussion_r484184260



##########
File path: examples/src/main/python/ml/estimator_transformer_param_example.py
##########
@@ -54,7 +56,7 @@
     print(model1.extractParamMap())
 
     # We may alternatively specify parameters using a Python dictionary as a paramMap
-    paramMap = {lr.maxIter: 20}
+    paramMap: Dict[Param, Any] = {lr.maxIter: 20}

Review comment:
       It is. In such cases  Mypy infers the type of `paramMap` to be `Dict[Param, int]` and will fail on subsequent update:
   
   ```python
   paramMap.update({lr.regParam: 0.1, lr.threshold: 0.55}) 
   ```
   
   In general I'd prefer to keep tests against examples as these are the biggest chunks of "real-life" code (short of docstrings, but these create way more issues)  that we have and nicely highlight many possible problems.
   
   In `pyspark-stubs` I simply clone the repo and [patch examples](https://github.com/zero323/pyspark-stubs/blob/faad51cfd4b8971cda889f79c6857dd28ad62078/.travis.yml#L11-L12) before tests. 
   




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

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