Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Commit c3a317f

Browse files
committed
Allow both str and StructType as schema in DataFrameReader and DataStreamReader csv / json (#522)
1 parent d967bda commit c3a317f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

third_party/3/pyspark/sql/readwriter.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DataFrameReader(OptionUtils):
2828
def json(
2929
self,
3030
path: Union[str, List[str], RDD[str]],
31-
schema: Optional[StructType] = ...,
31+
schema: Optional[Union[StructType, str]] = ...,
3232
primitivesAsString: Optional[Union[bool, str]] = ...,
3333
prefersDecimal: Optional[Union[bool, str]] = ...,
3434
allowComments: Optional[Union[bool, str]] = ...,
@@ -55,7 +55,7 @@ class DataFrameReader(OptionUtils):
5555
def csv(
5656
self,
5757
path: PathOrPaths,
58-
schema: Optional[StructType] = ...,
58+
schema: Optional[Union[StructType, str]] = ...,
5959
sep: Optional[str] = ...,
6060
encoding: Optional[str] = ...,
6161
quote: Optional[str] = ...,

third_party/3/pyspark/sql/streaming.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DataStreamReader(OptionUtils):
5959
def json(
6060
self,
6161
path: str,
62-
schema: Optional[str] = ...,
62+
schema: Optional[Union[StructType, str]] = ...,
6363
primitivesAsString: Optional[Union[bool, str]] = ...,
6464
prefersDecimal: Optional[Union[bool, str]] = ...,
6565
allowComments: Optional[Union[bool, str]] = ...,
@@ -83,7 +83,7 @@ class DataStreamReader(OptionUtils):
8383
def csv(
8484
self,
8585
path: str,
86-
schema: Optional[StructType] = ...,
86+
schema: Optional[Union[StructType, str]] = ...,
8787
sep: Optional[str] = ...,
8888
encoding: Optional[str] = ...,
8989
quote: Optional[str] = ...,

0 commit comments

Comments
 (0)