@Override public void update(DatasetSpecification oldSpec) throws IOException { // we don't allow changing the location for an internal file set // the only way the baseLocation can change is that it is externalized to an outside location // in this case, we have already validated the location is outside (via determineBaseLocation) // all we need to do is therefore to move it to the new base location if that location has changed if (isExternal && !FileSetProperties.isDataExternal(oldSpec.getProperties())) { Location oldBaseLocation = FileSetDataset.determineBaseLocation( datasetContext, cConf, oldSpec, locationFactory, namespacePathLocator); if (!baseLocation.equals(oldBaseLocation)) { oldBaseLocation.renameTo(baseLocation); } } } }
@Override public void update(DatasetSpecification oldSpec) throws IOException { // we don't allow changing the location for an internal file set // the only way the baseLocation can change is that it is externalized to an outside location // in this case, we have already validated the location is outside (via determineBaseLocation) // all we need to do is therefore to move it to the new base location if that location has changed if (isExternal && !FileSetProperties.isDataExternal(oldSpec.getProperties())) { Location oldBaseLocation = FileSetDataset.determineBaseLocation( datasetContext, cConf, oldSpec, locationFactory, namespacedLocationFactory); if (!baseLocation.equals(oldBaseLocation)) { oldBaseLocation.renameTo(baseLocation); } } } }
@Override public DatasetSpecification reconfigure(String instanceName, DatasetProperties newProperties, DatasetSpecification currentSpec) throws IncompatibleUpdateException { validateProperties(newProperties.getProperties()); boolean wasExternal = FileSetProperties.isDataExternal(currentSpec.getProperties()); boolean isExternal = FileSetProperties.isDataExternal(newProperties.getProperties()); String oldPath = FileSetProperties.getBasePath(currentSpec.getProperties()); String newPath = FileSetProperties.getBasePath(newProperties.getProperties()); // validate that we are not "internalizing" an external location if (wasExternal && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot convert external file set '%s' to non-external.", instanceName)); } // allow change of path only if the dataset is external if (!Objects.equals(oldPath, newPath) && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot change the base path of non-external file set '%s'.", instanceName)); } return configure(instanceName, newProperties); }
@Override public DatasetSpecification reconfigure(String instanceName, DatasetProperties newProperties, DatasetSpecification currentSpec) throws IncompatibleUpdateException { validateProperties(newProperties.getProperties()); boolean wasExternal = FileSetProperties.isDataExternal(currentSpec.getProperties()); boolean isExternal = FileSetProperties.isDataExternal(newProperties.getProperties()); String oldPath = FileSetProperties.getBasePath(currentSpec.getProperties()); String newPath = FileSetProperties.getBasePath(newProperties.getProperties()); // validate that we are not "internalizing" an external location if (wasExternal && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot convert external file set '%s' to non-external.", instanceName)); } // allow change of path only if the dataset is external if (!Objects.equals(oldPath, newPath) && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot change the base path of non-external file set '%s'.", instanceName)); } return configure(instanceName, newProperties); }
public PartitionedFileSetDataset(DatasetContext datasetContext, String name, Partitioning partitioning, FileSet fileSet, IndexedTable partitionTable, DatasetSpecification spec, Map<String, String> arguments, Provider<ExploreFacade> exploreFacadeProvider) { super(name, partitionTable); this.files = fileSet; this.partitionsTable = partitionTable; this.spec = spec; this.isExternal = FileSetProperties.isDataExternal(spec.getProperties()); this.exploreEnabled = FileSetProperties.isExploreEnabled(spec.getProperties()); this.runtimeArguments = arguments; this.partitioning = partitioning; this.exploreFacadeProvider = exploreFacadeProvider; this.datasetInstanceId = new DatasetId(datasetContext.getNamespaceId(), name); }
public PartitionedFileSetDataset(DatasetContext datasetContext, String name, Partitioning partitioning, FileSet fileSet, IndexedTable partitionTable, DatasetSpecification spec, Map<String, String> arguments, Provider<ExploreFacade> exploreFacadeProvider) { super(name, partitionTable); this.files = fileSet; this.partitionsTable = partitionTable; this.spec = spec; this.isExternal = FileSetProperties.isDataExternal(spec.getProperties()); this.exploreEnabled = FileSetProperties.isExploreEnabled(spec.getProperties()); this.runtimeArguments = arguments; this.partitioning = partitioning; this.exploreFacadeProvider = exploreFacadeProvider; this.datasetInstanceId = new DatasetId(datasetContext.getNamespaceId(), name); }
FileSetAdmin(DatasetContext datasetContext, CConfiguration cConf, LocationFactory locationFactory, NamespacePathLocator namespacePathLocator, DatasetSpecification spec) throws IOException { this.spec = spec; this.isExternal = FileSetProperties.isDataExternal(spec.getProperties()); this.useExisting = FileSetProperties.isUseExisting(spec.getProperties()); this.possessExisting = FileSetProperties.isPossessExisting(spec.getProperties()); this.baseLocation = FileSetDataset.determineBaseLocation(datasetContext, cConf, spec, locationFactory, namespacePathLocator); this.datasetContext = datasetContext; this.cConf = cConf; this.locationFactory = locationFactory; this.namespacePathLocator = namespacePathLocator; }
FileSetAdmin(DatasetContext datasetContext, CConfiguration cConf, LocationFactory locationFactory, NamespacedLocationFactory namespacedLocationFactory, DatasetSpecification spec) throws IOException { this.spec = spec; this.isExternal = FileSetProperties.isDataExternal(spec.getProperties()); this.useExisting = FileSetProperties.isUseExisting(spec.getProperties()); this.possessExisting = FileSetProperties.isPossessExisting(spec.getProperties()); this.baseLocation = FileSetDataset.determineBaseLocation(datasetContext, cConf, spec, locationFactory, namespacedLocationFactory); this.datasetContext = datasetContext; this.cConf = cConf; this.locationFactory = locationFactory; this.namespacedLocationFactory = namespacedLocationFactory; }
this.isExternal = FileSetProperties.isDataExternal(spec.getProperties());
this.isExternal = FileSetProperties.isDataExternal(spec.getProperties());