You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2015/04/17 10:33:31 UTC
[4/8] tajo git commit: TAJO-1442: Improve Hive Compatibility
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java b/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
new file mode 100644
index 0000000..05e4e0a
--- /dev/null
+++ b/tajo-catalog/tajo-catalog-drivers/tajo-hive/src/test/java/org/apache/tajo/catalog/store/TestHiveCatalogStore.java
@@ -0,0 +1,504 @@
+/**
+ * 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.catalog.store;
+
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.catalog.partition.PartitionDesc;
+import org.apache.tajo.catalog.partition.PartitionKey;
+import org.apache.tajo.catalog.partition.PartitionMethodDesc;
+import org.apache.tajo.catalog.proto.CatalogProtos;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.StorageConstants;
+import org.apache.tajo.util.CommonTestingUtil;
+import org.apache.tajo.util.KeyValueSet;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.tajo.TajoConstants.DEFAULT_DATABASE_NAME;
+import static org.junit.Assert.*;
+
+/**
+ * TestHiveCatalogStore. Test case for
+ * {@link org.apache.tajo.catalog.store.HiveCatalogStore}
+ */
+
+public class TestHiveCatalogStore {
+ private static final String DB_NAME = "test_hive";
+ private static final String CUSTOMER = "customer";
+ private static final String NATION = "nation";
+ private static final String REGION = "region";
+ private static final String SUPPLIER = "supplier";
+
+ private static HiveCatalogStore store;
+ private static Path warehousePath;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ Path testPath = CommonTestingUtil.getTestDir();
+ warehousePath = new Path(testPath, "warehouse");
+
+ //create local hiveMeta
+ HiveConf conf = new HiveConf();
+ String jdbcUri = "jdbc:derby:;databaseName="+testPath.toUri().getPath()+"metastore_db;create=true";
+ conf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, warehousePath.toUri().toString());
+ conf.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, jdbcUri);
+ conf.set(TajoConf.ConfVars.WAREHOUSE_DIR.varname, warehousePath.toUri().toString());
+
+ // create local HiveCatalogStore.
+ TajoConf tajoConf = new TajoConf(conf);
+ store = new HiveCatalogStore(tajoConf);
+ store.createDatabase(DB_NAME, null);
+ }
+
+ @AfterClass
+ public static void tearDown() throws IOException {
+ store.close();
+ }
+
+ @Test
+ public void testTableUsingTextFile() throws Exception {
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, new KeyValueSet());
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("c_custkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("c_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_address", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_nationkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("c_phone", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_acctbal", TajoDataTypes.Type.FLOAT8);
+ schema.addColumn("c_mktsegment", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, CUSTOMER), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, CUSTOMER)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, CUSTOMER));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, CUSTOMER));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(StringEscapeUtils.escapeJava(StorageConstants.DEFAULT_FIELD_DELIMITER),
+ table1.getMeta().getOption(StorageConstants.TEXT_DELIMITER));
+ store.dropTable(DB_NAME, CUSTOMER);
+ }
+
+ @Test
+ public void testTableUsingRCFileWithBinarySerde() throws Exception {
+ KeyValueSet options = new KeyValueSet();
+ options.set(StorageConstants.RCFILE_SERDE, StorageConstants.DEFAULT_BINARY_SERDE);
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.RCFILE, options);
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("r_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("r_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("r_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, REGION));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, REGION));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(StorageConstants.DEFAULT_BINARY_SERDE,
+ table1.getMeta().getOption(StorageConstants.RCFILE_SERDE));
+ store.dropTable(DB_NAME, REGION);
+ }
+
+ @Test
+ public void testTableUsingRCFileWithTextSerde() throws Exception {
+ KeyValueSet options = new KeyValueSet();
+ options.set(StorageConstants.RCFILE_SERDE, StorageConstants.DEFAULT_TEXT_SERDE);
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.RCFILE, options);
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("r_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("r_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("r_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, REGION));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, REGION));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(StorageConstants.DEFAULT_TEXT_SERDE, table1.getMeta().getOption(StorageConstants.RCFILE_SERDE));
+ store.dropTable(DB_NAME, REGION);
+ }
+
+ @Test
+ public void testTableWithNullValue() throws Exception {
+ KeyValueSet options = new KeyValueSet();
+ options.set(StorageConstants.TEXT_DELIMITER, StringEscapeUtils.escapeJava("\u0002"));
+ options.set(StorageConstants.TEXT_NULL, StringEscapeUtils.escapeJava("\u0003"));
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, options);
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("s_suppkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("s_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("s_address", TajoDataTypes.Type.TEXT);
+ schema.addColumn("s_nationkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("s_phone", TajoDataTypes.Type.TEXT);
+ schema.addColumn("s_acctbal", TajoDataTypes.Type.FLOAT8);
+ schema.addColumn("s_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, SUPPLIER), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, SUPPLIER)).toUri());
+
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, SUPPLIER));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, SUPPLIER));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(table.getMeta().getOption(StorageConstants.TEXT_DELIMITER),
+ table1.getMeta().getOption(StorageConstants.TEXT_DELIMITER));
+
+ assertEquals(table.getMeta().getOption(StorageConstants.TEXT_NULL),
+ table1.getMeta().getOption(StorageConstants.TEXT_NULL));
+
+ assertEquals(table1.getMeta().getOption(StorageConstants.TEXT_DELIMITER),
+ StringEscapeUtils.escapeJava("\u0002"));
+
+ assertEquals(table1.getMeta().getOption(StorageConstants.TEXT_NULL),
+ StringEscapeUtils.escapeJava("\u0003"));
+
+ store.dropTable(DB_NAME, SUPPLIER);
+
+ }
+
+ @Test
+ public void testAddTableByPartition() throws Exception {
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, new KeyValueSet());
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("n_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("n_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("n_comment", TajoDataTypes.Type.TEXT);
+
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, NATION), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, NATION)).toUri());
+
+ org.apache.tajo.catalog.Schema expressionSchema = new org.apache.tajo.catalog.Schema();
+ expressionSchema.addColumn("n_nationkey", TajoDataTypes.Type.INT4);
+ expressionSchema.addColumn("n_date", TajoDataTypes.Type.TEXT);
+
+ PartitionMethodDesc partitions = new PartitionMethodDesc(
+ DB_NAME,
+ NATION,
+ CatalogProtos.PartitionType.COLUMN, "n_nationkey,n_date", expressionSchema);
+ table.setPartitionMethod(partitions);
+
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, NATION));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, NATION));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ Schema partitionSchema = table.getPartitionMethod().getExpressionSchema();
+ Schema partitionSchema1 = table1.getPartitionMethod().getExpressionSchema();
+ assertEquals(partitionSchema.size(), partitionSchema1.size());
+
+ for (int i = 0; i < partitionSchema.size(); i++) {
+ assertEquals(partitionSchema.getColumn(i).getSimpleName(), partitionSchema1.getColumn(i).getSimpleName());
+ }
+
+ testAddPartition(table1.getPath(), NATION, "n_nationkey=10/n_date=20150101");
+ testAddPartition(table1.getPath(), NATION, "n_nationkey=20/n_date=20150102");
+
+ testDropPartition(NATION, "n_nationkey=10/n_date=20150101");
+ testDropPartition(NATION, "n_nationkey=20/n_date=20150102");
+
+ CatalogProtos.PartitionDescProto partition = store.getPartition(DB_NAME, NATION, "n_nationkey=10/n_date=20150101");
+ assertNull(partition);
+
+ partition = store.getPartition(DB_NAME, NATION, "n_nationkey=20/n_date=20150102");
+ assertNull(partition);
+
+ store.dropTable(DB_NAME, NATION);
+ }
+
+
+ private void testAddPartition(URI uri, String tableName, String partitionName) throws Exception {
+ AlterTableDesc alterTableDesc = new AlterTableDesc();
+ alterTableDesc.setTableName(DB_NAME + "." + tableName);
+ alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION);
+
+ Path path = new Path(uri.getPath(), partitionName);
+
+ PartitionDesc partitionDesc = new PartitionDesc();
+ partitionDesc.setPartitionName(partitionName);
+
+ List<PartitionKey> partitionKeyList = new ArrayList<PartitionKey>();
+ String[] partitionNames = partitionName.split("/");
+ for(int i = 0; i < partitionNames.length; i++) {
+ String[] eachPartitionName = partitionNames[i].split("=");
+ partitionKeyList.add(new PartitionKey(eachPartitionName[0], eachPartitionName[1]));
+ }
+ partitionDesc.setPartitionKeys(partitionKeyList);
+ partitionDesc.setPath(path.toString());
+
+ alterTableDesc.setPartitionDesc(partitionDesc);
+
+ store.alterTable(alterTableDesc.getProto());
+
+ CatalogProtos.PartitionDescProto resultDesc = store.getPartition(DB_NAME, NATION, partitionName);
+ assertNotNull(resultDesc);
+ assertEquals(resultDesc.getPartitionName(), partitionName);
+ assertEquals(resultDesc.getPath(), uri.toString() + "/" + partitionName);
+ assertEquals(resultDesc.getPartitionKeysCount(), 2);
+
+ for (int i = 0; i < resultDesc.getPartitionKeysCount(); i++) {
+ CatalogProtos.PartitionKeyProto keyProto = resultDesc.getPartitionKeys(i);
+ String[] eachName = partitionNames[i].split("=");
+ assertEquals(keyProto.getPartitionValue(), eachName[1]);
+ }
+ }
+
+
+ private void testDropPartition(String tableName, String partitionName) throws Exception {
+ AlterTableDesc alterTableDesc = new AlterTableDesc();
+ alterTableDesc.setTableName(DB_NAME + "." + tableName);
+ alterTableDesc.setAlterTableType(AlterTableType.DROP_PARTITION);
+
+ PartitionDesc partitionDesc = new PartitionDesc();
+ partitionDesc.setPartitionName(partitionName);
+
+ alterTableDesc.setPartitionDesc(partitionDesc);
+
+ store.alterTable(alterTableDesc.getProto());
+ }
+
+ @Test
+ public void testGetAllTableNames() throws Exception{
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, new KeyValueSet());
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("n_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("n_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("n_comment", TajoDataTypes.Type.TEXT);
+
+ String[] tableNames = new String[]{"table1", "table2", "table3"};
+
+ for(String tableName : tableNames){
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName("default", tableName), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, tableName)).toUri());
+ store.createTable(table.getProto());
+ }
+
+ List<String> tables = store.getAllTableNames("default");
+ assertEquals(tableNames.length, tables.size());
+
+ for(String tableName : tableNames){
+ assertTrue(tables.contains(tableName));
+ }
+
+ for(String tableName : tableNames){
+ store.dropTable("default", tableName);
+ }
+ }
+
+ @Test
+ public void testDeleteTable() throws Exception {
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, new KeyValueSet());
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("n_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("n_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("n_comment", TajoDataTypes.Type.TEXT);
+
+ String tableName = "table1";
+ TableDesc table = new TableDesc(DB_NAME + "." + tableName, schema, meta, warehousePath.toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, tableName));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, tableName));
+ FileSystem fs = FileSystem.getLocal(new Configuration());
+ assertTrue(fs.exists(new Path(table1.getPath())));
+
+ store.dropTable(DB_NAME, tableName);
+ assertFalse(store.existTable(DB_NAME, tableName));
+ fs.close();
+ }
+
+ @Test
+ public void testTableUsingSequenceFileWithBinarySerde() throws Exception {
+ KeyValueSet options = new KeyValueSet();
+ options.set(StorageConstants.SEQUENCEFILE_SERDE, StorageConstants.DEFAULT_BINARY_SERDE);
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.SEQUENCEFILE, options);
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("r_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("r_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("r_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, REGION));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, REGION));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(StorageConstants.DEFAULT_BINARY_SERDE,
+ table1.getMeta().getOption(StorageConstants.SEQUENCEFILE_SERDE));
+ store.dropTable(DB_NAME, REGION);
+ }
+
+ @Test
+ public void testTableUsingSequenceFileWithTextSerde() throws Exception {
+ KeyValueSet options = new KeyValueSet();
+ options.set(StorageConstants.SEQUENCEFILE_SERDE, StorageConstants.DEFAULT_TEXT_SERDE);
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.SEQUENCEFILE, options);
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("r_regionkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("r_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("r_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, REGION), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, REGION)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, REGION));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, REGION));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(StorageConstants.DEFAULT_TEXT_SERDE, table1.getMeta().getOption(StorageConstants.SEQUENCEFILE_SERDE));
+ store.dropTable(DB_NAME, REGION);
+ }
+
+
+ @Test
+ public void testTableUsingParquet() throws Exception {
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.PARQUET, new KeyValueSet());
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("c_custkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("c_name", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_address", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_nationkey", TajoDataTypes.Type.INT4);
+ schema.addColumn("c_phone", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_acctbal", TajoDataTypes.Type.FLOAT8);
+ schema.addColumn("c_mktsegment", TajoDataTypes.Type.TEXT);
+ schema.addColumn("c_comment", TajoDataTypes.Type.TEXT);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, CUSTOMER), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, CUSTOMER)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, CUSTOMER));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, CUSTOMER));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ store.dropTable(DB_NAME, CUSTOMER);
+ }
+
+ @Test
+ public void testDataTypeCompatibility() throws Exception {
+ String tableName = CatalogUtil.normalizeIdentifier("testDataTypeCompatibility");
+
+ TableMeta meta = new TableMeta(CatalogProtos.StoreType.CSV, new KeyValueSet());
+
+ org.apache.tajo.catalog.Schema schema = new org.apache.tajo.catalog.Schema();
+ schema.addColumn("col1", TajoDataTypes.Type.INT4);
+ schema.addColumn("col2", TajoDataTypes.Type.INT1);
+ schema.addColumn("col3", TajoDataTypes.Type.INT2);
+ schema.addColumn("col4", TajoDataTypes.Type.INT8);
+ schema.addColumn("col5", TajoDataTypes.Type.BOOLEAN);
+ schema.addColumn("col6", TajoDataTypes.Type.FLOAT4);
+ schema.addColumn("col7", TajoDataTypes.Type.FLOAT8);
+ schema.addColumn("col8", TajoDataTypes.Type.TEXT);
+ schema.addColumn("col9", TajoDataTypes.Type.BLOB);
+ schema.addColumn("col10", TajoDataTypes.Type.TIMESTAMP);
+ schema.addColumn("col11", TajoDataTypes.Type.DATE);
+
+ TableDesc table = new TableDesc(CatalogUtil.buildFQName(DB_NAME, tableName), schema, meta,
+ new Path(warehousePath, new Path(DB_NAME, tableName)).toUri());
+ store.createTable(table.getProto());
+ assertTrue(store.existTable(DB_NAME, tableName));
+
+ TableDesc table1 = new TableDesc(store.getTable(DB_NAME, tableName));
+ assertEquals(table.getName(), table1.getName());
+ assertEquals(table.getPath(), table1.getPath());
+ assertEquals(table.getSchema().size(), table1.getSchema().size());
+ for (int i = 0; i < table.getSchema().size(); i++) {
+ assertEquals(table.getSchema().getColumn(i).getSimpleName(), table1.getSchema().getColumn(i).getSimpleName());
+ }
+
+ assertEquals(StringEscapeUtils.escapeJava(StorageConstants.DEFAULT_FIELD_DELIMITER),
+ table1.getMeta().getOption(StorageConstants.TEXT_DELIMITER));
+ store.dropTable(DB_NAME, tableName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
index cef4027..0a2a8cc 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
@@ -70,12 +70,12 @@ public class TestCatalog {
@BeforeClass
public static void setUp() throws Exception {
- final String HCATALOG_CLASS_NAME = "org.apache.tajo.catalog.store.HCatalogStore";
+ final String HIVE_CATALOG_CLASS_NAME = "org.apache.tajo.catalog.store.HiveCatalogStore";
String driverClass = System.getProperty(CatalogConstants.STORE_CLASS);
- // here, we don't choose HCatalogStore due to some dependency problems.
- if (driverClass == null || driverClass.equals(HCATALOG_CLASS_NAME)) {
+ // here, we don't choose HiveCatalogStore due to some dependency problems.
+ if (driverClass == null || driverClass.equals(HIVE_CATALOG_CLASS_NAME)) {
driverClass = DerbyStore.class.getCanonicalName();
}
String catalogURI = System.getProperty(CatalogConstants.CATALOG_URI);
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-core/pom.xml b/tajo-core/pom.xml
index a9403d5..c9367b2 100644
--- a/tajo-core/pom.xml
+++ b/tajo-core/pom.xml
@@ -565,218 +565,6 @@
</profile>
<profile>
- <id>hcatalog-0.12.0</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libfb303</artifactId>
- <version>0.9.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <version>0.9.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tajo</groupId>
- <artifactId>tajo-hcatalog</artifactId>
- <version>${tajo.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-exec</artifactId>
- <version>0.12.0</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-common</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-contrib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-hbase-handler</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-metastore</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-serde</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-shims</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-testutils</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libfb303</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.jolbox</groupId>
- <artifactId>bonecp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-metastore</artifactId>
- <version>0.12.0</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-common</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-serde</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-shimss</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libfb303</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.jolbox</groupId>
- <artifactId>bonecp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-cli</artifactId>
- <version>0.12.0</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-common</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-exec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-metastore</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-serde</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-service</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-shims</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.jolbox</groupId>
- <artifactId>bonecp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.hive.hcatalog</groupId>
- <artifactId>hcatalog-core</artifactId>
- <version>0.12.0</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-cli</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-common</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-exec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-metastore</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-serde</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-service</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.hive</groupId>
- <artifactId>hive-shims</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.jolbox</groupId>
- <artifactId>bonecp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- </profile>
- <profile>
<id>parallel-test</id>
<activation>
<activeByDefault>false</activeByDefault>
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index 727192a..ede667e 100644
--- a/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -231,8 +231,8 @@ public class QueryTestCaseBase {
public QueryTestCaseBase() {
// hive 0.12 does not support quoted identifier.
- // So, we use lower case database names when Tajo uses HCatalogStore.
- if (testingCluster.isHCatalogStoreRunning()) {
+ // So, we use lower case database names when Tajo uses HiveCatalogStore.
+ if (testingCluster.isHiveCatalogStoreRunning()) {
this.currentDatabase = getClass().getSimpleName().toLowerCase();
} else {
this.currentDatabase = getClass().getSimpleName();
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java b/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
index f7fb2f2..e680736 100644
--- a/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
+++ b/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
@@ -86,9 +86,9 @@ public class TajoTestingCluster {
System.getProperty("tajo.test.data.dir", "test-data");
/**
- * True If HCatalogStore is used. Otherwise, it is FALSE.
+ * True If HiveCatalogStore is used. Otherwise, it is FALSE.
*/
- public Boolean isHCatalogStoreUse = false;
+ public Boolean isHiveCatalogStoreUse = false;
private static final String LOG_LEVEL;
@@ -320,8 +320,8 @@ public class TajoTestingCluster {
return this.catalogServer;
}
- public boolean isHCatalogStoreRunning() {
- return isHCatalogStoreUse;
+ public boolean isHiveCatalogStoreRunning() {
+ return isHiveCatalogStoreUse;
}
////////////////////////////////////////////////////////
@@ -383,31 +383,31 @@ public class TajoTestingCluster {
}
private void setupCatalogForTesting(TajoConf c, File testBuildDir) throws IOException {
- final String HCATALOG_CLASS_NAME = "org.apache.tajo.catalog.store.HCatalogStore";
- boolean hcatalogClassExists = false;
+ final String HIVE_CATALOG_CLASS_NAME = "org.apache.tajo.catalog.store.HiveCatalogStore";
+ boolean hiveCatalogClassExists = false;
try {
- getClass().getClassLoader().loadClass(HCATALOG_CLASS_NAME);
- hcatalogClassExists = true;
+ getClass().getClassLoader().loadClass(HIVE_CATALOG_CLASS_NAME);
+ hiveCatalogClassExists = true;
} catch (ClassNotFoundException e) {
- LOG.info("HCatalogStore is not available.");
+ LOG.info("HiveCatalogStore is not available.");
}
String driverClass = System.getProperty(CatalogConstants.STORE_CLASS);
- if (hcatalogClassExists &&
- driverClass != null && driverClass.equals(HCATALOG_CLASS_NAME)) {
+ if (hiveCatalogClassExists &&
+ driverClass != null && driverClass.equals(HIVE_CATALOG_CLASS_NAME)) {
try {
- getClass().getClassLoader().loadClass(HCATALOG_CLASS_NAME);
+ getClass().getClassLoader().loadClass(HIVE_CATALOG_CLASS_NAME);
String jdbcUri = "jdbc:derby:;databaseName="+ testBuildDir.toURI().getPath() + "/metastore_db;create=true";
c.set("hive.metastore.warehouse.dir", TajoConf.getWarehouseDir(c).toString() + "/default");
c.set("javax.jdo.option.ConnectionURL", jdbcUri);
c.set(TajoConf.ConfVars.WAREHOUSE_DIR.varname, conf.getVar(ConfVars.WAREHOUSE_DIR));
- c.set(CatalogConstants.STORE_CLASS, HCATALOG_CLASS_NAME);
+ c.set(CatalogConstants.STORE_CLASS, HIVE_CATALOG_CLASS_NAME);
Path defaultDatabasePath = new Path(TajoConf.getWarehouseDir(c).toString() + "/default");
FileSystem fs = defaultDatabasePath.getFileSystem(c);
if (!fs.exists(defaultDatabasePath)) {
fs.mkdirs(defaultDatabasePath);
}
- isHCatalogStoreUse = true;
+ isHiveCatalogStoreUse = true;
} catch (ClassNotFoundException cnfe) {
throw new IOException(cnfe);
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java b/tajo-core/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
index 5819bd2..b371be2 100644
--- a/tajo-core/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
+++ b/tajo-core/src/test/java/org/apache/tajo/cli/tools/TestTajoDump.java
@@ -29,7 +29,7 @@ public class TestTajoDump extends QueryTestCaseBase {
@Test
public void testDump1() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeString("CREATE TABLE \"" + getCurrentDatabase() +
"\".\"TableName1\" (\"Age\" int, \"FirstName\" TEXT, lastname TEXT)");
@@ -48,7 +48,7 @@ public class TestTajoDump extends QueryTestCaseBase {
@Test
public void testDump2() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeString("CREATE TABLE \"" + getCurrentDatabase() +
"\".\"TableName2\" (\"Age\" int, \"Name\" Record (\"FirstName\" TEXT, lastname TEXT))");
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java b/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
index aee5a02..fdf9ca4 100644
--- a/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
+++ b/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestTajoCli.java
@@ -100,7 +100,7 @@ public class TestTajoCli {
}
private void assertOutputResult(String expectedResultFile, String actual, String[] paramKeys, String[] paramValues)
- throws Exception {
+ throws Exception {
FileSystem fs = currentResultPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
Path resultFile = StorageUtil.concatPath(currentResultPath, expectedResultFile);
assertTrue(resultFile.toString() + " existence check", fs.exists(resultFile));
@@ -140,7 +140,7 @@ public class TestTajoCli {
@Test
public void testParseConf() throws Exception {
String[] args = new String[]{"--conf", "tajo.cli.print.pause=false",
- "--conf", "tajo.executor.join.inner.in-memory-table-num=256"};
+ "--conf", "tajo.executor.join.inner.in-memory-table-num=256"};
CommandLineParser parser = new PosixParser();
CommandLine cmd = parser.parse(TajoCli.options, args);
@@ -186,7 +186,7 @@ public class TestTajoCli {
public void testConnectDatabase() throws Exception {
String databaseName;
- if (cluster.isHCatalogStoreRunning()) {
+ if (cluster.isHiveCatalogStoreRunning()) {
databaseName = "TEST_CONNECTION_DATABASE".toLowerCase();
} else {
databaseName = "TEST_CONNECTION_DATABASE";
@@ -215,16 +215,16 @@ public class TestTajoCli {
String consoleResult = new String(out.toByteArray());
FileSystem fs = FileSystem.get(testBase.getTestingCluster().getConfiguration());
- if (!cluster.isHCatalogStoreRunning()) {
+ if (!cluster.isHiveCatalogStoreRunning()) {
assertOutputResult(resultFileName, consoleResult, new String[]{"${table.path}"},
- new String[]{fs.getUri() + "/tajo/warehouse/default/" + tableName});
+ new String[]{fs.getUri() + "/tajo/warehouse/default/" + tableName});
}
}
@Test
public void testDescTable() throws Exception {
String tableName;
- if (cluster.isHCatalogStoreRunning()) {
+ if (cluster.isHiveCatalogStoreRunning()) {
tableName = "TEST_DESC_TABLE".toLowerCase();
} else {
tableName = "TEST_DESC_TABLE";
@@ -237,7 +237,7 @@ public class TestTajoCli {
@Test
public void testDescTableForNestedSchema() throws Exception {
String tableName;
- if (cluster.isHCatalogStoreRunning()) {
+ if (cluster.isHiveCatalogStoreRunning()) {
tableName = "TEST_DESC_TABLE_NESTED".toLowerCase();
} else {
tableName = "TEST_DESC_TABLE_NESTED";
@@ -250,15 +250,15 @@ public class TestTajoCli {
@Test
public void testSelectResultWithNullFalse() throws Exception {
String sql =
- "select\n" +
- " c_custkey,\n" +
- " orders.o_orderkey,\n" +
- " orders.o_orderstatus \n" +
- "from\n" +
- " orders full outer join customer on c_custkey = o_orderkey\n" +
- "order by\n" +
- " c_custkey,\n" +
- " orders.o_orderkey;\n";
+ "select\n" +
+ " c_custkey,\n" +
+ " orders.o_orderkey,\n" +
+ " orders.o_orderstatus \n" +
+ "from\n" +
+ " orders full outer join customer on c_custkey = o_orderkey\n" +
+ "order by\n" +
+ " c_custkey,\n" +
+ " orders.o_orderkey;\n";
setVar(tajoCli, SessionVars.CLI_FORMATTER_CLASS, TajoCliOutputTestFormatter.class.getName());
tajoCli.executeScript(sql);
@@ -269,15 +269,15 @@ public class TestTajoCli {
private void verifySelectResultWithNullTrue() throws Exception {
String sql =
- "select\n" +
- " c_custkey,\n" +
- " orders.o_orderkey,\n" +
- " orders.o_orderstatus \n" +
- "from\n" +
- " orders full outer join customer on c_custkey = o_orderkey\n" +
- "order by\n" +
- " c_custkey,\n" +
- " orders.o_orderkey;\n";
+ "select\n" +
+ " c_custkey,\n" +
+ " orders.o_orderkey,\n" +
+ " orders.o_orderstatus \n" +
+ "from\n" +
+ " orders full outer join customer on c_custkey = o_orderkey\n" +
+ "order by\n" +
+ " c_custkey,\n" +
+ " orders.o_orderkey;\n";
setVar(tajoCli, SessionVars.CLI_FORMATTER_CLASS, TajoCliOutputTestFormatter.class.getName());
@@ -307,8 +307,8 @@ public class TestTajoCli {
assertSessionVar(tajoCli, SessionVars.ON_ERROR_STOP.keyname(), "true");
tajoCli.executeScript("select count(*) from lineitem; " +
- "select count(*) from lineitem2; " +
- "select count(*) from orders");
+ "select count(*) from lineitem2; " +
+ "select count(*) from orders");
String consoleResult = new String(out.toByteArray());
assertOutputResult(consoleResult);
@@ -391,7 +391,7 @@ public class TestTajoCli {
}
@Test
- public void testAlterTableAddPartition() throws Exception {
+ public void testAlterTableAddPartition() throws Exception {
String tableName = CatalogUtil.normalizeIdentifier("testAlterTableAddPartition");
tajoCli.executeScript("create table " + tableName + " (col1 int4, col2 int4) partition by column(key float8)");
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestAlterTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestAlterTablespace.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestAlterTablespace.java
index 47e98a9..b0ec92d 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestAlterTablespace.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestAlterTablespace.java
@@ -31,7 +31,7 @@ public class TestAlterTablespace extends QueryTestCaseBase {
@Test
public final void testAlterLocation() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
//////////////////////////////////////////////////////////////////////////////
// Create two table spaces
//////////////////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
index 18c9fbc..f79f703 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCTASQuery.java
@@ -78,7 +78,7 @@ public class TestCTASQuery extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=38.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=49.0")));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -121,7 +121,7 @@ public class TestCTASQuery extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=38.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=49.0")));
- if (!cluster.isHCatalogStoreRunning()) {
+ if (!cluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -261,7 +261,7 @@ public class TestCTASQuery extends QueryTestCaseBase {
ResultSet res = executeFile("CtasWithManagedTable.sql");
res.close();
- if (testingCluster.isHCatalogStoreRunning()) {
+ if (testingCluster.isHiveCatalogStoreRunning()) {
assertTrue(client.existTable("managed_table1"));
TableDesc desc = client.getTableDesc("managed_table1");
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
index 1fbe7c5..f1a3ddc 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
@@ -41,8 +41,8 @@ public class TestCreateTable extends QueryTestCaseBase {
@Test
public final void testVariousTypes() throws Exception {
List<String> createdNames;
- if (testingCluster.isHCatalogStoreRunning()) {
- createdNames = executeDDL("create_table_various_types_for_hcatalog.sql", null);
+ if (testingCluster.isHiveCatalogStoreRunning()) {
+ createdNames = executeDDL("create_table_various_types_for_hive_catalog.sql", null);
} else {
createdNames = executeDDL("create_table_various_types.sql", null);
}
@@ -135,7 +135,7 @@ public class TestCreateTable extends QueryTestCaseBase {
@Test
public final void testCreatedTableWithQuotedIdentifierAndVerifyPath() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertPathOfCreatedTable("D6", "OldTable", "NewMgmtTable", "CREATE TABLE \"D6\".\"OldTable\" (age integer);");
}
}
@@ -174,7 +174,7 @@ public class TestCreateTable extends QueryTestCaseBase {
@Test
public final void testDelimitedIdentifierWithNonAsciiCharacters() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
ResultSet res = null;
try {
List<String> tableNames = executeDDL("quoted_identifier_non_ascii_ddl.sql", "table1", "\"테이블1\"");
@@ -207,7 +207,7 @@ public class TestCreateTable extends QueryTestCaseBase {
@Test
public final void testDelimitedIdentifierWithMixedCharacters() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
ResultSet res = null;
try {
@@ -442,8 +442,8 @@ public class TestCreateTable extends QueryTestCaseBase {
@Test
public final void testCreateTableLike1() throws Exception {
- // Hcatalog does not support varchar type in hive-0.12.0
- if (testingCluster.isHCatalogStoreRunning()) {
+ // //HiveCatalogStore does not support varchar type in hive-0.12.0
+ if (testingCluster.isHiveCatalogStoreRunning()) {
// Basic create table with default database
executeString("CREATE TABLE table1 (c1 int, c2 text);").close();
executeString("CREATE TABLE table2 LIKE table1");
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
index 0799d22..4a1f601 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
@@ -56,7 +56,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -76,7 +76,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -311,7 +311,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res = executeFile("testInsertOverwriteSmallerColumns.sql");
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
assertEquals(originalDesc.getSchema(), desc.getSchema());
@@ -331,7 +331,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res = executeFile("testInsertOverwriteWithTargetColumns.sql");
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -385,7 +385,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res = executeString("insert overwrite into full_table_csv select * from default.lineitem where l_orderkey = 3");
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "full_table_csv");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(2, desc.getStats().getNumRows().intValue());
}
executeString("DROP TABLE full_table_csv PURGE");
@@ -402,7 +402,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res = executeFile("load_to_lineitem_year_month.sql");
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "lineitem_year_month");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -424,7 +424,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
CatalogService catalog = testingCluster.getMaster().getCatalog();
assertTrue(catalog.existsTable(getCurrentDatabase(), tableName));
TableDesc orderKeys = catalog.getTableDesc(getCurrentDatabase(), tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, orderKeys.getStats().getNumRows().intValue());
}
@@ -435,7 +435,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
assertTrue(catalog.existsTable(getCurrentDatabase(), tableName));
orderKeys = catalog.getTableDesc(getCurrentDatabase(), tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(2, orderKeys.getStats().getNumRows().intValue());
}
executeString("DROP TABLE " + tableName + " PURGE");
@@ -453,7 +453,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res = executeString("insert overwrite into " + tableName + " select * from default.lineitem where l_orderkey = 3");
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(2, desc.getStats().getNumRows().intValue());
}
executeString("DROP TABLE " + tableName + " PURGE");
@@ -480,7 +480,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res = executeQuery();
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(2, desc.getStats().getNumRows().intValue());
}
@@ -497,7 +497,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
@Test
public final void testInsertOverwriteLocationWithCompression() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
ResultSet res = executeQuery();
res.close();
FileSystem fs = FileSystem.get(testingCluster.getConfiguration());
@@ -515,7 +515,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
@Test
public final void testInsertOverwriteWithAsteriskUsingParquet() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
ResultSet res = executeFile("full_table_parquet_ddl.sql");
res.close();
@@ -526,7 +526,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
"insert overwrite into full_table_parquet select * from default.lineitem where l_orderkey = 3");
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "full_table_parquet");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(2, desc.getStats().getNumRows().intValue());
}
@@ -542,7 +542,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
@Test
public final void testInsertOverwriteIntoParquet() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeString("create table parquet_table " +
"(l_orderkey int4, l_shipdate text, l_shipdate_function text) using parquet").close();
@@ -554,7 +554,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
"select l_orderkey, l_shipdate, substr(l_shipdate, 1, 10) from default.lineitem").close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "parquet_table");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -577,7 +577,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
@Test
public final void testInsertOverwriteIntoPartitionedParquet() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeString("create table parquet_table " +
"(l_orderkey int4, l_shipdate_function text) using parquet partition by column (l_shipdate text)").close();
@@ -589,7 +589,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
"select l_orderkey, substr(l_shipdate, 1, 10), l_shipdate from default.lineitem").close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "parquet_table");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -622,7 +622,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
executeString("DROP TABLE table1 PURGE");
@@ -642,7 +642,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(1, desc.getStats().getNumRows().intValue());
}
@@ -669,7 +669,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(1, desc.getStats().getNumRows().intValue());
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
index 182bf5b..bd8f830 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
@@ -28,7 +28,7 @@ public class TestNetTypes extends QueryTestCaseBase {
@Before
public final void setUp() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeDDL("table1_ddl.sql", "table1");
executeDDL("table2_ddl.sql", "table2");
}
@@ -36,8 +36,8 @@ public class TestNetTypes extends QueryTestCaseBase {
@Test
public final void testSelect() throws Exception {
- // Skip all tests when HCatalogStore is used.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ // Skip all tests when HiveCatalogStore is used.
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// select name, addr from table1;
ResultSet res = executeQuery();
assertResultSet(res);
@@ -47,8 +47,8 @@ public class TestNetTypes extends QueryTestCaseBase {
@Test
public final void testGroupby() throws Exception {
- // Skip all tests when HCatalogStore is used.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ // Skip all tests when HiveCatalogStore is used.
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// select name, addr, count(1) from table1 group by name, addr;
ResultSet res = executeQuery();
assertResultSet(res);
@@ -58,8 +58,8 @@ public class TestNetTypes extends QueryTestCaseBase {
@Test
public final void testGroupby2() throws Exception {
- // Skip all tests when HCatalogStore is used.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ // Skip all tests when HiveCatalogStore is used.
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// select addr, count(*) from table1 group by addr;
ResultSet res = executeQuery();
assertResultSet(res);
@@ -69,8 +69,8 @@ public class TestNetTypes extends QueryTestCaseBase {
@Test
public final void testSort() throws Exception {
- // Skip all tests when HCatalogStore is used.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ // Skip all tests when HiveCatalogStore is used.
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// select * from table1 order by addr;
ResultSet res = executeQuery();
assertResultSet(res);
@@ -80,8 +80,8 @@ public class TestNetTypes extends QueryTestCaseBase {
@Test
public final void testSort2() throws Exception {
- // Skip all tests when HCatalogStore is used.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ // Skip all tests when HiveCatalogStore is used.
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// select addr from table2 order by addr;
ResultSet res = executeQuery();
assertResultSet(res);
@@ -91,8 +91,8 @@ public class TestNetTypes extends QueryTestCaseBase {
@Test
public final void testJoin() throws Exception {
- // Skip all tests when HCatalogStore is used.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ // Skip all tests when HiveCatalogStore is used.
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// select * from table1 as t1, table2 as t2 where t1.addr = t2.addr;
ResultSet res = executeQuery();
assertResultSet(res);
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
index 48a3343..513868b 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
@@ -377,7 +377,7 @@ public class TestSelectQuery extends QueryTestCaseBase {
CatalogService catalog = cluster.getMaster().getCatalog();
assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, "orderkeys"));
TableDesc orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, "orderkeys");
- if (!cluster.isHCatalogStoreRunning()) {
+ if (!cluster.isHiveCatalogStoreRunning()) {
assertEquals(5, orderKeys.getStats().getNumRows().intValue());
}
}
@@ -399,7 +399,7 @@ public class TestSelectQuery extends QueryTestCaseBase {
@Test
public final void testDatabaseRef() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeString("CREATE DATABASE \"TestSelectQuery\"").close();
executeString("CREATE TABLE \"TestSelectQuery\".\"LineItem\" AS SELECT * FROM default.lineitem" ).close();
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
index ff91177..1aee961 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
@@ -159,10 +159,10 @@ public class TestSortQuery extends QueryTestCaseBase {
@Test
public final void testSortWithDate() throws Exception {
- // skip this test if catalog uses HCatalogStore.
- // It is because HCatalogStore does not support Time data type.
+ // skip this test if catalog uses HiveCatalogStore.
+ // It is because HiveCatalogStore does not support Time data type.
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// create external table table1 (col1 timestamp, col2 date, col3 time) ...
executeDDL("create_table_with_date_ddl.sql", "table1");
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
index b48720a..bb15bfc 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
@@ -209,7 +209,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=38.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=49.0")));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
}
@@ -324,7 +324,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=2/col3=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3/col3=49.0")));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -388,7 +388,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=2/col3=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3/col3=49.0")));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -441,7 +441,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=2/col3=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3/col3=49.0")));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
String expected = "N\n" +
@@ -503,7 +503,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=2/col3=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3/col3=49.0")));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// TODO: If there is existing another partition directory, we must add its rows number to result row numbers.
// assertEquals(6, desc.getStats().getNumRows().intValue());
}
@@ -550,7 +550,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
"insert overwrite into " + tableName + " select l_partkey, l_quantity, l_orderkey from lineitem");
res.close();
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -587,7 +587,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
" select l_quantity, l_returnflag, l_orderkey, l_partkey from lineitem");
res.close();
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -632,7 +632,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
" select l_returnflag, l_orderkey, l_partkey, l_quantity from lineitem");
res.close();
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -715,7 +715,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
" select l_returnflag , l_orderkey, l_partkey, l_quantity from lineitem");
res.close();
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -820,7 +820,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc("testinsertquery1", "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
@@ -829,7 +829,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
res.close();
desc = catalog.getTableDesc("testinsertquery2", "table1");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(5, desc.getStats().getNumRows().intValue());
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestResultSet.java b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
index 524c6e8..98e5ff9 100644
--- a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
+++ b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestResultSet.java
@@ -139,8 +139,8 @@ public class TestResultSet {
@Test
public void testDateTimeType() throws Exception {
- // Hcatalog does not support date type, time type in hive-0.12.0
- if(util.isHCatalogStoreRunning()) return;
+ // HiveCatalog does not support date type, time type in hive-0.12.0
+ if(util.isHiveCatalogStoreRunning()) return;
ResultSet res = null;
TajoClient client = util.newTajoClient();
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoDatabaseMetaData.java b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoDatabaseMetaData.java
index dfb0269..8ee6755 100644
--- a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoDatabaseMetaData.java
+++ b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoDatabaseMetaData.java
@@ -62,7 +62,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
assertDatabaseExists("jdbc_test1");
pstmt.close();
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertDatabaseNotExists("Jdbc_Test2");
pstmt = conn.prepareStatement("CREATE DATABASE \"Jdbc_Test2\"");
pstmt.executeUpdate();
@@ -72,7 +72,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
conn.setCatalog("jdbc_test1");
assertEquals("jdbc_test1", conn.getCatalog());
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
conn.setCatalog("Jdbc_Test2");
assertEquals("Jdbc_Test2", conn.getCatalog());
}
@@ -95,7 +95,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
pstmt = conn.prepareStatement("DROP DATABASE jdbc_test1");
pstmt.executeUpdate();
pstmt.close();
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
pstmt = conn.prepareStatement("DROP DATABASE \"Jdbc_Test2\"");
pstmt.executeUpdate();
pstmt.close();
@@ -126,7 +126,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
pstmt.executeUpdate();
pstmt.close();
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
// create database "jdbc_test2" and its tables
assertDatabaseNotExists("Jdbc_Test4");
pstmt = defaultConnect.prepareStatement("CREATE DATABASE \"Jdbc_Test4\"");
@@ -147,13 +147,13 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
List<String> newDatabases = getListFromResultSet(dbmd.getCatalogs(), "TABLE_CAT");
newDatabases.removeAll(existingDatabases);
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertEquals(2, newDatabases.size());
} else {
assertEquals(1, newDatabases.size());
}
assertTrue(newDatabases.contains("jdbc_test3"));
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
assertTrue(newDatabases.contains("Jdbc_Test4"));
}
@@ -162,7 +162,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
assertResultSet(res, "getTables1.result");
res.close();
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
res = defaultConnect.getMetaData().getTables("Jdbc_Test4", null, null, null);
assertResultSet(res, "getTables2.result");
res.close();
@@ -182,7 +182,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
executeString("DROP TABLE jdbc_test3.table2");
executeString("DROP DATABASE jdbc_test3");
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
String jdbcTest2ConnUri =
TestTajoJdbc.buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(), "Jdbc_Test4");
Connection jdbcTest2Conn = DriverManager.getConnection(jdbcTest2ConnUri);
@@ -268,7 +268,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
@Test
public void testGetColumnsWithPattern() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
String connUri = TestTajoJdbc.buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
TajoConstants.DEFAULT_DATABASE_NAME);
Connection conn = DriverManager.getConnection(connUri);
@@ -397,7 +397,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
@Test
public void testEmptyMetaInfo() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
String connUri = TestTajoJdbc.buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
TajoConstants.DEFAULT_DATABASE_NAME);
Connection conn = DriverManager.getConnection(connUri);
@@ -464,7 +464,7 @@ public class TestTajoDatabaseMetaData extends QueryTestCaseBase {
@Test
public void testGetTypeInfo() throws Exception {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
String connUri = TestTajoJdbc.buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
TajoConstants.DEFAULT_DATABASE_NAME);
Connection conn = DriverManager.getConnection(connUri);
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
index 36bbd94..0dbb8e5 100644
--- a/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
+++ b/tajo-core/src/test/java/org/apache/tajo/jdbc/TestTajoJdbc.java
@@ -553,10 +553,10 @@ public class TestTajoJdbc extends QueryTestCaseBase {
Connection conn = null;
int result;
- // skip this test if catalog uses HCatalogStore.
- // It is because HCatalogStore does not support Time data type.
+ // skip this test if catalog uses HiveCatalogStore.
+ // It is because HiveCatalogStore does not support Time data type.
try {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
executeDDL("create_table_with_date_ddl.sql", "table1");
String connUri = buildConnectionUri(tajoMasterAddress.getHostName(),
@@ -604,10 +604,10 @@ public class TestTajoJdbc extends QueryTestCaseBase {
int result;
String errorMessage = null;
- // skip this test if catalog uses HCatalogStore.
- // It is because HCatalogStore does not support Time data type.
+ // skip this test if catalog uses HiveCatalogStore.
+ // It is because HiveCatalogStore does not support Time data type.
try {
- if (!testingCluster.isHCatalogStoreRunning()) {
+ if (!testingCluster.isHiveCatalogStoreRunning()) {
String connUri = buildConnectionUri(tajoMasterAddress.getHostName(), tajoMasterAddress.getPort(),
DEFAULT_DATABASE_NAME);
conn = DriverManager.getConnection(connUri);
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hcatalog.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hcatalog.sql b/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hcatalog.sql
deleted file mode 100644
index 3eda994..0000000
--- a/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hcatalog.sql
+++ /dev/null
@@ -1,50 +0,0 @@
--- Some types were commented out due to Hive meta test.
-
-create table various_types (
--- col0 bit,
--- col1 BIT(10),
--- col2 bit varying,
--- col3 bit VARYING(10),
- col4 tinyint,
- col5 smallInt,
- col6 integer,
- col7 biginT,
- col8 real,
- col9 float,
- col10 float(53),
- col11 double,
- col12 doublE precision,
--- col13 numeric,
--- col14 numeric(10),
--- col15 numeric(10,2),
--- col16 decimal,
--- col17 decimal(10),
--- col18 decimal(10,2),
--- col19 char,
--- col20 character,
--- col21 chaR(10),
--- col22 character(10),
--- col23 varchar,
--- col24 character varying,
--- col25 varchar(255),
--- col26 character varying (255),
--- col27 nchar,
--- col28 nchar(255),
--- col29 national character,
--- col30 national character(255),
--- col31 nvarchar,
--- col32 nvarchar(255),
--- col33 natIonal character varying,
--- col34 national character varying (255),
--- col35 date,
--- col36 time,
--- col37 timetz,
--- col38 time With time zone,
--- col39 timesTamptz,
--- col40 timestamp with time zone,
- col41 binary,
--- col42 binary(10),
--- col43 varbinary(10),
--- col44 binary Varying(10),
- col45 blOb
-);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql b/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql
new file mode 100644
index 0000000..3eda994
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestCreateTable/create_table_various_types_for_hive_catalog.sql
@@ -0,0 +1,50 @@
+-- Some types were commented out due to Hive meta test.
+
+create table various_types (
+-- col0 bit,
+-- col1 BIT(10),
+-- col2 bit varying,
+-- col3 bit VARYING(10),
+ col4 tinyint,
+ col5 smallInt,
+ col6 integer,
+ col7 biginT,
+ col8 real,
+ col9 float,
+ col10 float(53),
+ col11 double,
+ col12 doublE precision,
+-- col13 numeric,
+-- col14 numeric(10),
+-- col15 numeric(10,2),
+-- col16 decimal,
+-- col17 decimal(10),
+-- col18 decimal(10,2),
+-- col19 char,
+-- col20 character,
+-- col21 chaR(10),
+-- col22 character(10),
+-- col23 varchar,
+-- col24 character varying,
+-- col25 varchar(255),
+-- col26 character varying (255),
+-- col27 nchar,
+-- col28 nchar(255),
+-- col29 national character,
+-- col30 national character(255),
+-- col31 nvarchar,
+-- col32 nvarchar(255),
+-- col33 natIonal character varying,
+-- col34 national character varying (255),
+-- col35 date,
+-- col36 time,
+-- col37 timetz,
+-- col38 time With time zone,
+-- col39 timesTamptz,
+-- col40 timestamp with time zone,
+ col41 binary,
+-- col42 binary(10),
+-- col43 varbinary(10),
+-- col44 binary Varying(10),
+ col45 blOb
+);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-dist/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-dist/pom.xml b/tajo-dist/pom.xml
index da5f48f..0cc61aa 100644
--- a/tajo-dist/pom.xml
+++ b/tajo-dist/pom.xml
@@ -151,9 +151,9 @@
run mkdir -p share/jdbc-dist
run cp -r $ROOT/tajo-jdbc/target/tajo-jdbc-${project.version}-jar-with-dependencies.jar ./share/jdbc-dist/tajo-jdbc-${project.version}.jar
- if [ -f $ROOT/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/target/lib/parquet-hive-bundle-*.jar ]
+ if [ -f $ROOT/tajo-catalog/tajo-catalog-drivers/tajo-hive/target/lib/parquet-hive-bundle-*.jar ]
then
- run cp -r $ROOT/tajo-catalog/tajo-catalog-drivers/tajo-hcatalog/target/lib/parquet-hive-bundle-*.jar lib/
+ run cp -r $ROOT/tajo-catalog/tajo-catalog-drivers/tajo-hive/target/lib/parquet-hive-bundle-*.jar lib/
echo
echo "Tajo installed parquet-hive-bundle library at: ${project.build.directory}/tajo-${project.version}"
echo
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-dist/src/main/bin/tajo
----------------------------------------------------------------------
diff --git a/tajo-dist/src/main/bin/tajo b/tajo-dist/src/main/bin/tajo
index a92d1a9..4383f3c 100755
--- a/tajo-dist/src/main/bin/tajo
+++ b/tajo-dist/src/main/bin/tajo
@@ -295,9 +295,6 @@ if [ -d ${HIVE_LIB} ]; then
CLASSPATH=${CLASSPATH}:$f;
done
- for f in $HIVE_HOME/hcatalog/share/hcatalog/*hcatalog-core-*.jar; do
- CLASSPATH=${CLASSPATH}:$f;
- done
fi
if [ "${HIVE_JDBC_DRIVER_DIR}" != "" ]; then
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-dist/src/main/conf/catalog-site.xml.template
----------------------------------------------------------------------
diff --git a/tajo-dist/src/main/conf/catalog-site.xml.template b/tajo-dist/src/main/conf/catalog-site.xml.template
index dddcc89..365de6b 100644
--- a/tajo-dist/src/main/conf/catalog-site.xml.template
+++ b/tajo-dist/src/main/conf/catalog-site.xml.template
@@ -86,12 +86,12 @@
-->
-<!-- HCatalog Store Driver -->
-<!-- Please remove comment if you want to use HCatalog. -->
+<!-- HiveCatalog Store Driver -->
+<!-- Please remove comment if you want to use HiveCatalog. -->
<!--
<property>
<name>tajo.catalog.store.class</name>
- <value>org.apache.tajo.catalog.store.HCatalogStore</value>
+ <value>org.apache.tajo.catalog.store.HiveCatalogStore</value>
</property>
-->
http://git-wip-us.apache.org/repos/asf/tajo/blob/955a7bf8/tajo-dist/src/main/conf/tajo-env.sh
----------------------------------------------------------------------
diff --git a/tajo-dist/src/main/conf/tajo-env.sh b/tajo-dist/src/main/conf/tajo-env.sh
index d52a827..bb8465f 100755
--- a/tajo-dist/src/main/conf/tajo-env.sh
+++ b/tajo-dist/src/main/conf/tajo-env.sh
@@ -72,7 +72,7 @@
# The scheduling priority for daemon processes. See 'man nice'.
# export TAJO_NICENESS=10
-# It must be required to use HCatalogStore
+# It must be required to use HiveCatalogStore
# export HIVE_HOME=
# export HIVE_JDBC_DRIVER_DIR=