diff --git ivy/libraries.properties ivy/libraries.properties index 49b4b61..ae62d22 100644 --- ivy/libraries.properties +++ ivy/libraries.properties @@ -66,10 +66,8 @@ sqlline.branch=1.0.2 slf4j-api.version=1.6.1 slf4j-log4j12.version=1.6.1 ST4.version=4.0.4 -stringtemplate.version=3.2.1 tempus-fugit.version=1.1 snappy.version=0.2 velocity.version=1.5 zookeeper.version=3.4.3 javolution.version=5.5.1 -stringtemplate.version=3.2.1 diff --git metastore/ivy.xml metastore/ivy.xml index a13cff7..6c1b37f 100644 --- metastore/ivy.xml +++ metastore/ivy.xml @@ -29,7 +29,6 @@ - diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java index 6895759..109a6d9 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java @@ -45,7 +45,6 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.antlr.stringtemplate.StringTemplate; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -165,6 +164,7 @@ import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.util.ToolRunner; +import org.stringtemplate.v4.ST; /** * DDLTask implementation. @@ -1948,17 +1948,17 @@ private int showCreateTable(Hive db, ShowCreateTableDesc showCreateTbl) throws H return 0; } - StringTemplate createTab_stmt = new StringTemplate("CREATE $" + EXTERNAL + "$ TABLE " + + ST createTab_stmt = new ST("CREATE <" + EXTERNAL + "> TABLE " + tableName + "(\n" + - "$" + LIST_COLUMNS + "$)\n" + - "$" + TBL_COMMENT + "$\n" + - "$" + LIST_PARTITIONS + "$\n" + - "$" + SORT_BUCKET + "$\n" + - "$" + ROW_FORMAT + "$\n" + + "<" + LIST_COLUMNS + ">)\n" + + "<" + TBL_COMMENT + ">\n" + + "<" + LIST_PARTITIONS + ">\n" + + "<" + SORT_BUCKET + ">\n" + + "<" + ROW_FORMAT + ">\n" + "LOCATION\n" + - "$" + TBL_LOCATION + "$\n" + + "<" + TBL_LOCATION + ">\n" + "TBLPROPERTIES (\n" + - "$" + TBL_PROPERTIES + "$)\n"); + "<" + TBL_PROPERTIES + ">)\n"); // For cases where the table is external String tbl_external = ""; @@ -2115,16 +2115,16 @@ else if (sortCol.getOrder() == BaseSemanticAnalyzer.HIVE_COLUMN_ORDER_DESC) { tbl_properties += StringUtils.join(realProps, ", \n"); } - createTab_stmt.setAttribute(EXTERNAL, tbl_external); - createTab_stmt.setAttribute(LIST_COLUMNS, tbl_columns); - createTab_stmt.setAttribute(TBL_COMMENT, tbl_comment); - createTab_stmt.setAttribute(LIST_PARTITIONS, tbl_partitions); - createTab_stmt.setAttribute(SORT_BUCKET, tbl_sort_bucket); - createTab_stmt.setAttribute(ROW_FORMAT, tbl_row_format); - createTab_stmt.setAttribute(TBL_LOCATION, tbl_location); - createTab_stmt.setAttribute(TBL_PROPERTIES, tbl_properties); + createTab_stmt.add(EXTERNAL, tbl_external); + createTab_stmt.add(LIST_COLUMNS, tbl_columns); + createTab_stmt.add(TBL_COMMENT, tbl_comment); + createTab_stmt.add(LIST_PARTITIONS, tbl_partitions); + createTab_stmt.add(SORT_BUCKET, tbl_sort_bucket); + createTab_stmt.add(ROW_FORMAT, tbl_row_format); + createTab_stmt.add(TBL_LOCATION, tbl_location); + createTab_stmt.add(TBL_PROPERTIES, tbl_properties); - outStream.writeBytes(createTab_stmt.toString()); + outStream.writeBytes(createTab_stmt.render()); ((FSDataOutputStream) outStream).close(); outStream = null; } catch (FileNotFoundException e) {