ueshin commented on a change in pull request #34216:
URL: https://github.com/apache/spark/pull/34216#discussion_r727373100
##########
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:
nit: I don't think we need `-> None` for the initializer.
##########
File path: python/pyspark/sql/readwriter.py
##########
@@ -537,16 +691,16 @@ class DataFrameWriter(OptionUtils):
.. versionadded:: 1.4
"""
- def __init__(self, df):
+ def __init__(self, df: "DataFrame") -> None:
Review comment:
ditto.
##########
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:
nit: `"RDD[str]"` instead of `RDD`?
##########
File path: python/pyspark/sql/readwriter.py
##########
@@ -1046,13 +1301,13 @@ class DataFrameWriterV2(object):
.. versionadded:: 3.1.0
"""
- def __init__(self, df, table):
+ def __init__(self, df: "DataFrame", table: str) -> None:
Review comment:
ditto.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]