SaurabhChawla100 commented on pull request #32558:
URL: https://github.com/apache/spark/pull/32558#issuecomment-851428101
> I think we should also add the parameter at `csv` and `json` at
`DataFrameWriter`, `DataFrameReader`, `DataStreamReader`, `DataStreamWriter`
(and also `readwriter.py` and `streaming.py`). @itholic can you help review
this one please?
Not able to understand what paramater is needed to add in the csv and json
at at `DataFrameWriter`, `DataFrameReader`, `DataStreamReader`,
`DataStreamWriter` (and also `readwriter.py` and `streaming.py`).
There is already `private var extraOptions =
CaseInsensitiveMap[String](Map.empty)` and this code inserts the options that
are added to it in
```
def option(key: String, value: String): DataFrameReader = {
this.extraOptions = this.extraOptions + (key -> value)
this
}
```
So this is working on giving in the option.
```
scala> spark.read.option("inferSchema", "true").option("inferDateType",
"true").option("dateFormat", "yyyy-MM-dd").json(Seq("""{"a": {"b": 1, "c":
"2021-02-26"}}""").toDS()).schema
res18: org.apache.spark.sql.types.StructType =
StructType(StructField(a,StructType(StructField(b,LongType,true),
StructField(c,DateType,true)),true))
```
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]