Skip to content

Commit 38c41cc

Browse files
Hisoka-Xhvanhovell
authored andcommitted
[SPARK-43405][SQL] Remove useless getRowFormatSQL, inputRowFormatSQL, outputRowFormatSQL method
### What changes were proposed in this pull request? Remove useless code in class `ScriptInputOutputSchema`. Include `getRowFormatSQL`, `inputRowFormatSQL`, `outputRowFormatSQL` method. It unused when #16869 ### Why are the changes needed? Clear code. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unnecessary. Closes #41063 from Hisoka-X/remove_useless_code. Authored-by: Hisoka <fanjiaeminem@qq.com> Signed-off-by: Herman van Hovell <herman@databricks.com>
1 parent 4def99d commit 38c41cc

File tree

1 file changed

+1
-50
lines changed

1 file changed

+1
-50
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/ScriptTransformation.scala

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -49,53 +49,4 @@ case class ScriptInputOutputSchema(
4949
outputSerdeProps: Seq[(String, String)],
5050
recordReaderClass: Option[String],
5151
recordWriterClass: Option[String],
52-
schemaLess: Boolean) {
53-
54-
def inputRowFormatSQL: Option[String] =
55-
getRowFormatSQL(inputRowFormat, inputSerdeClass, inputSerdeProps)
56-
57-
def outputRowFormatSQL: Option[String] =
58-
getRowFormatSQL(outputRowFormat, outputSerdeClass, outputSerdeProps)
59-
60-
/**
61-
* Get the row format specification
62-
* Note:
63-
* 1. Changes are needed when readerClause and writerClause are supported.
64-
* 2. Changes are needed when "ESCAPED BY" is supported.
65-
*/
66-
private def getRowFormatSQL(
67-
rowFormat: Seq[(String, String)],
68-
serdeClass: Option[String],
69-
serdeProps: Seq[(String, String)]): Option[String] = {
70-
if (schemaLess) return Some("")
71-
72-
val rowFormatDelimited =
73-
rowFormat.map {
74-
case ("TOK_TABLEROWFORMATFIELD", value) =>
75-
"FIELDS TERMINATED BY " + value
76-
case ("TOK_TABLEROWFORMATCOLLITEMS", value) =>
77-
"COLLECTION ITEMS TERMINATED BY " + value
78-
case ("TOK_TABLEROWFORMATMAPKEYS", value) =>
79-
"MAP KEYS TERMINATED BY " + value
80-
case ("TOK_TABLEROWFORMATLINES", value) =>
81-
"LINES TERMINATED BY " + value
82-
case ("TOK_TABLEROWFORMATNULL", value) =>
83-
"NULL DEFINED AS " + value
84-
case o => return None
85-
}
86-
87-
val serdeClassSQL = serdeClass.map("'" + _ + "'").getOrElse("")
88-
val serdePropsSQL =
89-
if (serdeClass.nonEmpty) {
90-
val props = serdeProps.map{p => s"'${p._1}' = '${p._2}'"}.mkString(", ")
91-
if (props.nonEmpty) " WITH SERDEPROPERTIES(" + props + ")" else ""
92-
} else {
93-
""
94-
}
95-
if (rowFormat.nonEmpty) {
96-
Some("ROW FORMAT DELIMITED " + rowFormatDelimited.mkString(" "))
97-
} else {
98-
Some("ROW FORMAT SERDE " + serdeClassSQL + serdePropsSQL)
99-
}
100-
}
101-
}
52+
schemaLess: Boolean)

0 commit comments

Comments
 (0)