bug fixed for hive sql format, fix #4092

This commit is contained in:
高铁
2020-12-26 06:54:58 +08:00
parent 0cdc717924
commit 78dc22fbfd
5 changed files with 17 additions and 13 deletions
@@ -46,10 +46,10 @@ public class HiveCreateTableTest_36_dla extends OracleTest {
String text = SQLUtils.toSQLString(stmt, JdbcConstants.HIVE);
assertEquals("CREATE TABLE dla_table1\n" +
"LIKE dla_table2\n" +
"TBLPROPERTIES (\n" +
"\t'column_mapping' = 'hello,world;james,bond;'\n" +
")\n" +
"LIKE dla_table2;", text);
");", text);
}
System.out.println("Tables : " + visitor.getTables());
@@ -29,10 +29,10 @@ public class HiveCreateTableTest_46_dla extends OracleTest {
SQLStatement stmt = SQLUtils.parseSingleStatement(sql, DbType.hive, SQLParserFeature.KeepComments);
assertEquals("CREATE EXTERNAL TABLE parquet_tbl\n" +
"LIKE MAPPING('oss://user/etl/destination/datafile1.dat')\n" +
"TBLPROPERTIES (\n" +
"\t'target.table.location' = 'oss://user/etl/destination/'\n" +
")\n" +
"LIKE MAPPING('oss://user/etl/destination/datafile1.dat')", stmt.toString());
")", stmt.toString());
assertEquals(stmt.toString(), SQLUtils.parseSingleStatement(stmt.toString(), DbType.hive, SQLParserFeature.KeepComments).toString());
}
@@ -44,6 +44,10 @@ public class HiveResourceTest extends TestCase {
exec_test("bvt/parser/hive-2.txt");
}
public void test_3() throws Exception {
exec_test("bvt/parser/hive-3.txt");
}
public void exec_test(String resource) throws Exception {
// System.out.println(resource);
InputStream is = null;