diff options
author | Herman van Hovell <hvanhovell@questtec.nl> | 2016-03-31 09:25:09 -0700 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2016-03-31 09:25:09 -0700 |
commit | a9b93e07391faede77dde4c0b3c21c9b3f97f8eb (patch) | |
tree | ebcdf8cef08c6c14efadd5186097c7ceb8fc1738 /project/SparkBuild.scala | |
parent | 26445c2e472bad137fd350e4089dd0ff43a42039 (diff) | |
download | spark-a9b93e07391faede77dde4c0b3c21c9b3f97f8eb.tar.gz spark-a9b93e07391faede77dde4c0b3c21c9b3f97f8eb.tar.bz2 spark-a9b93e07391faede77dde4c0b3c21c9b3f97f8eb.zip |
[SPARK-14211][SQL] Remove ANTLR3 based parser
### What changes were proposed in this pull request?
This PR removes the ANTLR3 based parser, and moves the new ANTLR4 based parser into the `org.apache.spark.sql.catalyst.parser package`.
### How was this patch tested?
Existing unit tests.
cc rxin andrewor14 yhuai
Author: Herman van Hovell <hvanhovell@questtec.nl>
Closes #12071 from hvanhovell/SPARK-14211.
Diffstat (limited to 'project/SparkBuild.scala')
-rw-r--r-- | project/SparkBuild.scala | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index 39a9e16f7e..5d62b688b9 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -403,59 +403,9 @@ object OldDeps { object Catalyst { lazy val settings = antlr4Settings ++ Seq( - antlr4PackageName in Antlr4 := Some("org.apache.spark.sql.catalyst.parser.ng"), + antlr4PackageName in Antlr4 := Some("org.apache.spark.sql.catalyst.parser"), antlr4GenListener in Antlr4 := true, - antlr4GenVisitor in Antlr4 := true, - // ANTLR code-generation step. - // - // This has been heavily inspired by com.github.stefri.sbt-antlr (0.5.3). It fixes a number of - // build errors in the current plugin. - // Create Parser from ANTLR grammar files. - sourceGenerators in Compile += Def.task { - val log = streams.value.log - - val grammarFileNames = Seq( - "SparkSqlLexer.g", - "SparkSqlParser.g") - val sourceDir = (sourceDirectory in Compile).value / "antlr3" - val targetDir = (sourceManaged in Compile).value / "antlr3" - - // Create default ANTLR Tool. - val antlr = new org.antlr.Tool - - // Setup input and output directories. - antlr.setInputDirectory(sourceDir.getPath) - antlr.setOutputDirectory(targetDir.getPath) - antlr.setForceRelativeOutput(true) - antlr.setMake(true) - - // Add grammar files. - grammarFileNames.flatMap(gFileName => (sourceDir ** gFileName).get).foreach { gFilePath => - val relGFilePath = (gFilePath relativeTo sourceDir).get.getPath - log.info("ANTLR: Grammar file '%s' detected.".format(relGFilePath)) - antlr.addGrammarFile(relGFilePath) - // We will set library directory multiple times here. However, only the - // last one has effect. Because the grammar files are located under the same directory, - // We assume there is only one library directory. - antlr.setLibDirectory(gFilePath.getParent) - } - - // Generate the parser. - antlr.process() - val errorState = org.antlr.tool.ErrorManager.getErrorState - if (errorState.errors > 0) { - sys.error("ANTLR: Caught %d build errors.".format(errorState.errors)) - } else if (errorState.warnings > 0) { - sys.error("ANTLR: Caught %d build warnings.".format(errorState.warnings)) - } - - // Return all generated java files. - (targetDir ** "*.java").get.toSeq - }.taskValue, - // Include ANTLR tokens files. - resourceGenerators in Compile += Def.task { - ((sourceManaged in Compile).value ** "*.tokens").get.toSeq - }.taskValue + antlr4GenVisitor in Antlr4 := true ) } |