public PartitionSpecWithSharedSD deepCopy() { return new PartitionSpecWithSharedSD(this); }
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);
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 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); }
private PartitionSpecProxy buildPartitionSpec(List<Partition> partitions, List<PartitionWithoutSD> partitionsWithoutSD) throws MetaException { List<PartitionSpec> partitionSpecs = new ArrayList<>(); PartitionSpec partitionSpec = new PartitionSpec(); partitionSpec.setDbName(DB_NAME); partitionSpec.setTableName(TABLE_NAME); PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec(); partitionListComposingSpec.setPartitions(partitions); partitionSpec.setPartitionList(partitionListComposingSpec); PartitionSpec partitionSpecSharedSD = new PartitionSpec(); partitionSpecSharedSD.setDbName(DB_NAME); partitionSpecSharedSD.setTableName(TABLE_NAME); PartitionSpecWithSharedSD partitionSpecWithSharedSD = new PartitionSpecWithSharedSD(); partitionSpecWithSharedSD.setPartitions(partitionsWithoutSD); partitionSpecWithSharedSD .setSd(buildSD(metaStore.getWarehouseRoot() + "/" + TABLE_NAME + "/sharedSDTest/")); partitionSpecSharedSD.setSharedSDPartitionSpec(partitionSpecWithSharedSD); partitionSpecs.add(partitionSpec); partitionSpecs.add(partitionSpecSharedSD); return PartitionSpecProxy.Factory.get(partitionSpecs); }
@Test public void testAddPartitionSpecBothTypeSet() throws Exception { Table table = createTable(); Partition partition = buildPartition(Lists.newArrayList("2013"), getYearPartCol(), 1); PartitionWithoutSD partitionWithoutSD = buildPartitionWithoutSD(Lists.newArrayList("2014"), 0); PartitionSpec partitionSpec = new PartitionSpec(); partitionSpec.setDbName(DB_NAME); partitionSpec.setTableName(TABLE_NAME); PartitionListComposingSpec partitionListComposingSpec = new PartitionListComposingSpec(); partitionListComposingSpec.setPartitions(Lists.newArrayList(partition)); partitionSpec.setPartitionList(partitionListComposingSpec); PartitionSpecWithSharedSD partitionSpecWithSharedSD = new PartitionSpecWithSharedSD(); partitionSpecWithSharedSD.setPartitions(Lists.newArrayList(partitionWithoutSD)); partitionSpecWithSharedSD.setSd(buildSD(table.getSd().getLocation() + "/sharedSDTest/")); partitionSpec.setSharedSDPartitionSpec(partitionSpecWithSharedSD); PartitionSpecProxy partitionSpecProxy = PartitionSpecProxy.Factory.get(partitionSpec); client.add_partitions_pspec(partitionSpecProxy); List<String> partitionNames = client.listPartitionNames(DB_NAME, TABLE_NAME, MAX); Assert.assertNotNull(partitionNames); Assert.assertTrue(partitionNames.size() == 1); Assert.assertEquals("year=2013", partitionNames.get(0)); }
/** * Convert list of partitions to a PartitionSpec object. */ private static PartitionSpec getSharedSDPartSpec(Table table, StorageDescriptorKey sdKey, List<PartitionWithoutSD> partitions) { StorageDescriptor sd; if (sdKey.getSd() == null) { //sd is not requested set it empty StorageDescriptor in the PartitionSpec sd = new StorageDescriptor(); } else { sd = new StorageDescriptor(sdKey.getSd()); sd.setLocation(sdKey.baseLocation); // Use table-dir as root-dir. } PartitionSpecWithSharedSD sharedSDPartSpec = new PartitionSpecWithSharedSD(); sharedSDPartSpec.setPartitions(partitions); sharedSDPartSpec.setSd(sd); PartitionSpec ret = new PartitionSpec(); ret.setRootPath(sd.getLocation()); ret.setSharedSDPartitionSpec(sharedSDPartSpec); ret.setDbName(table.getDbName()); ret.setTableName(table.getTableName()); return ret; }
@Test public void testAddPartitionSpecWithSharedSDUpperCaseDBAndTableName() throws Exception { Table table = createTable(); PartitionWithoutSD partition = buildPartitionWithoutSD(Lists.newArrayList("2013"), 1); List<PartitionWithoutSD> partitions = Lists.newArrayList(partition); String location = table.getSd().getLocation() + "/sharedSDTest/"; PartitionSpec partitionSpec = new PartitionSpec(); partitionSpec.setDbName(DB_NAME.toUpperCase()); partitionSpec.setTableName(TABLE_NAME.toUpperCase()); PartitionSpecWithSharedSD partitionList = new PartitionSpecWithSharedSD(); partitionList.setPartitions(partitions); partitionList.setSd(buildSD(location)); partitionSpec.setSharedSDPartitionSpec(partitionList); PartitionSpecProxy partitionSpecProxy = PartitionSpecProxy.Factory.get(partitionSpec); client.add_partitions_pspec(partitionSpecProxy); Partition part = client.getPartition(DB_NAME, TABLE_NAME, "year=2013"); Assert.assertNotNull(part); Assert.assertEquals(DB_NAME, part.getDbName()); Assert.assertEquals(TABLE_NAME, part.getTableName()); Assert.assertEquals(metaStore.getWarehouseRoot() + "/" + TABLE_NAME + "/sharedSDTest/partwithoutsd1", part.getSd().getLocation()); }
public PartitionSpecWithSharedSD deepCopy() { return new PartitionSpecWithSharedSD(this); }
public PartitionSpecWithSharedSD deepCopy() { return new PartitionSpecWithSharedSD(this); }
public PartitionSpecWithSharedSD deepCopy() { return new PartitionSpecWithSharedSD(this); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, PartitionSpec struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); } if (incoming.get(1)) { struct.tableName = iprot.readString(); struct.setTableNameIsSet(true); } if (incoming.get(2)) { struct.rootPath = iprot.readString(); struct.setRootPathIsSet(true); } if (incoming.get(3)) { struct.sharedSDPartitionSpec = new PartitionSpecWithSharedSD(); struct.sharedSDPartitionSpec.read(iprot); struct.setSharedSDPartitionSpecIsSet(true); } if (incoming.get(4)) { struct.partitionList = new PartitionListComposingSpec(); struct.partitionList.read(iprot); struct.setPartitionListIsSet(true); } } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, PartitionSpec struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { struct.dbName = iprot.readString(); struct.setDbNameIsSet(true); } if (incoming.get(1)) { struct.tableName = iprot.readString(); struct.setTableNameIsSet(true); } if (incoming.get(2)) { struct.rootPath = iprot.readString(); struct.setRootPathIsSet(true); } if (incoming.get(3)) { struct.sharedSDPartitionSpec = new PartitionSpecWithSharedSD(); struct.sharedSDPartitionSpec.read(iprot); struct.setSharedSDPartitionSpecIsSet(true); } if (incoming.get(4)) { struct.partitionList = new PartitionListComposingSpec(); struct.partitionList.read(iprot); struct.setPartitionListIsSet(true); } } }
/** * Performs a deep copy on <i>other</i>. */ public PartitionSpec(PartitionSpec other) { 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); } }
/** * Performs a deep copy on <i>other</i>. */ public PartitionSpec(PartitionSpec other) { 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); } }
/** * Performs a deep copy on <i>other</i>. */ public PartitionSpec(PartitionSpec other) { 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; } }
private PartitionSpec getSharedSDPartSpec(Table table, StorageDescriptorKey sdKey, List<PartitionWithoutSD> partitions) { StorageDescriptor sd = new StorageDescriptor(sdKey.getSd()); sd.setLocation(table.getSd().getLocation()); // Use table-dir as root-dir. PartitionSpecWithSharedSD sharedSDPartSpec = new PartitionSpecWithSharedSD(partitions, sd); PartitionSpec ret = new PartitionSpec(); ret.setRootPath(sd.getLocation()); ret.setSharedSDPartitionSpec(sharedSDPartSpec); ret.setDbName(table.getDbName()); ret.setTableName(table.getTableName()); return ret; }
private PartitionSpec getSharedSDPartSpec(Table table, StorageDescriptorKey sdKey, List<PartitionWithoutSD> partitions) { StorageDescriptor sd = new StorageDescriptor(sdKey.getSd()); sd.setLocation(table.getSd().getLocation()); // Use table-dir as root-dir. PartitionSpecWithSharedSD sharedSDPartSpec = new PartitionSpecWithSharedSD(partitions, sd); PartitionSpec ret = new PartitionSpec(); ret.setRootPath(sd.getLocation()); ret.setSharedSDPartitionSpec(sharedSDPartSpec); ret.setDbName(table.getDbName()); ret.setTableName(table.getTableName()); return ret; }
private PartitionSpec getSharedSDPartSpec(Table table, StorageDescriptorKey sdKey, List<PartitionWithoutSD> partitions) { StorageDescriptor sd = new StorageDescriptor(sdKey.getSd()); sd.setLocation(table.getSd().getLocation()); // Use table-dir as root-dir. PartitionSpecWithSharedSD sharedSDPartSpec = new PartitionSpecWithSharedSD(partitions, sd); PartitionSpec ret = new PartitionSpec(); ret.setRootPath(sd.getLocation()); ret.setSharedSDPartitionSpec(sharedSDPartSpec); ret.setDbName(table.getDbName()); ret.setTableName(table.getTableName()); return ret; }