@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { try { List<PartitionSpec> partitionSpecList = new ArrayList<PartitionSpec>(); TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory()); for (String stringRep : hcatPartitionSpecStrings) { PartitionSpec partSpec = new PartitionSpec(); deserializer.deserialize(partSpec, stringRep, "UTF-8"); partitionSpecList.add(partSpec); } return new HCatPartitionSpec(null, PartitionSpecProxy.Factory.get(partitionSpecList)); } catch (TException deserializationException) { throw new HCatException("Failed to deserialize!", deserializationException); } } }
/** * Setter for HCatTable. Required for deserialization. */ void hcatTable(HCatTable hcatTable) throws HCatException { assert this.hcatTable == null : "Expected hcatTable to be null at this point."; this.hcatTable = hcatTable; assert_invariant(); }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { HCatPartitionSpec hcatPartitionSpec = MetadataSerializer.get() .deserializePartitionSpec(hcatPartitionSpecStrings); hcatPartitionSpec .hcatTable(getTable(hcatPartitionSpec.getDbName(), hcatPartitionSpec.getTableName())); return hcatPartitionSpec; } }
@Override @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving public int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException { try { return hmsClient.add_partitions_pspec(partitionSpec.toPartitionSpecProxy()); } catch (InvalidObjectException e) { throw new HCatException( "InvalidObjectException while adding partition.", e); } catch (AlreadyExistsException e) { throw new HCatException( "AlreadyExistsException while adding partition.", e); } catch (MetaException e) { throw new HCatException("MetaException while adding partition.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException("The table " + "could not be found.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while adding partition.", e); } }
assertEquals("Unexpected number of source partitions.", 2, sourcePartitionSpec.size()); sourcePartitionSpec.size(), targetMetaStore().addPartitionSpec(targetPartitionSpec)); sourcePartitionSpec.size(), targetPartitionSpec.size()); HCatPartitionSpec.HCatPartitionIterator sourceIterator = sourcePartitionSpec.getPartitionIterator(); HCatPartitionSpec.HCatPartitionIterator targetIterator = targetPartitionSpec.getPartitionIterator();
@Override @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving public int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException { try { return hmsClient.add_partitions_pspec(partitionSpec.toPartitionSpecProxy()); } catch (InvalidObjectException e) { throw new HCatException( "InvalidObjectException while adding partition.", e); } catch (AlreadyExistsException e) { throw new HCatException( "AlreadyExistsException while adding partition.", e); } catch (MetaException e) { throw new HCatException("MetaException while adding partition.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException("The table " + "could not be found.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while adding partition.", e); } }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { HCatPartitionSpec hcatPartitionSpec = MetadataSerializer.get() .deserializePartitionSpec(hcatPartitionSpecStrings); hcatPartitionSpec .hcatTable(getTable(hcatPartitionSpec.getDbName(), hcatPartitionSpec.getTableName())); return hcatPartitionSpec; } }
@Override @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving public HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, int maxPartitions) throws HCatException { try { return new HCatPartitionSpec(getTable(dbName, tableName), hmsClient.listPartitionSpecs(dbName, tableName, maxPartitions)); } 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); } }
protected HCatPartitionSpec(HCatTable hcatTable, PartitionSpecProxy partitionSpecProxy) throws HCatException { this.hcatTable = hcatTable; this.partitionSpecProxy = partitionSpecProxy; assert_invariant(); }
@Override @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving public int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException { try { return hmsClient.add_partitions_pspec(partitionSpec.toPartitionSpecProxy()); } catch (InvalidObjectException e) { throw new HCatException( "InvalidObjectException while adding partition.", e); } catch (AlreadyExistsException e) { throw new HCatException( "AlreadyExistsException while adding partition.", e); } catch (MetaException e) { throw new HCatException("MetaException while adding partition.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException("The table " + "could not be found.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while adding partition.", e); } }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { HCatPartitionSpec hcatPartitionSpec = MetadataSerializer.get() .deserializePartitionSpec(hcatPartitionSpecStrings); hcatPartitionSpec .hcatTable(getTable(hcatPartitionSpec.getDbName(), hcatPartitionSpec.getTableName())); return hcatPartitionSpec; } }
@Override @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving public HCatPartitionSpec listPartitionSpecsByFilter(String dbName, String tblName, String filter, int maxPartitions) throws HCatException { try { return new HCatPartitionSpec(getTable(dbName, tblName), hmsClient.listPartitionSpecsByFilter(dbName, tblName, filter, maxPartitions)); } 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); } }
protected HCatPartitionSpec(HCatTable hcatTable, PartitionSpecProxy partitionSpecProxy) throws HCatException { this.hcatTable = hcatTable; this.partitionSpecProxy = partitionSpecProxy; assert_invariant(); }
@Override @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving public int addPartitionSpec(HCatPartitionSpec partitionSpec) throws HCatException { try { return hmsClient.add_partitions_pspec(partitionSpec.toPartitionSpecProxy()); } catch (InvalidObjectException e) { throw new HCatException( "InvalidObjectException while adding partition.", e); } catch (AlreadyExistsException e) { throw new HCatException( "AlreadyExistsException while adding partition.", e); } catch (MetaException e) { throw new HCatException("MetaException while adding partition.", e); } catch (NoSuchObjectException e) { throw new ObjectNotFoundException("The table " + "could not be found.", e); } catch (TException e) { throw new ConnectionFailureException( "TException while adding partition.", e); } }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { HCatPartitionSpec hcatPartitionSpec = MetadataSerializer.get() .deserializePartitionSpec(hcatPartitionSpecStrings); hcatPartitionSpec .hcatTable(getTable(hcatPartitionSpec.getDbName(), hcatPartitionSpec.getTableName())); return hcatPartitionSpec; } }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { try { List<PartitionSpec> partitionSpecList = new ArrayList<PartitionSpec>(); TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory()); for (String stringRep : hcatPartitionSpecStrings) { PartitionSpec partSpec = new PartitionSpec(); deserializer.deserialize(partSpec, stringRep, "UTF-8"); partitionSpecList.add(partSpec); } return new HCatPartitionSpec(null, PartitionSpecProxy.Factory.get(partitionSpecList)); } catch (TException deserializationException) { throw new HCatException("Failed to deserialize!", deserializationException); } } }
/** * Setter for HCatTable. Required for deserialization. */ void hcatTable(HCatTable hcatTable) throws HCatException { assert this.hcatTable == null : "Expected hcatTable to be null at this point."; this.hcatTable = hcatTable; assert_invariant(); }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { try { List<PartitionSpec> partitionSpecList = new ArrayList<PartitionSpec>(); TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory()); for (String stringRep : hcatPartitionSpecStrings) { PartitionSpec partSpec = new PartitionSpec(); deserializer.deserialize(partSpec, stringRep, "UTF-8"); partitionSpecList.add(partSpec); } return new HCatPartitionSpec(null, PartitionSpecProxy.Factory.get(partitionSpecList)); } catch (TException deserializationException) { throw new HCatException("Failed to deserialize!", deserializationException); } } }
protected HCatPartitionSpec(HCatTable hcatTable, PartitionSpecProxy partitionSpecProxy) throws HCatException { this.hcatTable = hcatTable; this.partitionSpecProxy = partitionSpecProxy; assert_invariant(); }
@Override public HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings) throws HCatException { try { List<PartitionSpec> partitionSpecList = new ArrayList<PartitionSpec>(); TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory()); for (String stringRep : hcatPartitionSpecStrings) { PartitionSpec partSpec = new PartitionSpec(); deserializer.deserialize(partSpec, stringRep, "UTF-8"); partitionSpecList.add(partSpec); } return new HCatPartitionSpec(null, PartitionSpecProxy.Factory.get(partitionSpecList)); } catch (TException deserializationException) { throw new HCatException("Failed to deserialize!", deserializationException); } } }