Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/11048#discussion_r54802393
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/CatalystQl.scala
---
@@ -90,92 +85,13 @@ private[sql] class CatalystQl(val conf: ParserConf =
SimpleParserConf()) extends
}
}
- protected def getClauses(
- clauseNames: Seq[String],
- nodeList: Seq[ASTNode]): Seq[Option[ASTNode]] = {
- var remainingNodes = nodeList
- val clauses = clauseNames.map { clauseName =>
- val (matches, nonMatches) =
remainingNodes.partition(_.text.toUpperCase == clauseName)
- remainingNodes = nonMatches ++ (if (matches.nonEmpty) matches.tail
else Nil)
- matches.headOption
- }
-
- if (remainingNodes.nonEmpty) {
- sys.error(
- s"""Unhandled clauses:
${remainingNodes.map(_.treeString).mkString("\n")}.
- |You are likely trying to use an unsupported Hive
feature."""".stripMargin)
- }
- clauses
- }
-
- protected def getClause(clauseName: String, nodeList: Seq[ASTNode]):
ASTNode =
- getClauseOption(clauseName, nodeList).getOrElse(sys.error(
- s"Expected clause $clauseName missing from
${nodeList.map(_.treeString).mkString("\n")}"))
-
- protected def getClauseOption(clauseName: String, nodeList:
Seq[ASTNode]): Option[ASTNode] = {
- nodeList.filter { case ast: ASTNode => ast.text == clauseName } match {
- case Seq(oneMatch) => Some(oneMatch)
- case Seq() => None
- case _ => sys.error(s"Found multiple instances of clause
$clauseName")
- }
- }
-
- protected def nodeToAttribute(node: ASTNode): Attribute = node match {
+ def nodeToAttribute(node: ASTNode): Attribute = node match {
--- End diff --
actually, the only usage is `parseDdl`, which is not used anywhere. Would
you mind deleting this method and `parseDdl` to simplify the code?
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]