public HCatPartition next() throws HCatException { return new HCatPartition(hcatTable, iterator.next()); }
HCatPartition getHCatPartition(HCatTable hcatTable) throws HCatException { assert hcatPartition == null : "hcatPartition should have been null at this point."; assert dbName.equalsIgnoreCase(hcatTable.getDbName()) : "DB names don't match."; assert tableName.equalsIgnoreCase(hcatTable.getTableName()) : "Table names don't match."; return new HCatPartition(hcatTable, partitionKeyValues, location); }
@Override public HCatPartition deserializePartition(String hcatPartitionStringRep) throws HCatException { try { Partition partition = new Partition(); new TDeserializer(new TJSONProtocol.Factory()).deserialize(partition, hcatPartitionStringRep, "UTF-8"); return new HCatPartition(null, partition); } catch(TException exception) { if (LOG.isDebugEnabled()) LOG.debug("Could not de-serialize partition from: " + hcatPartitionStringRep); throw new HCatException("Could not de-serialize HCatPartition.", exception); } }
@Override public List<HCatPartition> getPartitions(String dbName, String tblName) throws HCatException { List<HCatPartition> hcatPtns = new ArrayList<HCatPartition>(); try { HCatTable hcatTable = getTable(dbName, tblName); List<Partition> hivePtns = hmsClient.listPartitions( checkDB(dbName), tblName, (short) -1); for (Partition ptn : hivePtns) { hcatPtns.add(new HCatPartition(hcatTable, ptn)); } } catch (NoSuchObjectException e) { throw new ObjectNotFoundException( "NoSuchObjectException while retrieving partition.", e); } catch (MetaException e) { throw new HCatException( "MetaException while retrieving partition.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while retrieving partition.", e); } return hcatPtns; }
tableName, ptnValues); if (hivePartition != null) { partition = new HCatPartition(hcatTable, hivePartition);
@Override public List<HCatPartition> listPartitionsByFilter(String dbName, String tblName, String filter) throws HCatException { List<HCatPartition> hcatPtns = new ArrayList<HCatPartition>(); try { HCatTable table = getTable(dbName, tblName); List<Partition> hivePtns = hmsClient.listPartitionsByFilter( table.getDbName(), table.getTableName(), filter, (short) -1); for (Partition ptn : hivePtns) { hcatPtns.add(new HCatPartition(table, ptn)); } } catch (MetaException e) { throw new HCatException("MetaException while fetching partitions.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException( "NoSuchObjectException while fetching partitions.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while fetching partitions.", e); } return hcatPtns; }
partitionSpec.put("grid", "AB"); partitionSpec.put("dt", "2011_12_31"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table,partitionSpec))).build()); partitionSpec.put("grid", "AB"); partitionSpec.put("dt", "2012_01_01"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table,partitionSpec))).build()); partitionSpec.put("dt", "2012_01_01"); partitionSpec.put("grid", "OB"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table,partitionSpec))).build()); partitionSpec.put("dt", "2012_01_01"); partitionSpec.put("grid", "XB"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table,partitionSpec))).build());
partitionSpec.put("grid", "AB"); partitionSpec.put("dt", "2011_12_31"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table, partitionSpec))).build()); partitionSpec.put("grid", "AB"); partitionSpec.put("dt", "2012_01_01"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table, partitionSpec))).build()); partitionSpec.put("dt", "2012_01_01"); partitionSpec.put("grid", "OB"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table, partitionSpec))).build()); partitionSpec.put("dt", "2012_01_01"); partitionSpec.put("grid", "XB"); client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(table, partitionSpec, makePartLocation(table, partitionSpec))).build());
client.addPartition(HCatAddPartitionDesc.create(new HCatPartition(createdTable, partitionSpec, makePartLocation(createdTable,partitionSpec))).build());
firstPtn.put("country", "usa"); HCatAddPartitionDesc addPtn = HCatAddPartitionDesc.create(new HCatPartition(table, firstPtn, null)).build(); client.addPartition(addPtn);
Map<String, String> props1 = new HashMap<String,String>(); props1.put(ReplicationUtils.REPL_STATE_ID,String.valueOf(evid - 5)); HCatPartition ptnToAdd1 = (new HCatPartition(tableCreated, ptnDesc1, TestHCatClient.makePartLocation(tableCreated,ptnDesc1))).parameters(props1); client.addPartition(HCatAddPartitionDesc.create(ptnToAdd1).build()); Map<String, String> props2 = new HashMap<String,String>(); props2.put(ReplicationUtils.REPL_STATE_ID, String.valueOf(evid + 5)); HCatPartition ptnToAdd2 = (new HCatPartition(tableCreated, ptnDesc2, TestHCatClient.makePartLocation(tableCreated,ptnDesc2))).parameters(props2); client.addPartition(HCatAddPartitionDesc.create(ptnToAdd2).build());
HCatPartition ptn1 = (new HCatPartition(table2Created, ptnDesc1, makePartLocation(table2Created,ptnDesc1))); sourceMetastore.addPartition(HCatAddPartitionDesc.create(ptn1).build()); Map<String, String> ptnDesc = new HashMap<String,String>(); ptnDesc.put("b","testmul"+i); HCatPartition ptn = (new HCatPartition(table2Created, ptnDesc, makePartLocation(table2Created,ptnDesc))); sourceMetastore.addPartition(HCatAddPartitionDesc.create(ptn).build());
assertNotNull(tableCreated); HCatPartition ptnToAdd = (new HCatPartition(tableCreated, ptnDesc, TestHCatClient.makePartLocation(tableCreated,ptnDesc))).parameters(props); client.addPartition(HCatAddPartitionDesc.create(ptnToAdd).build()); props2.put(ReplicationUtils.REPL_STATE_ID,String.valueOf(evid - 5)); HCatPartition ptnToAdd2 = (new HCatPartition(tableCreated, ptnDesc, TestHCatClient.makePartLocation(tableCreated,ptnDesc))).parameters(props2); client.addPartition(HCatAddPartitionDesc.create(ptnToAdd2).build());
partitionSpec_1.put("grid", "AB"); partitionSpec_1.put("dt", "2011_12_31"); HCatPartition sourcePartition_1 = new HCatPartition(sourceTable, partitionSpec_1, makePartLocation(sourceTable,partitionSpec_1)); partitionSpec_2.put("grid", "AB"); partitionSpec_2.put("dt", "2012_01_01"); HCatPartition sourcePartition_2 = new HCatPartition(sourceTable, partitionSpec_2, makePartLocation(sourceTable,partitionSpec_2)); sourceMetaStore().addPartition(HCatAddPartitionDesc.create(sourcePartition_2).build());
partitionSpec_1.put("grid", "AB"); partitionSpec_1.put("dt", "2011_12_31"); HCatPartition sourcePartition_1 = new HCatPartition(sourceTable, partitionSpec_1, makePartLocation(sourceTable,partitionSpec_1)); partitionSpec_2.put("grid", "AB"); partitionSpec_2.put("dt", "2012_01_01"); HCatPartition sourcePartition_2 = new HCatPartition(sourceTable, partitionSpec_2, makePartLocation(sourceTable,partitionSpec_2)); sourceMetaStore().addPartition(HCatAddPartitionDesc.create(sourcePartition_2).build());
HCatPartition getHCatPartition(HCatTable hcatTable) throws HCatException { assert hcatPartition == null : "hcatPartition should have been null at this point."; assert dbName.equalsIgnoreCase(hcatTable.getDbName()) : "DB names don't match."; assert tableName.equalsIgnoreCase(hcatTable.getTableName()) : "Table names don't match."; return new HCatPartition(hcatTable, partitionKeyValues, location); }
HCatPartition getHCatPartition(HCatTable hcatTable) throws HCatException { assert hcatPartition == null : "hcatPartition should have been null at this point."; assert dbName.equalsIgnoreCase(hcatTable.getDbName()) : "DB names don't match."; assert tableName.equalsIgnoreCase(hcatTable.getTableName()) : "Table names don't match."; return new HCatPartition(hcatTable, partitionKeyValues, location); }
HCatPartition getHCatPartition(HCatTable hcatTable) throws HCatException { assert hcatPartition == null : "hcatPartition should have been null at this point."; assert dbName.equalsIgnoreCase(hcatTable.getDbName()) : "DB names don't match."; assert tableName.equalsIgnoreCase(hcatTable.getTableName()) : "Table names don't match."; return new HCatPartition(hcatTable, partitionKeyValues, location); }
@Override public HCatPartition deserializePartition(String hcatPartitionStringRep) throws HCatException { try { Partition partition = new Partition(); new TDeserializer(new TJSONProtocol.Factory()).deserialize(partition, hcatPartitionStringRep, "UTF-8"); return new HCatPartition(null, partition); } catch(TException exception) { if (LOG.isDebugEnabled()) LOG.debug("Could not de-serialize partition from: " + hcatPartitionStringRep); throw new HCatException("Could not de-serialize HCatPartition.", exception); } }
@Override public HCatPartition deserializePartition(String hcatPartitionStringRep) throws HCatException { try { Partition partition = new Partition(); new TDeserializer(new TJSONProtocol.Factory()).deserialize(partition, hcatPartitionStringRep, "UTF-8"); return new HCatPartition(null, partition); } catch(TException exception) { if (LOG.isDebugEnabled()) LOG.debug("Could not de-serialize partition from: " + hcatPartitionStringRep); throw new HCatException("Could not de-serialize HCatPartition.", exception); } }