if (!writeInfo.getWriteMode().isWritePathSameAsTargetPath()) { if (HiveWriteUtils.pathExists(new HdfsContext(session, schemaName, tableName), hdfsEnvironment, writeInfo.getTargetPath())) { throw new PrestoException(HIVE_PATH_ALREADY_EXISTS, format( "Target directory for new partition '%s' of table '%s.%s' already exists: %s", schemaName, tableName, writeInfo.getTargetPath())); checkState(writeInfo.getWriteMode() != DIRECT_TO_TARGET_EXISTING_DIRECTORY, "Overwriting existing partition doesn't support DIRECT_TO_TARGET_EXISTING_DIRECTORY write mode"); Path path = new Path(writeInfo.getWritePath(), fileNameWithExtension); updateMode, fileNameWithExtension, writeInfo.getWritePath().toString(), writeInfo.getTargetPath().toString(), onCommit, hiveWriterStats);
database, tableName.getTableName(), locationService.getTableWriteInfo(((HiveOutputTableHandle) outputHandle).getLocationHandle()).getTargetPath().toString());
LocationService locationService = getLocationService(); LocationHandle locationHandle = locationService.forNewTable(transaction.getMetastore(schemaName), session, schemaName, tableName); targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath(); Table table = createSimpleTable(schemaTableName, columns, session, targetPath, "q1"); transaction.getMetastore(schemaName)
targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath();
protected Path getTargetPathRoot(ConnectorInsertTableHandle insertTableHandle) { HiveInsertTableHandle hiveInsertTableHandle = (HiveInsertTableHandle) insertTableHandle; return getLocationService() .getQueryWriteInfo(hiveInsertTableHandle.getLocationHandle()) .getTargetPath(); }
protected Path getStagingPathRoot(ConnectorOutputTableHandle outputTableHandle) { HiveOutputTableHandle handle = (HiveOutputTableHandle) outputTableHandle; return getLocationService() .getQueryWriteInfo(handle.getLocationHandle()) .getWritePath(); }
protected String partitionTargetPath(SchemaTableName schemaTableName, String partitionName) { try (Transaction transaction = newTransaction()) { ConnectorSession session = newSession(); SemiTransactionalHiveMetastore metastore = transaction.getMetastore(schemaTableName.getSchemaName()); LocationService locationService = getLocationService(); Table table = metastore.getTable(schemaTableName.getSchemaName(), schemaTableName.getTableName()).get(); LocationHandle handle = locationService.forExistingTable(metastore, session, table); return locationService.getPartitionWriteInfo(handle, Optional.empty(), partitionName).getTargetPath().toString(); } }
protected Path getStagingPathRoot(ConnectorInsertTableHandle insertTableHandle) { HiveInsertTableHandle handle = (HiveInsertTableHandle) insertTableHandle; WriteInfo writeInfo = getLocationService().getQueryWriteInfo(handle.getLocationHandle()); if (writeInfo.getWriteMode() != STAGE_AND_MOVE_TO_TARGET_DIRECTORY) { throw new AssertionError("writeMode is not STAGE_AND_MOVE_TO_TARGET_DIRECTORY"); } return writeInfo.getWritePath(); }
this.table = null; WriteInfo writeInfo = locationService.getQueryWriteInfo(locationHandle); checkArgument(writeInfo.getWriteMode() != DIRECT_TO_TARGET_EXISTING_DIRECTORY, "CREATE TABLE write mode cannot be DIRECT_TO_TARGET_EXISTING_DIRECTORY"); writePath = writeInfo.getWritePath(); writePath = locationService.getQueryWriteInfo(locationHandle).getWritePath();
handle.getBucketProperty(), handle.getAdditionalTableParameters(), writeInfo.getTargetPath(), false, prestoVersion); metastore.createTable(session, table, principalPrivileges, Optional.of(writeInfo.getWritePath()), false, tableStatistics);
external = false; LocationHandle locationHandle = locationService.forNewTable(metastore, session, schemaName, tableName); targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath();
LocationService locationService = getLocationService(); LocationHandle locationHandle = locationService.forNewTable(transaction.getMetastore(schemaName), session, schemaName, tableName); targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath(); Table table = createSimpleTable(schemaTableName, columns, session, targetPath, "q1"); transaction.getMetastore(schemaName)
database, tableName.getTableName(), locationService.getTableWriteInfo(((HiveOutputTableHandle) outputHandle).getLocationHandle()).getTargetPath().toString());
metastore.declareIntentionToWrite(session, writeInfo.getWriteMode(), writeInfo.getWritePath(), result.getFilePrefix(), schemaTableName);
partitionName, UpdateMode.NEW, writeInfo.getWritePath(), writeInfo.getTargetPath(), ImmutableList.of(), 0,
targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath();
metastore.declareIntentionToWrite(session, writeInfo.getWriteMode(), writeInfo.getWritePath(), result.getFilePrefix(), tableName); return result;
protected Path getTargetPathRoot(ConnectorInsertTableHandle insertTableHandle) { HiveInsertTableHandle hiveInsertTableHandle = (HiveInsertTableHandle) insertTableHandle; return getLocationService() .getQueryWriteInfo(hiveInsertTableHandle.getLocationHandle()) .getTargetPath(); }
@Override public WriteInfo getTableWriteInfo(LocationHandle locationHandle) { return new WriteInfo(locationHandle.getTargetPath(), locationHandle.getWritePath(), locationHandle.getWriteMode()); }