-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-16515][SQL]set default record reader and writer for script transformation #14169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1306,7 +1306,7 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder { | |
|
|
||
| // Decode and input/output format. | ||
| type Format = (Seq[(String, String)], Option[String], Seq[(String, String)], Option[String]) | ||
| def format(fmt: RowFormatContext, configKey: String): Format = fmt match { | ||
| def format(fmt: RowFormatContext, configKey: String, configValue: String): Format = fmt match { | ||
| case c: RowFormatDelimitedContext => | ||
| // TODO we should use the visitRowFormatDelimited function here. However HiveScriptIOSchema | ||
| // expects a seq of pairs in which the old parsers' token names are used as keys. | ||
|
|
@@ -1329,7 +1329,7 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder { | |
|
|
||
| // SPARK-10310: Special cases LazySimpleSerDe | ||
| val recordHandler = if (name == "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe") { | ||
| Try(conf.getConfString(configKey)).toOption | ||
| Try(conf.getConfString(configKey, configValue)).toOption | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we just use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value is different for different |
||
| } else { | ||
| None | ||
| } | ||
|
|
@@ -1340,15 +1340,18 @@ 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 = Try(conf.getConfString(configKey, configValue)).toOption | ||
| (Nil, Option(name), props, recordHandler) | ||
| } | ||
|
|
||
| val (inFormat, inSerdeClass, inSerdeProps, reader) = | ||
| format(inRowFormat, "hive.script.recordreader") | ||
| format( | ||
| inRowFormat, "hive.script.recordreader", "org.apache.hadoop.hive.ql.exec.TextRecordReader") | ||
|
|
||
| val (outFormat, outSerdeClass, outSerdeProps, writer) = | ||
| format(outRowFormat, "hive.script.recordwriter") | ||
| format( | ||
| outRowFormat, "hive.script.recordwriter", | ||
| "org.apache.hadoop.hive.ql.exec.TextRecordWriter") | ||
|
|
||
| ScriptInputOutputSchema( | ||
| inFormat, outFormat, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| while read line | ||
| do | ||
| echo "$line" | sed 's/\t/_/' | ||
| done < /dev/stdin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name should show that this value is default value, right?