当前位置: 首页>>代码示例>>Java>>正文


Java MetaStoreUtils.isExternalTable方法代码示例

本文整理汇总了Java中org.apache.hadoop.hive.metastore.MetaStoreUtils.isExternalTable方法的典型用法代码示例。如果您正苦于以下问题:Java MetaStoreUtils.isExternalTable方法的具体用法?Java MetaStoreUtils.isExternalTable怎么用?Java MetaStoreUtils.isExternalTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hive.metastore.MetaStoreUtils的用法示例。


在下文中一共展示了MetaStoreUtils.isExternalTable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table table) throws MetaException {
  DynamoDBClient client = createDynamoDBClient(table);
  try {

    boolean isExternal = MetaStoreUtils.isExternalTable(table);

    if (!isExternal) {
      throw new MetaException("Only EXTERNAL tables are supported for DynamoDB.");
    }

    String tableName = HiveDynamoDBUtil.getDynamoDBTableName(table.getParameters()
        .get(DynamoDBConstants.TABLE_NAME), table.getTableName());
    TableDescription tableDescription = client.describeTable(tableName);

    checkTableStatus(tableDescription);
    checkTableSchemaMapping(tableDescription, table);
    checkTableSchemaType(tableDescription, table);
  } finally {
    client.close();
  }
}
 
开发者ID:awslabs,项目名称:emr-dynamodb-connector,代码行数:23,代码来源:DynamoDBStorageHandler.java

