Repository: tajo Updated Branches: refs/heads/master 3ba262412 -> e12e038b5
http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java index 7fdfb44..120113f 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestNLJoinExec.java @@ -78,10 +78,10 @@ public class TestNLJoinExec { sm = StorageManagerFactory.getStorageManager(conf, testDir); Schema schema = new Schema(); - schema.addColumn("managerId", Type.INT4); - schema.addColumn("empId", Type.INT4); - schema.addColumn("memId", Type.INT4); - schema.addColumn("deptName", Type.TEXT); + schema.addColumn("managerid", Type.INT4); + schema.addColumn("empid", Type.INT4); + schema.addColumn("memid", Type.INT4); + schema.addColumn("deptname", Type.TEXT); TableMeta employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV); Path employeePath = new Path(testDir, "employee.csv"); @@ -102,8 +102,8 @@ public class TestNLJoinExec { catalog.createTable(employee); Schema peopleSchema = new Schema(); - peopleSchema.addColumn("empId", Type.INT4); - peopleSchema.addColumn("fk_memId", Type.INT4); + peopleSchema.addColumn("empid", Type.INT4); + peopleSchema.addColumn("fk_memid", Type.INT4); peopleSchema.addColumn("name", Type.TEXT); peopleSchema.addColumn("age", Type.INT4); TableMeta peopleMeta = CatalogUtil.newTableMeta(StoreType.CSV); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java index c7aa33d..f32cd1e 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestPhysicalPlanner.java @@ -105,11 +105,11 @@ public class TestPhysicalPlanner { Schema employeeSchema = new Schema(); employeeSchema.addColumn("name", Type.TEXT); - employeeSchema.addColumn("empId", Type.INT4); - employeeSchema.addColumn("deptName", Type.TEXT); + employeeSchema.addColumn("empid", Type.INT4); + employeeSchema.addColumn("deptname", Type.TEXT); Schema scoreSchema = new Schema(); - scoreSchema.addColumn("deptName", Type.TEXT); + scoreSchema.addColumn("deptname", Type.TEXT); scoreSchema.addColumn("class", Type.TEXT); scoreSchema.addColumn("score", Type.INT4); scoreSchema.addColumn("nullable", Type.TEXT); @@ -526,7 +526,7 @@ public class TestPhysicalPlanner { LogicalPlan plan = planner.createPlan(session, context); int numPartitions = 3; - Column key1 = new Column("default.score.deptName", Type.TEXT); + Column key1 = new Column("default.score.deptname", Type.TEXT); Column key2 = new Column("default.score.class", Type.TEXT); DataChannel dataChannel = new DataChannel(masterPlan.newExecutionBlockId(), masterPlan.newExecutionBlockId(), ShuffleType.HASH_SHUFFLE, numPartitions); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java index 65b5dba..c60e05c 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestProgressExternalSortExec.java @@ -82,9 +82,9 @@ public class TestProgressExternalSortExec { sm = StorageManagerFactory.getStorageManager(conf, testDir); Schema schema = new Schema(); - schema.addColumn("managerId", TajoDataTypes.Type.INT4); - schema.addColumn("empId", TajoDataTypes.Type.INT4); - schema.addColumn("deptName", TajoDataTypes.Type.TEXT); + schema.addColumn("managerid", TajoDataTypes.Type.INT4); + schema.addColumn("empid", TajoDataTypes.Type.INT4); + schema.addColumn("deptname", TajoDataTypes.Type.TEXT); TableMeta employeeMeta = CatalogUtil.newTableMeta(CatalogProtos.StoreType.RAW); Path employeePath = new Path(testDir, "employee.csv"); @@ -171,8 +171,8 @@ public class TestProgressExternalSortExec { exec.init(); TupleComparator comparator = new TupleComparator(proj.getSchema(), new SortSpec[]{ - new SortSpec(new Column("managerId", TajoDataTypes.Type.INT4)), - new SortSpec(new Column("empId", TajoDataTypes.Type.INT4)) + new SortSpec(new Column("managerid", TajoDataTypes.Type.INT4)), + new SortSpec(new Column("empid", TajoDataTypes.Type.INT4)) }); float initProgress = 0.0f; http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java index a33a0e4..87262e8 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/planner/physical/TestSortExec.java @@ -70,9 +70,9 @@ public class TestSortExec { sm = StorageManagerFactory.getStorageManager(conf, workDir); Schema schema = new Schema(); - schema.addColumn("managerId", Type.INT4); - schema.addColumn("empId", Type.INT4); - schema.addColumn("deptName", Type.TEXT); + schema.addColumn("managerid", Type.INT4); + schema.addColumn("empid", Type.INT4); + schema.addColumn("deptname", Type.TEXT); employeeMeta = CatalogUtil.newTableMeta(StoreType.CSV); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java index 79db68c..e61f509 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java @@ -26,6 +26,7 @@ import org.apache.tajo.QueryTestCaseBase; import org.apache.tajo.TajoConstants; import org.apache.tajo.TajoTestingCluster; import org.apache.tajo.catalog.CatalogService; +import org.apache.tajo.catalog.CatalogUtil; import org.apache.tajo.catalog.TableDesc; import org.apache.tajo.catalog.partition.PartitionMethodDesc; import org.apache.tajo.catalog.proto.CatalogProtos; @@ -56,12 +57,13 @@ public class TestCTASQuery extends QueryTestCaseBase { ResultSet res = executeQuery(); res.close(); + String tableName = CatalogUtil.normalizeIdentifier("testCtasWithoutTableDefinition"); CatalogService catalog = testBase.getTestingCluster().getMaster().getCatalog(); - String tableName = buildFQName(DEFAULT_DATABASE_NAME, "testCtasWithoutTableDefinition"); - TableDesc desc = catalog.getTableDesc(tableName); - assertTrue(catalog.existsTable(tableName)); + String qualifiedTableName = buildFQName(DEFAULT_DATABASE_NAME, tableName); + TableDesc desc = catalog.getTableDesc(qualifiedTableName); + assertTrue(catalog.existsTable(qualifiedTableName)); - assertTrue(desc.getSchema().contains("default.testCtasWithoutTableDefinition.col1")); + assertTrue(desc.getSchema().contains("default.testctaswithouttabledefinition.col1")); PartitionMethodDesc partitionDesc = desc.getPartitionMethod(); assertEquals(partitionDesc.getPartitionType(), CatalogProtos.PartitionType.COLUMN); assertEquals("key", partitionDesc.getExpressionSchema().getColumns().get(0).getSimpleName()); @@ -99,10 +101,12 @@ public class TestCTASQuery extends QueryTestCaseBase { ResultSet res = executeQuery(); res.close(); + String tableName = CatalogUtil.normalizeIdentifier("testCtasWithColumnedPartition"); + TajoTestingCluster cluster = testBase.getTestingCluster(); CatalogService catalog = cluster.getMaster().getCatalog(); - TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, "testCtasWithColumnedPartition"); - assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, "testCtasWithColumnedPartition")); + TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName); + assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); PartitionMethodDesc partitionDesc = desc.getPartitionMethod(); assertEquals(partitionDesc.getPartitionType(), CatalogProtos.PartitionType.COLUMN); assertEquals("key", partitionDesc.getExpressionSchema().getColumns().get(0).getSimpleName()); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java index c1c2591..453c174 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateDatabase.java @@ -20,6 +20,7 @@ package org.apache.tajo.engine.query; import org.apache.tajo.IntegrationTest; import org.apache.tajo.QueryTestCaseBase; +import org.apache.tajo.catalog.CatalogUtil; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -30,12 +31,14 @@ public class TestCreateDatabase extends QueryTestCaseBase { @Test public final void testCreateAndDropDatabase() throws Exception { + String databaseName = CatalogUtil.normalizeIdentifier("testCreateAndDropDatabase"); + ResultSet res = null; try { res = executeString("CREATE DATABASE testCreateAndDropDatabase;"); - assertDatabaseExists("testCreateAndDropDatabase"); + assertDatabaseExists(databaseName); executeString("DROP DATABASE testCreateAndDropDatabase;"); - assertDatabaseNotExists("testCreateAndDropDatabase"); + assertDatabaseNotExists(databaseName); } finally { cleanupQuery(res); } @@ -43,7 +46,7 @@ public class TestCreateDatabase extends QueryTestCaseBase { @Test public final void testCreateIfNotExists() throws Exception { - String databaseName = "testCreateIfNotExists"; + String databaseName = CatalogUtil.normalizeIdentifier("testCreateIfNotExists"); assertDatabaseNotExists(databaseName); executeString("CREATE DATABASE " + databaseName + ";").close(); @@ -58,7 +61,7 @@ public class TestCreateDatabase extends QueryTestCaseBase { @Test public final void testDropIfExists() throws Exception { - String databaseName = "testDropIfExists"; + String databaseName = CatalogUtil.normalizeIdentifier("testDropIfExists"); assertDatabaseNotExists(databaseName); executeString("CREATE DATABASE " + databaseName + ";").close(); assertDatabaseExists(databaseName); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java index f2882dd..a5b57b2 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java @@ -23,6 +23,7 @@ import org.apache.tajo.QueryTestCaseBase; import org.junit.Test; import org.junit.experimental.categories.Category; +import java.sql.ResultSet; import java.util.List; @Category(IntegrationTest.class) @@ -108,6 +109,75 @@ public class TestCreateTable extends QueryTestCaseBase { } @Test + public final void testDelimitedIdentifierWithNonAsciiCharacters() throws Exception { + + if (!testingCluster.isHCatalogStoreRunning()) { + ResultSet res = null; + try { + List<String> tableNames = executeDDL("quoted_identifier_non_ascii_ddl.sql", "table1", "\"í ì´ë¸1\""); + assertTableExists(tableNames.get(0)); + + // SELECT "ìì´ë", "í ì¤í¸", "ì«ì" FROM "í ì´ë¸1"; + res = executeFile("quoted_identifier_non_ascii_1.sql"); + assertResultSet(res, "quoted_identifier_non_ascii_1.result"); + } finally { + cleanupQuery(res); + } + + // SELECT "ìì´ë" as "ì§ì§ìì´ë", "í ì¤í¸" as text, "ì«ì" FROM "í ì´ë¸1" as "í ì´ë¸ ë³ëª " + try { + res = executeFile("quoted_identifier_non_ascii_2.sql"); + assertResultSet(res, "quoted_identifier_non_ascii_2.result"); + } finally { + cleanupQuery(res); + } + + // SELECT "ìì´ë" "ì§ì§ìì´ë", char_length("í ì¤í¸") as "길ì´", "ì«ì" * 2 FROM "í ì´ë¸1" "í ì´ë¸ ë³ëª " + try { + res = executeFile("quoted_identifier_non_ascii_3.sql"); + assertResultSet(res, "quoted_identifier_non_ascii_3.result"); + } finally { + cleanupQuery(res); + } + } + } + + @Test + public final void testDelimitedIdentifierWithMixedCharacters() throws Exception { + if (!testingCluster.isHCatalogStoreRunning()) { + ResultSet res = null; + + try { + List<String> tableNames = executeDDL("quoted_identifier_mixed_chars_ddl_1.sql", "table1", "\"TABLE1\""); + assertTableExists(tableNames.get(0)); + + tableNames = executeDDL("quoted_identifier_mixed_chars_ddl_1.sql", "table2", "\"tablE1\""); + assertTableExists(tableNames.get(0)); + + // SELECT "aGe", "tExt", "Number" FROM "TABLE1"; + res = executeFile("quoted_identifier_mixed_chars_1.sql"); + assertResultSet(res, "quoted_identifier_mixed_chars_1.result"); + } finally { + cleanupQuery(res); + } + + try { + res = executeFile("quoted_identifier_mixed_chars_2.sql"); + assertResultSet(res, "quoted_identifier_mixed_chars_2.result"); + } finally { + cleanupQuery(res); + } + + try { + res = executeFile("quoted_identifier_mixed_chars_3.sql"); + assertResultSet(res, "quoted_identifier_mixed_chars_3.result"); + } finally { + cleanupQuery(res); + } + } + } + + @Test public final void testNonreservedKeywordTableNames() throws Exception { List<String> createdNames = null; createdNames = executeDDL("table1_ddl.sql", "table1", "filter"); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java index 250be47..e058943 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java @@ -28,6 +28,7 @@ import org.apache.tajo.IntegrationTest; import org.apache.tajo.TajoTestingCluster; import org.apache.tajo.TpchTestBase; import org.apache.tajo.catalog.CatalogService; +import org.apache.tajo.catalog.CatalogUtil; import org.apache.tajo.catalog.TableDesc; import org.junit.BeforeClass; import org.junit.Test; @@ -53,7 +54,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwrite() throws Exception { - String tableName ="InsertOverwrite"; + String tableName = CatalogUtil.normalizeIdentifier("InsertOverwrite"); ResultSet res = tpch.execute("create table " + tableName +" (col1 int4, col2 int4, col3 float8)"); res.close(); TajoTestingCluster cluster = tpch.getTestingCluster(); @@ -72,7 +73,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwriteSmallerColumns() throws Exception { - String tableName = "insertoverwritesmallercolumns"; + String tableName = CatalogUtil.normalizeIdentifier("insertoverwritesmallercolumns"); ResultSet res = tpch.execute("create table " + tableName + " (col1 int4, col2 int4, col3 float8)"); res.close(); TajoTestingCluster cluster = tpch.getTestingCluster(); @@ -91,7 +92,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwriteWithTargetColumns() throws Exception { - String tableName = "InsertOverwriteWithTargetColumns"; + String tableName = CatalogUtil.normalizeIdentifier("InsertOverwriteWithTargetColumns"); ResultSet res = tpch.execute("create table " + tableName + " (col1 int4, col2 int4, col3 float8)"); res.close(); TajoTestingCluster cluster = tpch.getTestingCluster(); @@ -99,7 +100,8 @@ public class TestInsertQuery { assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, tableName)); TableDesc originalDesc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName); - res = tpch.execute("insert overwrite into " + tableName + " (col1, col3) select l_orderkey, l_quantity from lineitem"); + res = tpch.execute( + "insert overwrite into " + tableName + " (col1, col3) select l_orderkey, l_quantity from lineitem"); res.close(); TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName); if (!cluster.isHCatalogStoreRunning()) { @@ -145,7 +147,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwriteWithAsterisk() throws Exception { - String tableName = "testinsertoverwritewithasterisk"; + String tableName = CatalogUtil.normalizeIdentifier("testinsertoverwritewithasterisk"); ResultSet res = tpch.execute("create table " + tableName + " as select * from lineitem"); res.close(); TajoTestingCluster cluster = tpch.getTestingCluster(); @@ -162,7 +164,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwriteIntoSelect() throws Exception { - String tableName = "insertoverwriteintoselect"; + String tableName = CatalogUtil.normalizeIdentifier("insertoverwriteintoselect"); ResultSet res = tpch.execute( "create table " + tableName + " as select l_orderkey from lineitem"); assertFalse(res.next()); @@ -191,7 +193,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwriteCapitalTableName() throws Exception { - String tableName = "testInsertOverwriteCapitalTableName"; + String tableName = CatalogUtil.normalizeIdentifier("testInsertOverwriteCapitalTableName"); ResultSet res = tpch.execute("create table " + tableName + " as select * from lineitem"); res.close(); TajoTestingCluster cluster = tpch.getTestingCluster(); @@ -218,7 +220,7 @@ public class TestInsertQuery { @Test public final void testInsertOverwriteWithCompression() throws Exception { - String tableName = "testInsertOverwriteWithCompression"; + String tableName = CatalogUtil.normalizeIdentifier("testInsertOverwriteWithCompression"); ResultSet res = tpch.execute("create table " + tableName + " (col1 int4, col2 int4, col3 float8) USING csv WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec')"); res.close(); TajoTestingCluster cluster = tpch.getTestingCluster(); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java index a53fff7..d11cad9 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java @@ -29,6 +29,7 @@ import org.apache.tajo.QueryTestCaseBase; import org.apache.tajo.TajoConstants; import org.apache.tajo.TajoTestingCluster; import org.apache.tajo.catalog.CatalogService; +import org.apache.tajo.catalog.CatalogUtil; import org.apache.tajo.catalog.TableDesc; import org.junit.Test; @@ -48,7 +49,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testCreateColumnPartitionedTable() throws Exception { - String tableName ="testCreateColumnPartitionedTable"; + String tableName = CatalogUtil.normalizeIdentifier("testCreateColumnPartitionedTable"); ResultSet res = executeString( "create table " + tableName + " (col1 int4, col2 int4) partition by column(key float8) "); res.close(); @@ -64,7 +65,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testCreateColumnPartitionedTableWithSelectedColumns() throws Exception { - String tableName ="testCreateColumnPartitionedTableWithSelectedColumns"; + String tableName = CatalogUtil.normalizeIdentifier("testCreateColumnPartitionedTableWithSelectedColumns"); ResultSet res = executeString( "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) "); res.close(); @@ -80,7 +81,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testColumnPartitionedTableByOneColumn() throws Exception { - String tableName ="testColumnPartitionedTableByOneColumn"; + String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableByOneColumn"); ResultSet res = executeString( "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) "); res.close(); @@ -125,7 +126,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testQueryCasesOnColumnPartitionedTable() throws Exception { - String tableName ="testQueryCasesOnColumnPartitionedTable"; + String tableName = CatalogUtil.normalizeIdentifier("testQueryCasesOnColumnPartitionedTable"); ResultSet res = executeString( "create table " + tableName + " (col1 int4, col2 int4, null_col int4) partition by column(key float8) "); res.close(); @@ -155,9 +156,9 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testColumnPartitionedTableByThreeColumns() throws Exception { - String tableName ="testColumnPartitionedTableByThreeColumns"; + String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableByThreeColumns"); ResultSet res = testBase.execute( - "create table " + tableName +" (col4 text) partition by column(col1 int4, col2 int4, col3 float8) "); + "create table " + tableName + " (col4 text) partition by column(col1 int4, col2 int4, col3 float8) "); res.close(); TajoTestingCluster cluster = testBase.getTestingCluster(); CatalogService catalog = cluster.getMaster().getCatalog(); @@ -219,7 +220,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testColumnPartitionedTableByOneColumnsWithCompression() throws Exception { - String tableName = "testColumnPartitionedTableByOneColumnsWithCompression"; + String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableByOneColumnsWithCompression"); ResultSet res = executeString( "create table " + tableName + " (col2 int4, col3 float8) USING csv " + "WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') " + @@ -255,7 +256,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testColumnPartitionedTableByTwoColumnsWithCompression() throws Exception { - String tableName = "testColumnPartitionedTableByTwoColumnsWithCompression"; + String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableByTwoColumnsWithCompression"); ResultSet res = executeString("create table " + tableName + " (col3 float8, col4 text) USING csv " + "WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') " + "PARTITION by column(col1 int4, col2 int4)"); @@ -299,7 +300,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testColumnPartitionedTableByThreeColumnsWithCompression() throws Exception { - String tableName = "testColumnPartitionedTableByThreeColumnsWithCompression"; + String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableByThreeColumnsWithCompression"); ResultSet res = executeString( "create table " + tableName + " (col4 text) USING csv " + "WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') " + @@ -382,7 +383,7 @@ public class TestTablePartitions extends QueryTestCaseBase { @Test public final void testColumnPartitionedTableNoMatchedPartition() throws Exception { - String tableName = "testColumnPartitionedTableNoMatchedPartition"; + String tableName = CatalogUtil.normalizeIdentifier("testColumnPartitionedTableNoMatchedPartition"); ResultSet res = executeString( "create table " + tableName + " (col4 text) USING csv " + "WITH ('csvfile.delimiter'='|','compression.codec'='org.apache.hadoop.io.compress.DeflateCodec') " + http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java index 1279245..9d0352c 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java @@ -224,7 +224,7 @@ public class TestTajoJdbc extends QueryTestCaseBase { ResultSet rs = null; try { - String tableName = "lineitem"; + String tableName = CatalogUtil.normalizeIdentifier("lineitem"); rs = dbmd.getColumns(null, null, tableName, null); ResultSetMetaData rsmd = rs.getMetaData(); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java index ddf8ecb..fe8c070 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/querymaster/TestQueryUnitStatusUpdate.java @@ -21,6 +21,7 @@ package org.apache.tajo.master.querymaster; import org.apache.tajo.IntegrationTest; import org.apache.tajo.QueryTestCaseBase; import org.apache.tajo.TajoConstants; +import org.apache.tajo.catalog.CatalogUtil; import org.apache.tajo.catalog.statistics.TableStats; import org.apache.tajo.worker.TajoWorker; import org.junit.Test; @@ -96,7 +97,7 @@ public class TestQueryUnitStatusUpdate extends QueryTestCaseBase { } private void createColumnPartitionedTable() throws Exception { - String tableName ="ColumnPartitionedTable"; + String tableName = CatalogUtil.normalizeIdentifier("ColumnPartitionedTable"); ResultSet res = executeString( "create table " + tableName + " (col1 int4, col2 int4) partition by column(key float8) "); res.close(); http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java index 0b3a22c..de4560e 100644 --- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java +++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/worker/TestRangeRetrieverHandler.java @@ -90,7 +90,7 @@ public class TestRangeRetrieverHandler { optimizer = new LogicalOptimizer(conf); schema = new Schema(); - schema.addColumn("empId", Type.INT4); + schema.addColumn("empid", Type.INT4); schema.addColumn("age", Type.INT4); } http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table2/table2.tbl ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table2/table2.tbl b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table2/table2.tbl new file mode 100644 index 0000000..953ee3d --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/dataset/TestCreateTable/table2/table2.tbl @@ -0,0 +1,3 @@ +4|jkl|7 +5|opq|8 +6|stu|9 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/org/apache/tajo/jdbc/TestTajoResultSet.java ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/org/apache/tajo/jdbc/TestTajoResultSet.java b/tajo-core/tajo-core-backend/src/test/resources/org/apache/tajo/jdbc/TestTajoResultSet.java deleted file mode 100644 index 92a8a6a..0000000 --- a/tajo-core/tajo-core-backend/src/test/resources/org/apache/tajo/jdbc/TestTajoResultSet.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.jdbc; - -import org.apache.hadoop.fs.FileStatus; -import org.apache.hadoop.fs.Path; -import org.junit.Test; - -import java.util.Arrays; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class TestTajoResultSet { - @Test - public final void testFileNameComparator() { - - Path[] paths = new Path [] { - new Path("hdfs://xtajox.com:9010/tmp/tajo-hadoop/staging/q_1391511584109_0001/RESULT/part-02-000104"), - new Path("hdfs://xtajox.com:9010/tmp/tajo-hadoop/staging/q_1391511584109_0001/RESULT/part-02-000000"), - new Path("hdfs://xtajox.com:9010/tmp/tajo-hadoop/staging/q_1391511584109_0001/RESULT/part-02-000105"), - new Path("hdfs://xtajox.com:9010/tmp/tajo-hadoop/staging/q_1391511584109_0001/RESULT/part-02-000001") - }; - - FileStatus [] fileStatuses = new FileStatus[paths.length]; - - for (int i = 0; i < paths.length; i++) { - fileStatuses[i] = mock(FileStatus.class); - when(fileStatuses[i].getPath()).thenReturn(paths[i]); - } - - TajoResultSet.FileNameComparator comparator = new TajoResultSet.FileNameComparator(); - Arrays.sort(fileStatuses, comparator); - - FileStatus prev = null; - for (int i = 0; i < fileStatuses.length; i++) { - if (prev == null) { - prev = fileStatuses[i]; - } else { - assertTrue(comparator.compare(prev, fileStatuses[i]) <= 0); - } - - assertTrue(prev.getPath().getName().compareTo(fileStatuses[i].getPath().getName()) <= 0); - } - } -} http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql new file mode 100644 index 0000000..2084456 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_1.sql @@ -0,0 +1 @@ +SELECT "aGe", "teXt", "Number" FROM "TABLE1"; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql new file mode 100644 index 0000000..4b05657 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_2.sql @@ -0,0 +1 @@ +SELECT "tb1"."aGe" as "AgE", "tb1"."teXt" as "TEXT", "Number" as "NUMBER" FROM "TABLE1" "tb1"; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql new file mode 100644 index 0000000..fbb00a0 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_3.sql @@ -0,0 +1,22 @@ +SELECT + * +FROM ( + SELECT + "tb1"."aGe", + "tb1"."teXt", + "Number" + FROM + "TABLE1" "tb1" + + UNION + + SELECT + "aGe", + "teXt", + "Number" + FROM + "tablE1" +) T1 +ORDER BY + "aGe"; + http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql new file mode 100644 index 0000000..f93e1e6 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_1.sql @@ -0,0 +1 @@ +CREATE EXTERNAL TABLE ${0} ("aGe" int, "teXt" text, "Number" int) using csv location ${table.path}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql new file mode 100644 index 0000000..f93e1e6 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_mixed_chars_ddl_2.sql @@ -0,0 +1 @@ +CREATE EXTERNAL TABLE ${0} ("aGe" int, "teXt" text, "Number" int) using csv location ${table.path}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql new file mode 100644 index 0000000..39a7bfa --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_1.sql @@ -0,0 +1 @@ +SELECT "ìì´ë", "í ì¤í¸", "ì«ì" FROM "í ì´ë¸1"; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql new file mode 100644 index 0000000..f51364d --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_2.sql @@ -0,0 +1 @@ +SELECT "ìì´ë" as "ì§ì§ìì´ë", "í ì¤í¸" as text, "ì«ì" FROM "í ì´ë¸1" as "í ì´ë¸ ë³ëª " \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql new file mode 100644 index 0000000..7e8b64c --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_3.sql @@ -0,0 +1 @@ +SELECT "ìì´ë" "ì§ì§ìì´ë", char_length("í ì¤í¸") as "길ì´", "ì«ì" * 2 FROM "í ì´ë¸1" "í ì´ë¸ ë³ëª " \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql new file mode 100644 index 0000000..c1f073d --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestCreateTable/quoted_identifier_non_ascii_ddl.sql @@ -0,0 +1 @@ +CREATE EXTERNAL TABLE ${0} ("ìì´ë" int, "í ì¤í¸" text, "ì«ì" int) using csv location ${table.path}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_1.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_1.result new file mode 100644 index 0000000..e31bc89 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_1.result @@ -0,0 +1,5 @@ +aGe,teXt,Number +------------------------------- +1,abc,2 +2,def,5 +3,ghi,8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_2.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_2.result new file mode 100644 index 0000000..d0c2732 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_2.result @@ -0,0 +1,5 @@ +AgE,TEXT,NUMBER +------------------------------- +1,abc,2 +2,def,5 +3,ghi,8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_3.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_3.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_3.result new file mode 100644 index 0000000..b04e5c1 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_mixed_chars_3.result @@ -0,0 +1,8 @@ +aGe,teXt,Number +------------------------------- +1,abc,2 +2,def,5 +3,ghi,8 +4,jkl,7 +5,opq,8 +6,stu,9 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_1.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_1.result new file mode 100644 index 0000000..4656661 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_1.result @@ -0,0 +1,5 @@ +ìì´ë,í ì¤í¸,ì«ì +------------------------------- +1,abc,2 +2,def,5 +3,ghi,8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_2.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_2.result new file mode 100644 index 0000000..7917cb4 --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_2.result @@ -0,0 +1,5 @@ +ì§ì§ìì´ë,text,ì«ì +------------------------------- +1,abc,2 +2,def,5 +3,ghi,8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_3.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_3.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_3.result new file mode 100644 index 0000000..3b51f2c --- /dev/null +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestCreateTable/quoted_identifier_non_ascii_3.result @@ -0,0 +1,5 @@ +ì§ì§ìì´ë,길ì´,?multiply +------------------------------- +1,3,4 +2,3,10 +3,3,16 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables1.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables1.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables1.result index 88df9a8..2d89f42 100644 --- a/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables1.result +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables1.result @@ -1,4 +1,4 @@ -table_cat,table_schem,table_name,table_type,remarks +TABLE_CAT,TABLE_SCHEM,TABLE_NAME,TABLE_TYPE,REMARKS ------------------------------- jdbc_test1,public,table1,TABLE, jdbc_test1,public,table2,TABLE, \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables2.result ---------------------------------------------------------------------- diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables2.result b/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables2.result index 06afed2..042cb52 100644 --- a/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables2.result +++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestTajoJdbc/getTables2.result @@ -1,4 +1,4 @@ -table_cat,table_schem,table_name,table_type,remarks +TABLE_CAT,TABLE_SCHEM,TABLE_NAME,TABLE_TYPE,REMARKS ------------------------------- jdbc_test2,public,table3,TABLE, jdbc_test2,public,table4,TABLE, \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/37fef799/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java ---------------------------------------------------------------------- diff --git a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java index f70b762..ac122c8 100644 --- a/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java +++ b/tajo-jdbc/src/main/java/org/apache/tajo/jdbc/TajoDatabaseMetaData.java @@ -20,6 +20,7 @@ package org.apache.tajo.jdbc; import com.google.protobuf.ServiceException; import org.apache.tajo.TajoConstants; import org.apache.tajo.annotation.Nullable; +import org.apache.tajo.catalog.CatalogUtil; import org.apache.tajo.catalog.Column; import org.apache.tajo.catalog.TableDesc; import org.apache.tajo.client.ResultSetUtil; @@ -370,7 +371,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { } else if (c == '_') { result.append('.'); } else { - result.append(Character.toLowerCase(c)); + result.append(c); } } } @@ -380,18 +381,19 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { } @Override - public ResultSet getTables(@Nullable String catalog, String schemaPattern, String tableNamePattern, String [] types) - throws SQLException { + public ResultSet getTables(@Nullable String catalog, @Nullable String schemaPattern, + @Nullable String tableNamePattern, @Nullable String [] types) throws SQLException { try { final List<MetaDataTuple> resultTables = new ArrayList<MetaDataTuple>(); final String resultCatalog; if (catalog == null) { - resultCatalog = "default"; + resultCatalog = TajoConstants.DEFAULT_DATABASE_NAME; } else { - resultCatalog = catalog; + resultCatalog = CatalogUtil.normalizeIdentifier(catalog); } - String regtableNamePattern = convertPattern(tableNamePattern); + String regtableNamePattern = + convertPattern(tableNamePattern == null ? null : CatalogUtil.normalizeIdentifier(tableNamePattern)); try { TajoClient tajoClient = conn.getTajoClient(); List<String> tableNames = tajoClient.getTableList(resultCatalog); @@ -501,7 +503,8 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { } @Override - public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) + public ResultSet getColumns(@Nullable String catalog, @Nullable String schemaPattern, + @Nullable String tableNamePattern, @Nullable String columnNamePattern) throws SQLException { List<MetaDataTuple> columns = new ArrayList<MetaDataTuple>(); try { @@ -509,8 +512,10 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { catalog = TajoConstants.DEFAULT_DATABASE_NAME; } - String regtableNamePattern = convertPattern(tableNamePattern); - String regcolumnNamePattern = convertPattern(columnNamePattern); + String regtableNamePattern = + convertPattern(tableNamePattern == null ? null : CatalogUtil.normalizeIdentifier(tableNamePattern)); + String regcolumnNamePattern = + convertPattern(columnNamePattern == null ? null : CatalogUtil.normalizeIdentifier(columnNamePattern)); List<String> tables = conn.getTajoClient().getTableList(catalog); for (String table: tables) { @@ -763,7 +768,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { @Override public boolean nullPlusNonNullIsNull() throws SQLException { - return false; + return true; } @Override @@ -833,7 +838,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { - return false; + return true; } @Override @@ -944,7 +949,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { @Override public boolean supportsExpressionsInOrderBy() throws SQLException { - return false; + return true; } @Override @@ -954,7 +959,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { @Override public boolean supportsFullOuterJoins() throws SQLException { - return false; + return true; } @Override @@ -1004,7 +1009,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { - return false; + return true; } @Override @@ -1059,7 +1064,7 @@ public class TajoDatabaseMetaData implements DatabaseMetaData { @Override public boolean supportsOuterJoins() throws SQLException { - return false; + return true; } @Override
