Repository: tajo Updated Branches: refs/heads/branch-0.11.0 0f5d97a00 -> d6bc9118d
http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_2.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_2.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_2.result new file mode 100644 index 0000000..fcf1751 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_2.result @@ -0,0 +1,31 @@ +{ + "OldTableName": "table1", + "AlterTableType": "ADD_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + }, + { + "ColumnName": "col2", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "1", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + }, + { + "Value": "2", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + } + ], + "location": "hdfs://xxx.com/warehouse/table1/col1\u003d1/col2\u003d2", + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_3.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_3.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_3.result new file mode 100644 index 0000000..ae8c165 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_3.result @@ -0,0 +1,40 @@ +{ + "OldTableName": "table1", + "AlterTableType": "ADD_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + }, + { + "ColumnName": "col2", + "OpType": "Column" + }, + { + "ColumnName": "col3", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "2015", + "ValueType": "String", + "OpType": "Literal" + }, + { + "Value": "01", + "ValueType": "String", + "OpType": "Literal" + }, + { + "Value": "11", + "ValueType": "String", + "OpType": "Literal" + } + ], + "location": "hdfs://xxx.com/warehouse/table1/col1\u003d2015/col2\u003d01/col3\u003d11", + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_4.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_4.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_4.result new file mode 100644 index 0000000..b181431 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_4.result @@ -0,0 +1,21 @@ +{ + "OldTableName": "table1", + "AlterTableType": "ADD_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "TAJO", + "ValueType": "String", + "OpType": "Literal" + } + ], + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_5.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_5.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_5.result new file mode 100644 index 0000000..720c40e --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_add_partition_5.result @@ -0,0 +1,21 @@ +{ + "OldTableName": "table1", + "AlterTableType": "ADD_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "TAJO", + "ValueType": "String", + "OpType": "Literal" + } + ], + "IsPurge": false, + "IfNotExists": true, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_1.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_1.result new file mode 100644 index 0000000..d45b9c6 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_1.result @@ -0,0 +1,30 @@ +{ + "OldTableName": "table1", + "AlterTableType": "DROP_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + }, + { + "ColumnName": "col2", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "1", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + }, + { + "Value": "2", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + } + ], + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_2.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_2.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_2.result new file mode 100644 index 0000000..0dcf2b3 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_2.result @@ -0,0 +1,39 @@ +{ + "OldTableName": "table1", + "AlterTableType": "DROP_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + }, + { + "ColumnName": "col2", + "OpType": "Column" + }, + { + "ColumnName": "col3", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "2015", + "ValueType": "String", + "OpType": "Literal" + }, + { + "Value": "01", + "ValueType": "String", + "OpType": "Literal" + }, + { + "Value": "11", + "ValueType": "String", + "OpType": "Literal" + } + ], + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_3.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_3.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_3.result new file mode 100644 index 0000000..5ca0ce2 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_3.result @@ -0,0 +1,21 @@ +{ + "OldTableName": "table1", + "AlterTableType": "DROP_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "TAJO", + "ValueType": "String", + "OpType": "Literal" + } + ], + "IsPurge": true, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_4.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_4.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_4.result new file mode 100644 index 0000000..bb0f424 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_drop_partition_4.result @@ -0,0 +1,21 @@ +{ + "OldTableName": "table1", + "AlterTableType": "DROP_PARTITION", + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Values": [ + { + "Value": "TAJO", + "ValueType": "String", + "OpType": "Literal" + } + ], + "IsPurge": true, + "IfNotExists": false, + "IfExists": true, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_1.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_1.result new file mode 100644 index 0000000..46bd2a1 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_1.result @@ -0,0 +1,11 @@ +{ + "OldTableName": "table1", + "AlterTableType": "SET_PROPERTY", + "TableProperties": { + "timezone": "GMT-7" + }, + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_2.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_2.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_2.result new file mode 100644 index 0000000..d88a97d --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_2.result @@ -0,0 +1,11 @@ +{ + "OldTableName": "table1", + "AlterTableType": "SET_PROPERTY", + "TableProperties": { + "text.delimiter": "\u0026" + }, + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_3.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_3.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_3.result new file mode 100644 index 0000000..456edd4 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/alter_table_set_property_3.result @@ -0,0 +1,12 @@ +{ + "OldTableName": "table1", + "AlterTableType": "SET_PROPERTY", + "TableProperties": { + "compression.type": "RECORD", + "compression.codec": "org.apache.hadoop.io.compress.SnappyCodec" + }, + "IsPurge": false, + "IfNotExists": false, + "IfExists": false, + "OpType": "AlterTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_like_1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_like_1.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_like_1.result new file mode 100644 index 0000000..c6fbaf2 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_like_1.result @@ -0,0 +1,7 @@ +{ + "IsExternal": false, + "TableName": "new_table", + "IfNotExists": false, + "LikeParentTable": "orig_name", + "OpType": "CreateTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_column.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_column.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_column.result new file mode 100644 index 0000000..22dc423 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_column.result @@ -0,0 +1,39 @@ +{ + "IsExternal": false, + "TableName": "sales", + "Attributes": [ + { + "ColumnDefName": "col1", + "DataTypeName": "INT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col2", + "DataTypeName": "INT4", + "OpType": "DataType" + } + ], + "PartitionMethodDesc": { + "Columns": [ + { + "ColumnDefName": "col3", + "DataTypeName": "INT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col4", + "DataTypeName": "FLOAT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col5", + "DataTypeName": "TEXT", + "OpType": "DataType" + } + ], + "IsOmitValues": false, + "PartitionType": "COLUMN" + }, + "IfNotExists": false, + "OpType": "CreateTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_1.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_1.result new file mode 100644 index 0000000..f4f3716 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_1.result @@ -0,0 +1,32 @@ +{ + "IsExternal": false, + "TableName": "sales", + "Attributes": [ + { + "ColumnDefName": "col1", + "DataTypeName": "INT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col2", + "DataTypeName": "INT4", + "OpType": "DataType" + } + ], + "PartitionMethodDesc": { + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Quantity": { + "Value": "2", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + }, + "PartitionType": "HASH" + }, + "IfNotExists": false, + "OpType": "CreateTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_2.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_2.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_2.result new file mode 100644 index 0000000..030a437 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_hash_2.result @@ -0,0 +1,38 @@ +{ + "IsExternal": false, + "TableName": "sales", + "Attributes": [ + { + "ColumnDefName": "col1", + "DataTypeName": "INT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col2", + "DataTypeName": "INT4", + "OpType": "DataType" + } + ], + "PartitionMethodDesc": { + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Specifiers": [ + { + "PartitionSpecName": "part1" + }, + { + "PartitionSpecName": "part2" + }, + { + "PartitionSpecName": "part3" + } + ], + "PartitionType": "HASH" + }, + "IfNotExists": false, + "OpType": "CreateTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_list.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_list.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_list.result new file mode 100644 index 0000000..994f408 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_list.result @@ -0,0 +1,65 @@ +{ + "IsExternal": false, + "TableName": "sales", + "Attributes": [ + { + "ColumnDefName": "col1", + "DataTypeName": "INT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col2", + "DataTypeName": "INT4", + "OpType": "DataType" + } + ], + "PartitionMethodDesc": { + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Specifiers": [ + { + "ValueList": { + "Values": [ + { + "Value": "Seoul", + "ValueType": "String", + "OpType": "Literal" + }, + { + "Value": "ìì¸", + "ValueType": "String", + "OpType": "Literal" + } + ], + "OpType": "ValueList" + }, + "PartitionSpecName": "col1" + }, + { + "ValueList": { + "Values": [ + { + "Value": "Busan", + "ValueType": "String", + "OpType": "Literal" + }, + { + "Value": "ë¶ì°", + "ValueType": "String", + "OpType": "Literal" + } + ], + "OpType": "ValueList" + }, + "PartitionSpecName": "col2" + } + ], + "PartitionType": "LIST" + }, + "IfNotExists": false, + "OpType": "CreateTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_range.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_range.result b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_range.result new file mode 100644 index 0000000..9ebb8ab --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestSQLAnalyzer/create_table_partition_by_range.result @@ -0,0 +1,55 @@ +{ + "IsExternal": false, + "TableName": "sales", + "Attributes": [ + { + "ColumnDefName": "col1", + "DataTypeName": "INT4", + "OpType": "DataType" + }, + { + "ColumnDefName": "col2", + "DataTypeName": "INT4", + "OpType": "DataType" + } + ], + "PartitionMethodDesc": { + "Columns": [ + { + "ColumnName": "col1", + "OpType": "Column" + } + ], + "Specifiers": [ + { + "End": { + "Value": "2", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + }, + "IsMaxValue": false, + "PartitionSpecName": "col1" + }, + { + "End": { + "Value": "5", + "ValueType": "Unsigned_Integer", + "OpType": "Literal" + }, + "IsMaxValue": false, + "PartitionSpecName": "col1" + }, + { + "End": { + "ColumnName": "MAXVALUE", + "OpType": "Column" + }, + "IsMaxValue": false, + "PartitionSpecName": "col1" + } + ], + "PartitionType": "RANGE" + }, + "IfNotExists": false, + "OpType": "CreateTable" +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/89c140c0/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java ---------------------------------------------------------------------- diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java index 26af769..ef71ada 100644 --- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java +++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java @@ -35,6 +35,7 @@ import org.apache.tajo.util.FileUtil; import org.apache.tajo.util.Pair; import javax.annotation.Nullable; +import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.Constructor; import java.net.URI; @@ -124,15 +125,13 @@ public class TablespaceManager implements StorageService { String json; try { json = FileUtil.readTextFileFromResource(fileName); + } catch (FileNotFoundException fnfe) { + return null; } catch (IOException e) { throw new RuntimeException(e); } - if (json != null) { - return parseJson(json); - } else { - return null; - } + return parseJson(json); } private static JSONObject parseJson(String json) {
