Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20937#discussion_r178478271
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/json/JsonDataSource.scala
 ---
    @@ -175,33 +185,43 @@ object MultiLineJsonDataSource extends JsonDataSource 
{
           .values
       }
     
    -  private def createParser(jsonFactory: JsonFactory, record: 
PortableDataStream): JsonParser = {
    +  private def createParser(
    +      jsonFactory: JsonFactory,
    +      record: PortableDataStream,
    +      charset: Option[String] = None): JsonParser = {
         val path = new Path(record.getPath())
         CreateJacksonParser.inputStream(
           jsonFactory,
    -      
CodecStreams.createInputStreamWithCloseResource(record.getConfiguration, path))
    +      
CodecStreams.createInputStreamWithCloseResource(record.getConfiguration, path),
    +      charset
    +    )
       }
     
       override def readFile(
           conf: Configuration,
           file: PartitionedFile,
           parser: JacksonParser,
           schema: StructType): Iterator[InternalRow] = {
    +    def createInputStream() = {
    --- End diff --
    
    I admit it but nested function is a thing to avoid too unless if it really 
cleans up the codes or is required. Let's just leave it as was if both don't 
look quite cool .. :). At least that's usually what I do.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to