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/10/13 20:05:58 UTC

[GitHub] [spark] xinrong-databricks commented on a change in pull request #34216: [SPARK-36942][PYTHON] Inline type hints for python/pyspark/sql/readwriter.py

xinrong-databricks commented on a change in pull request #34216:
URL: https://github.com/apache/spark/pull/34216#discussion_r728407108



##########
File path: python/pyspark/sql/readwriter.py
##########
@@ -158,19 +189,43 @@ def load(self, path=None, format=None, schema=None, **options):
             return self._df(self._jreader.load(path))
         elif path is not None:
             if type(path) != list:
-                path = [path]
-            return self._df(self._jreader.load(self._spark._sc._jvm.PythonUtils.toSeq(path)))
+                path = [path]  # type: ignore[list-item]
+            return self._df(
+                self._jreader.load(
+                    self._spark._sc._jvm.PythonUtils.toSeq(path)  # type: ignore[attr-defined]
+                )
+            )
         else:
             return self._df(self._jreader.load())
 
-    def json(self, path, schema=None, primitivesAsString=None, prefersDecimal=None,
-             allowComments=None, allowUnquotedFieldNames=None, allowSingleQuotes=None,
-             allowNumericLeadingZero=None, allowBackslashEscapingAnyCharacter=None,
-             mode=None, columnNameOfCorruptRecord=None, dateFormat=None, timestampFormat=None,
-             multiLine=None, allowUnquotedControlChars=None, lineSep=None, samplingRatio=None,
-             dropFieldIfAllNull=None, encoding=None, locale=None, pathGlobFilter=None,
-             recursiveFileLookup=None, allowNonNumericNumbers=None,
-             modifiedBefore=None, modifiedAfter=None):
+    def json(
+        self,
+        path: Union[str, List[str], RDD],

Review comment:
       Thanks, updated.

##########
File path: python/pyspark/sql/readwriter.py
##########
@@ -49,15 +72,15 @@ class DataFrameReader(OptionUtils):
     .. versionadded:: 1.4
     """
 
-    def __init__(self, spark):
-        self._jreader = spark._ssql_ctx.read()
+    def __init__(self, spark: "SQLContext") -> None:

Review comment:
       Updated.




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