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

    https://github.com/apache/spark/pull/14169#discussion_r71102534
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
    @@ -1340,10 +1340,17 @@ class SparkSqlAstBuilder(conf: SQLConf) extends 
AstBuilder {
             val name = conf.getConfString("hive.script.serde",
               "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe")
             val props = Seq("field.delim" -> "\t")
    -        val recordHandler = Try(conf.getConfString(configKey)).toOption
    +        val recordHandler = defaultRecordHandler(configKey)
             (Nil, Option(name), props, recordHandler)
         }
     
    +    def defaultRecordHandler(configKey: String): Option[String] = {
    +      Try(conf.getConfString(configKey)).orElse(Try(configKey match {
    +        case "hive.script.recordreader" => 
"org.apache.hadoop.hive.ql.exec.TextRecordReader"
    +        case "hive.script.recordwriter" => 
"org.apache.hadoop.hive.ql.exec.TextRecordWriter"
    +      })).toOption
    +    }
    +
         val (inFormat, inSerdeClass, inSerdeProps, reader) =
           format(inRowFormat, "hive.script.recordreader")
    --- End diff --
    
    Can we pass in the default value for the reader/writer? like 
`format(inRowFormat, "hive.script.recordreader", 
"org.apache.hadoop.hive.ql.exec.TextRecordReader")` and `format(outRowFormat, 
"hive.script.recordwriter", 
"org.apache.hadoop.hive.ql.exec.TextRecordWriter")`. Then, in `def format`, we 
just use `getConfString(key: String, defaultValue: String)`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to