示例2: commitDropTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void commitDropTable(Table tbl, boolean deleteData)
        throws MetaException {
    KuduClient client = getKuduClient(tbl.getParameters().get(HiveKuduConstants.MASTER_ADDRESS_NAME));
    String tablename = getKuduTableName(tbl);
    boolean isExternal = MetaStoreUtils.isExternalTable(tbl);
    try {
        if (deleteData && !isExternal) {
            client.deleteTable(tablename);
        }
    } catch (Exception ioe) {
        throw new MetaException("Error dropping table:" +tablename);
    } finally {
        try {
            client.shutdown();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:BimalTandel,项目名称:HiveKudu-Handler,代码行数:21,代码来源:KuduStorageHandler.java

示例3: rollbackCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void rollbackCreateTable(Table tbl) throws MetaException {
    KuduClient client = getKuduClient(tbl.getParameters().get(HiveKuduConstants.MASTER_ADDRESS_NAME));
    String tablename = getKuduTableName(tbl);
    boolean isExternal = MetaStoreUtils.isExternalTable(tbl);
    try {
        if ( client.tableExists(tablename) && !isExternal) {
            client.deleteTable(tablename);
        }
    } catch (Exception ioe) {
        throw new MetaException("Error dropping table while rollback of create table:" +tablename);
    } finally {
        try {
            client.shutdown();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:BimalTandel,项目名称:HiveKudu-Handler,代码行数:20,代码来源:KuduStorageHandler.java

示例4: commitDropTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void commitDropTable(Table table, boolean deleteData) throws MetaException {
    //TODO: Should this be implemented to drop the table and its data from cassandra
    boolean isExternal = MetaStoreUtils.isExternalTable(table);
    if (deleteData && !isExternal) {
        CqlManager manager = new CqlManager(table);

        try {
            //open connection to cassandra
            manager.openConnection();
            //drop the table
            manager.dropTable();
        } finally {
            manager.closeConnection();
        }
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:18,代码来源:CqlStorageHandler.java

示例5: commitDropTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void commitDropTable(Table table, boolean deleteData) throws MetaException {
    //TODO: Should this be implemented to drop the table and its data from cassandra
    boolean isExternal = MetaStoreUtils.isExternalTable(table);
    if (deleteData && !isExternal) {
        CassandraManager manager = new CassandraManager(table);

        try {
            //open connection to cassandra
            manager.openConnection();
            //drop the table
            manager.dropTable();
        } finally {
            manager.closeConnection();
        }
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:18,代码来源:CassandraStorageHandler.java

示例6: commitDropTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void commitDropTable(Table table, boolean deleteData) throws MetaException {
  //TODO: Should this be implemented to drop the table and its data from cassandra
  boolean isExternal = MetaStoreUtils.isExternalTable(table);
  if (deleteData && !isExternal) {
    CassandraManager manager = new CassandraManager(table);

    try {
      //open connection to cassandra
      manager.openConnection();
      //drop the table
      manager.dropTable();
    } finally {
      manager.closeConnection();
    }
  }
}
 
开发者ID:dvasilen,项目名称:Hive-Cassandra,代码行数:18,代码来源:CassandraStorageHandler.java

示例7: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table table) throws MetaException {
    boolean isExternal = MetaStoreUtils.isExternalTable(table);

    if (!isExternal) {
        throw new MetaException("Cassandra tables must be external.");
    }

    if (table.getSd().getLocation() != null) {
        throw new MetaException("LOCATION may not be specified for Cassandra.");
    }

    CqlManager manager = new CqlManager(table);

    try {
        //open connection to cassandra
        manager.openConnection();
        if (!manager.doesKeyspaceExist()) {
            logger.info("Keyspace doesnot exist. Creating keyspace {}", table.getDbName());
            manager.createKeyspace();
        }
        //create the column family if it doesn't exist.
        manager.createCFIfNotFound();
    } finally {
        manager.closeConnection();
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:28,代码来源:CqlStorageHandler.java

示例8: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table table) throws MetaException {
    boolean isExternal = MetaStoreUtils.isExternalTable(table);

    if (!isExternal) {
        throw new MetaException("Cassandra tables must be external.");
    }

    if (table.getSd().getLocation() != null) {
        throw new MetaException("LOCATION may not be specified for Cassandra.");
    }

    CassandraManager manager = new CassandraManager(table);

    try {
        //open connection to cassandra
        manager.openConnection();
        KsDef ks = manager.getKeyspaceDesc();

        //create the column family if it doesn't exist.
        manager.createCFIfNotFound(ks);
    } catch (NotFoundException e) {
        manager.createKeyspaceWithColumns();
    } finally {
        manager.closeConnection();
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:28,代码来源:CassandraStorageHandler.java

示例9: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table table) throws MetaException {
  boolean isExternal = MetaStoreUtils.isExternalTable(table);

  if (!isExternal) {
    throw new MetaException("Cassandra tables must be external.");
  }

  if (table.getSd().getLocation() != null) {
    throw new MetaException("LOCATION may not be specified for Cassandra.");
  }

  CassandraManager manager = new CassandraManager(table);

  try {
    //open connection to cassandra
    manager.openConnection();
    KsDef ks = manager.getKeyspaceDesc();

    //create the column family if it doesn't exist.
    manager.createCFIfNotFound(ks);
  } catch(NotFoundException e) {
    manager.createKeyspaceWithColumns();
  } finally {
    manager.closeConnection();
  }
}
 
开发者ID:dvasilen,项目名称:Hive-Cassandra,代码行数:28,代码来源:CassandraStorageHandler.java

示例10: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table tbl) throws MetaException {
    if(!MetaStoreUtils.isExternalTable(tbl)) {
        throw new MetaException("Table must be external.");
    }
    // TODO Auto-generated method stub
}
 
开发者ID:myui,项目名称:HiveJdbcStorageHandler,代码行数:8,代码来源:JdbcStorageHandler.java

示例11: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table tbl) throws MetaException {

    boolean isExternal = MetaStoreUtils.isExternalTable(tbl);
    if (isExternal) {
        Log.info("Creating External table for Splice...");
    }

    String inputTableName = tbl.getParameters().get(MRConstants.SPLICE_TABLE_NAME);
    if (inputTableName == null)
        throw new MetaException("Wrong param, you are missing " +
        		MRConstants.SPLICE_TABLE_NAME + " ? ");

    // We can choose to support user define column mapping.
    // But currently I don't think it is necessary
    // We map all columns from Splice Table to Hive Table.
    String connStr = tbl.getParameters().get(MRConstants.SPLICE_JDBC_STR);
    if (connStr == null)
        throw new MetaException("Wrong param, did you mean " +
        		MRConstants.SPLICE_JDBC_STR + " ? ");
    if (sqlUtil == null)
        sqlUtil = SMSQLUtil.getInstance(connStr);
    if (inputTableName != null) {
        inputTableName = inputTableName.trim();
        checkTableExists(inputTableName);
    }
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:28,代码来源:SMStorageHandler.java

示例12: isExternalTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
protected boolean isExternalTable(Table table) {
    return MetaStoreUtils.isExternalTable(table);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:4,代码来源:MonarchStorageHandler.java

示例13: preCreateTable

import org.apache.hadoop.hive.metastore.MetaStoreUtils; //导入方法依赖的package包/类
@Override
public void preCreateTable(Table tbl)
        throws MetaException {
    KuduClient client = getKuduClient(tbl.getParameters().get(HiveKuduConstants.MASTER_ADDRESS_NAME));

    boolean isExternal = MetaStoreUtils.isExternalTable(tbl);

    if (isExternal) {
        //TODO: Check if Kudu table exists to allow external table.
        //TODO: Check if column and types are compatible with existing Kudu table.
        throw new MetaException("External Table to Kudu not yet supported.");
    }
    if (tbl.getSd().getLocation() != null) {
        throw new MetaException("LOCATION may not be specified for Kudu");
    }

    String tablename = getKuduTableName(tbl);

    try {
        List<String> keyColumns = Arrays.asList(tbl.getParameters().get(HiveKuduConstants.KEY_COLUMNS).split("\\s*,\\s*"));

        List<FieldSchema> tabColumns = tbl.getSd().getCols();

        int numberOfCols = tabColumns.size();
        List<ColumnSchema> columns = new ArrayList<>(numberOfCols);

        for (FieldSchema fields : tabColumns) {

            ColumnSchema columnSchema = new ColumnSchema
                    .ColumnSchemaBuilder(fields.getName(), HiveKuduBridgeUtils.hiveTypeToKuduType(fields.getType()))
                    .key(keyColumns.contains(fields.getName()))
                    .nullable(!keyColumns.contains(fields.getName()))
                    .build();

            columns.add(columnSchema);
        }

        Schema schema = new Schema(columns);

        printSchema(schema);

        CreateTableOptions createTableOptions = new CreateTableOptions();

        //TODO : add support for partition and buckets
        client.createTable(tablename, schema, createTableOptions);

    } catch (Exception se) {
        throw new MetaException("Error creating Kudu table: " + tablename + ":" + se);
    } finally {
        try {
            client.shutdown();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:BimalTandel,项目名称:HiveKudu-Handler,代码行数:57,代码来源:KuduStorageHandler.java


注:本文中的org.apache.hadoop.hive.metastore.MetaStoreUtils.isExternalTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。