public PartitionAlreadyExistsException(String datasetName, PartitionKey partitionKey) { super(String.format("Dataset '%s' already has a partition with the same key: %s", datasetName, partitionKey.toString())); } }
private void dropPartitionFromExplore(PartitionKey key) { if (exploreEnabled) { ExploreFacade exploreFacade = exploreFacadeProvider.get(); if (exploreFacade != null) { try { exploreFacade.dropPartition(datasetInstanceId, spec, key); } catch (Exception e) { throw new DataSetException(String.format( "Unable to drop partition for key %s from explore table.", key.toString()), e); } } } }
private void dropPartitionFromExplore(PartitionKey key) { if (exploreEnabled) { ExploreFacade exploreFacade = exploreFacadeProvider.get(); if (exploreFacade != null) { try { exploreFacade.dropPartition(datasetInstanceId, spec, key); } catch (Exception e) { throw new DataSetException(String.format( "Unable to drop partition for key %s from explore table.", key.toString()), e); } } } }
@VisibleForTesting public void addPartitionToExplore(PartitionKey key, String path) { if (exploreEnabled) { ExploreFacade exploreFacade = exploreFacadeProvider.get(); if (exploreFacade != null) { try { exploreFacade.addPartition(datasetInstanceId, spec, key, files.getLocation(path).toURI().getPath()); } catch (Exception e) { throw new DataSetException(String.format( "Unable to add partition for key %s with path %s to explore table.", key.toString(), path), e); } } } }
@VisibleForTesting public void addPartitionToExplore(PartitionKey key, String path) { if (exploreEnabled) { ExploreFacade exploreFacade = exploreFacadeProvider.get(); if (exploreFacade != null) { try { exploreFacade.addPartition(datasetInstanceId, spec, key, files.getLocation(path).toURI().getPath()); } catch (Exception e) { throw new DataSetException(String.format( "Unable to add partition for key %s with path %s to explore table.", key.toString(), path), e); } } } }
@ReadWrite @Override public Future<Void> concatenatePartition(PartitionKey key) { PartitionDetail partition = getPartition(key); if (partition == null) { throw new PartitionNotFoundException(key, getName()); } try { if (exploreEnabled) { return exploreFacadeProvider.get().concatenatePartition(datasetInstanceId, spec, key); } else { return Futures.immediateFuture(null); } } catch (Exception e) { throw new DataSetException(String.format( "Unable to concatenate partition for key %s from explore table.", key.toString()), e); } }
@ReadWrite @Override public Future<Void> concatenatePartition(PartitionKey key) { PartitionDetail partition = getPartition(key); if (partition == null) { throw new PartitionNotFoundException(key, getName()); } try { if (exploreEnabled) { return exploreFacadeProvider.get().concatenatePartition(datasetInstanceId, spec, key); } else { return Futures.immediateFuture(null); } } catch (Exception e) { throw new DataSetException(String.format( "Unable to concatenate partition for key %s from explore table.", key.toString()), e); } }
@Override public void map(LongWritable pos, Text text, Context context) throws IOException, InterruptedException { String line = text.toString(); String[] fields = line.split(SEPARATOR); context.write(rowToWrite, new Put(rowToWrite, Bytes.toBytes(fields[0]), Bytes.toBytes(fields[1]))); context.write(rowToWrite, new Put(rowToWrite, Bytes.toBytes(fields[0] + "_key"), Bytes.toBytes(pfsInputcontext.getInputPartitionKey().toString()))); } }
throw new DataSetException(String.format("Attempting to append to Dataset '%s', to partition '%s' with a " + "different path. Original path: '%s'. New path: '%s'", getName(), key.toString(), existingPath, path));
throw new DataSetException(String.format("Attempting to append to Dataset '%s', to partition '%s' with a " + "different path. Original path: '%s'. New path: '%s'", getName(), key.toString(), existingPath, path));