protected Storage(String name, Map<String, String> properties) { super(name, COLUMNS, properties, 0L); addProperties(); }
/** * Update existing partitions * @param client hive client instance * @param fact fact name * @param partitions partitions to be updated * @throws InvalidOperationException * @throws HiveException */ public void updatePartitions(String storageTable, Hive client, String fact, List<Partition> partitions) throws InvalidOperationException, HiveException { boolean success = false; try { client.alterPartitions(storageTable, partitions, null); success = true; } finally { if (success) { commitUpdatePartition(partitions); } else { rollbackUpdatePartition(partitions); } } }
@Override protected void addProperties() { super.addProperties(); getProperties().put(MetastoreUtil.getStorageClassKey(getName()), getClass().getCanonicalName()); }
public static String getFactOrDimtableStorageTableName(String factName, String storageName) { return getStorageTableName(factName, Storage.getPrefix(storageName)); }
/** * Update existing partition * @param client hive client instance * @param fact fact name * @param partition partition to be updated * @throws InvalidOperationException * @throws HiveException */ public void updatePartition(Hive client, String fact, Partition partition) throws InvalidOperationException, HiveException { client.alterPartition(MetastoreUtil.getFactOrDimtableStorageTableName(fact, getName()), partition, null); }
getStorage(storageName).addPartitions(getClient(), factOrDimTable, updatePeriod, storagePartitionDescs, latestInfos, storageTableName); ListIterator<Partition> iter = partsAdded.listIterator(); partsAdded = getStorage(storageName).addPartitions(getClient(), factOrDimTable, updatePeriod, storagePartitionDescs, null, storageTableName); alterTablePartitionCache((Storage.getPrefix(storageName) + factOrDimTable).toLowerCase(), updatePeriod, storageTableName); return partsAdded;
getStorage(storageName).dropPartition(getClient(), storageTableName, partVals, latest, nonTimePartSpec); if (!latestAvailable) { getStorage(storageName).dropPartition(getClient(), storageTableName, partVals, null, null); if (partitionTimelineCache.updateForDeletion(cubeTableName, storageName, updatePeriod, timePartSpec)) { this.alterTablePartitionCache((Storage.getPrefix(storageName) + cubeTableName).toLowerCase(), updatePeriod, storageTableName);
preDropPartition(storageTableName, partVals); boolean success = false; try { } finally { if (success) { commitDropPartition(storageTableName, partVals); } else { rollbackDropPartition(storageTableName, partVals);
List<StoragePartitionDesc> storagePartitionDescs, Map<Map<String, String>, LatestInfo> latestInfos, String tableName) throws HiveException { preAddPartitions(storagePartitionDescs); Map<Map<String, String>, Map<String, Integer>> latestPartIndexForPartCols = Maps.newHashMap(); boolean success = false; } finally { if (success) { commitAddPartitions(storagePartitionDescs); } else { rollbackAddPartitions(storagePartitionDescs);
private Storage getStorage(Table tbl) throws LensException { return Storage.createInstance(tbl); }
public static String getFactOrDimtableStorageTableName(String factName, String storageName) { return getStorageTableName(factName, Storage.getPrefix(storageName)); }
@Override protected void addProperties() { super.addProperties(); getProperties().put(MetastoreUtil.getStorageClassKey(getName()), getClass().getCanonicalName()); }
/** * Update existing partition * @param client hive client instance * @param fact fact name * @param partition partition to be updated * @throws InvalidOperationException * @throws HiveException */ public void updatePartition(Hive client, String fact, Partition partition) throws InvalidOperationException, HiveException { client.alterPartition(MetastoreUtil.getFactOrDimtableStorageTableName(fact, getName()), partition, null); }
getStorage(storageName).addPartitions(getClient(), factOrDimTable, updatePeriod, storagePartitionDescs, latestInfos, storageTableName); ListIterator<Partition> iter = partsAdded.listIterator(); partsAdded = getStorage(storageName).addPartitions(getClient(), factOrDimTable, updatePeriod, storagePartitionDescs, null, storageTableName); alterTablePartitionCache((Storage.getPrefix(storageName) + factOrDimTable).toLowerCase(), updatePeriod, storageTableName); return partsAdded;
getStorage(storageName).dropPartition(getClient(), storageTableName, partVals, latest, nonTimePartSpec); if (!latestAvailable) { getStorage(storageName).dropPartition(getClient(), storageTableName, partVals, null, null); if (partitionTimelineCache.updateForDeletion(cubeTableName, storageName, updatePeriod, timePartSpec)) { this.alterTablePartitionCache((Storage.getPrefix(storageName) + cubeTableName).toLowerCase(), updatePeriod, storageTableName);
preDropPartition(storageTableName, partVals); boolean success = false; try { } finally { if (success) { commitDropPartition(storageTableName, partVals); } else { rollbackDropPartition(storageTableName, partVals);
List<StoragePartitionDesc> storagePartitionDescs, Map<Map<String, String>, LatestInfo> latestInfos, String tableName) throws HiveException { preAddPartitions(storagePartitionDescs); Map<Map<String, String>, Map<String, Integer>> latestPartIndexForPartCols = Maps.newHashMap(); boolean success = false; } finally { if (success) { commitAddPartitions(storagePartitionDescs); } else { rollbackAddPartitions(storagePartitionDescs);
private Storage getStorage(Table tbl) throws LensException { return Storage.createInstance(tbl); }
private Set<String> getAllTablesForStorage(LensSessionHandle sessionHandle, String fact, String storageName) throws LensException { Set<String> storageTableNames = new HashSet<>(); if (getClient(sessionHandle).isFactTable(fact)) { CubeFactTable cft = getClient(sessionHandle).getCubeFactTable(fact); Map<UpdatePeriod, String> storageMap = cft.getStoragePrefixUpdatePeriodMap().get(storageName); for (Map.Entry entry : storageMap.entrySet()) { storageTableNames.add(MetastoreUtil.getStorageTableName(fact, Storage.getPrefix((String) entry.getValue()))); } } else { storageTableNames.add(MetastoreUtil.getFactOrDimtableStorageTableName(fact, storageName)); } return storageTableNames; }