private Path getViewPath(List<String> tableSchemaPath) { List<String> fullPath = resolveTableNameToValidPath(tableSchemaPath); String parentPath = PathUtils.toFSPathString(fullPath.subList(0, fullPath.size() - 1)); return DotFileType.VIEW.getPath(parentPath, tableSchemaPath.get(tableSchemaPath.size() - 1)); }
@Override public boolean containerExists(NamespaceKey key) { final List<String> folderPath = key.getPathComponents(); try { return getFS(SYSTEM_USERNAME).isDirectory(PathUtils.toFSPath(resolveTableNameToValidPath(folderPath))); } catch (IOException e) { logger.debug("Failure reading path.", e); return false; } }
@Override public boolean datasetExists(NamespaceKey key) { final List<String> filePath = key.getPathComponents(); try { return getFS(SYSTEM_USERNAME).exists(PathUtils.toFSPath(resolveTableNameToValidPath(filePath))); } catch (IOException e) { logger.debug("Failure reading path.", e); return false; } }
protected boolean fileExists(String username, List<String> filePath) throws IOException { return getFS(username).isFile(PathUtils.toFSPath(resolveTableNameToValidPath(filePath))); }
public List<SchemaEntity> list(List<String> folderPath, String userName) { try { final List<FileStatus> files = Lists.newArrayList(getFS(userName).listStatus(PathUtils.toFSPath(resolveTableNameToValidPath(folderPath)))); final Set<List<String>> tableNames = Sets.newHashSet(); final NamespaceService ns = context.getNamespaceService(userName); for(NameSpaceContainer entity : ns.list(folderNSKey)) { if (entity.getType() == Type.DATASET) { tableNames.add(resolveTableNameToValidPath(entity.getDataset().getFullPathList()));
/** * Fetches a single item from the filesystem plugin */ public SchemaEntity get(List<String> path, String userName) { try { final FileStatus status = getFS(userName).getFileStatus(PathUtils.toFSPath(resolveTableNameToValidPath(path))); final Set<List<String>> tableNames = Sets.newHashSet(); final NamespaceService ns = context.getNamespaceService(userName); final NamespaceKey folderNSKey = new NamespaceKey(path); if (ns.exists(folderNSKey)) { for(NameSpaceContainer entity : ns.list(folderNSKey)) { if (entity.getType() == Type.DATASET) { tableNames.add(resolveTableNameToValidPath(entity.getDataset().getFullPathList())); } } } List<String> p = PathUtils.toPathComponents(status.getPath()); return getSchemaEntity(status, tableNames, p); } catch (IOException | NamespaceException e) { throw new RuntimeException(e); } }
public Iterable<String> getSubPartitions(List<String> table, List<String> partitionColumns, List<String> partitionValues, SchemaConfig schemaConfig ) throws PartitionNotFoundException { List<FileStatus> fileStatuses; try { Path fullPath = PathUtils.toFSPath(resolveTableNameToValidPath(table)); fileStatuses = getFS(schemaConfig.getUserName()).list(fullPath, false); } catch (IOException e) { throw new PartitionNotFoundException("Error finding partitions for table " + table, e); } return new SubDirectoryList(fileStatuses); }
return null; // not a valid table schema path final List<String> fullPath = resolveTableNameToValidPath(datasetPath.getPathComponents()); try {
final FileSystemPlugin plugin = getPlugin(key); final FileSystemWrapper fs = plugin.getFS(securityContext.getUserPrincipal().getName()); final Path path = FileSelection.getPathBasedOnFullPath(plugin.resolveTableNameToValidPath(key.getPathComponents()));
List<String> fullPath = resolveTableNameToValidPath(tableSchemaPath); FileSelection fileSelection; try {
private FileFormat detectFileFormat(NamespaceKey key) { final FileSystemPlugin plugin = getPlugin(key); final FileSystemWrapper fs = plugin.getFS(securityContext.getUserPrincipal().getName()); final Path path = FileSelection.getPathBasedOnFullPath(plugin.resolveTableNameToValidPath(key.getPathComponents()));