private PartitionSpecProxy buildPartitionSpecWithSharedSD(List<PartitionWithoutSD> partitions, StorageDescriptor sd) throws MetaException { PartitionSpec partitionSpec = new PartitionSpec(); partitionSpec.setDbName(DB_NAME); partitionSpec.setTableName(TABLE_NAME); PartitionSpecWithSharedSD partitionList = new PartitionSpecWithSharedSD(); partitionList.setPartitions(partitions); partitionList.setSd(sd); partitionSpec.setSharedSDPartitionSpec(partitionList); return PartitionSpecProxy.Factory.get(partitionSpec); }
public Object getFieldValue(_Fields field) { switch (field) { case PARTITIONS: return getPartitions(); case SD: return getSd(); } throw new IllegalStateException(); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof PartitionSpecWithSharedSD) return this.equals((PartitionSpecWithSharedSD)that); return false; }
public void setFieldValue(_Fields field, Object value) { switch (field) { case PARTITIONS: if (value == null) { unsetPartitions(); } else { setPartitions((List<PartitionWithoutSD>)value); } break; case SD: if (value == null) { unsetSd(); } else { setSd((StorageDescriptor)value); } break; } }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case PARTITIONS: return isSetPartitions(); case SD: return isSetSd(); } throw new IllegalStateException(); }
case 4: // SHARED_SDPARTITION_SPEC if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.sharedSDPartitionSpec = new PartitionSpecWithSharedSD(); struct.sharedSDPartitionSpec.read(iprot); struct.setSharedSDPartitionSpecIsSet(true); } else {
public PartitionSpecWithSharedSD deepCopy() { return new PartitionSpecWithSharedSD(this); }
private void getPartitionsWithNames(List<String> names, int expectedPartitionCount) throws TException { GetPartitionsRequest request = getGetPartitionsRequest(); GetPartitionsProjectionSpec projectSpec = request.getProjectionSpec(); projectSpec.setFieldList(Arrays.asList("sd.location")); request.getFilterSpec().setFilterMode(PartitionFilterMode.BY_NAMES); request.getFilterSpec().setFilters(names); GetPartitionsResponse response = client.getPartitionsWithSpecs(request); Assert.assertNotNull(response); if (expectedPartitionCount > 0) { PartitionSpecWithSharedSD partitionSpecWithSharedSD = response.getPartitionSpec().get(0).getSharedSDPartitionSpec(); Assert.assertNotNull(partitionSpecWithSharedSD); Assert.assertEquals("Invalid number of partitions returned", expectedPartitionCount, partitionSpecWithSharedSD.getPartitionsSize()); List<Partition> origPartitions = client.getPartitionsByNames(dbName, tblName, names); verifyLocations(origPartitions, partitionSpecWithSharedSD.getSd(), partitionSpecWithSharedSD.getPartitions()); } else { Assert.assertTrue( "Partition spec should have been empty since filter doesn't match with any partitions", response.getPartitionSpec().isEmpty()); } }
@Override public boolean hasNext() { return index < pSpec.getPartitions().size(); }
@Override public void setRootLocation(String rootLocation) throws MetaException { partitionSpec.setRootPath(rootLocation); partitionSpec.getSharedSDPartitionSpec().getSd().setLocation(rootLocation); }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public int size() { return partitionSpec.getSharedSDPartitionSpec().getPartitionsSize(); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case PARTITIONS: if (value == null) { unsetPartitions(); } else { setPartitions((List<PartitionWithoutSD>)value); } break; case SD: if (value == null) { unsetSd(); } else { setSd((StorageDescriptor)value); } break; } }
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_partitions = true && (isSetPartitions()); list.add(present_partitions); if (present_partitions) list.add(partitions); boolean present_sd = true && (isSetSd()); list.add(present_sd); if (present_sd) list.add(sd); return list.hashCode(); }
struct.sharedSDPartitionSpec = new PartitionSpecWithSharedSD(); struct.sharedSDPartitionSpec.read(iprot); struct.setSharedSDPartitionSpecIsSet(true);
/** * Performs a deep copy on <i>other</i>. */ public PartitionSpec(PartitionSpec other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetDbName()) { this.dbName = other.dbName; } if (other.isSetTableName()) { this.tableName = other.tableName; } if (other.isSetRootPath()) { this.rootPath = other.rootPath; } if (other.isSetSharedSDPartitionSpec()) { this.sharedSDPartitionSpec = new PartitionSpecWithSharedSD(other.sharedSDPartitionSpec); } if (other.isSetPartitionList()) { this.partitionList = new PartitionListComposingSpec(other.partitionList); } if (other.isSetCatName()) { this.catName = other.catName; } this.writeId = other.writeId; this.isStatsCompliant = other.isStatsCompliant; }
private void getPartitionsWithVals(List<String> filters, int expectedPartitions) throws TException { // get partitions from "trusted" API List<Partition> partitions = client.listPartitions(dbName, tblName, filters, (short) -1); GetPartitionsRequest request = getGetPartitionsRequest(); GetPartitionsProjectionSpec projectSpec = request.getProjectionSpec(); projectSpec.setFieldList(Arrays.asList("sd.location")); request.getFilterSpec().setFilterMode(PartitionFilterMode.BY_VALUES); request.getFilterSpec().setFilters(filters); GetPartitionsResponse response = client.getPartitionsWithSpecs(request); Assert.assertNotNull(response); if (expectedPartitions > 0) { PartitionSpecWithSharedSD partitionSpecWithSharedSD = response.getPartitionSpec().get(0).getSharedSDPartitionSpec(); Assert.assertNotNull(partitionSpecWithSharedSD); Assert.assertEquals("Invalid number of partitions returned", expectedPartitions, partitionSpecWithSharedSD.getPartitionsSize()); verifyLocations(partitions, partitionSpecWithSharedSD.getSd(), partitionSpecWithSharedSD.getPartitions()); } else { Assert.assertTrue( "Partition spec should have been empty since filter doesn't match with any partitions", response.getPartitionSpec().isEmpty()); } }
@Override public void remove() { pSpec.getPartitions().remove(index); }
public PartitionSpecWithSharedSDProxy(PartitionSpec partitionSpec) throws MetaException { assert partitionSpec.isSetSharedSDPartitionSpec(); if (partitionSpec.getSharedSDPartitionSpec().getSd() == null) { throw new MetaException("The shared storage descriptor must be set."); } this.partitionSpec = partitionSpec; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }