Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ public IcebergQueryRunner build()
}
}
else {
queryRunner.execute("CREATE SCHEMA tpch");
queryRunner.execute("CREATE SCHEMA tpcds");
queryRunner.execute("CREATE SCHEMA IF NOT EXISTS tpch");
queryRunner.execute("CREATE SCHEMA IF NOT EXISTS tpcds");
}

if (createTpchTables) {
Expand Down
17 changes: 8 additions & 9 deletions presto-native-execution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,14 @@ Run IcebergExternalWorkerQueryRunner,
* Main class: `com.facebook.presto.nativeworker.IcebergExternalWorkerQueryRunner`.
* VM options: `-ea -Xmx5G -XX:+ExitOnOutOfMemoryError -Duser.timezone=America/Bahia_Banderas -Dhive.security=legacy`.
* Working directory: `$MODULE_DIR$`
* Environment variables: `PRESTO_SERVER=/Users/<user>/git/presto/presto-native-execution/cmake-build-debug/presto_cpp/main/presto_server;DATA_DIR=/Users/<user>/Desktop/data;WORKER_COUNT=0`
* When `addStorageFormatToPath = false` **(Default)**,

`$DATA_DIR/iceberg_data/<catalog_type>`. Here `catalog_type` could be `HIVE | HADOOP | NESSIE | REST`.

`addStorageFormatToPath` is `false` by default because Java `HiveQueryRunner` and `IcebergQueryRunner` do not add the file format to the path.
* When `addStorageFormatToPath = true`,

`$DATA_DIR/iceberg_data/<file_format>/<catalog_type>`. Here `file_format` could be `PARQUET | ORC | AVRO` and `catalog_type` could be `HIVE | HADOOP | NESSIE | REST`.
* Environment variables:
- PRESTO_SERVER: Absolute path to the native worker binary. For example: `/Users/<user>/git/presto/presto-native-execution/cmake-build-debug/presto_cpp/main/presto_server`
- DATA_DIR: Base data directory for test data and catalog warehouses. For example: `/Users/<user>/Desktop/data`
- WORKER_COUNT: Number of native workers to launch (default: 4)
- CATALOG_TYPE: Iceberg catalog type to use. One of `HADOOP | HIVE` (default: `HIVE`)

Example:
`PRESTO_SERVER=/Users/<user>/git/presto/presto-native-execution/cmake-build-debug/presto_cpp/main/presto_server;DATA_DIR=/Users/<user>/Desktop/data;WORKER_COUNT=1;CATALOG_TYPE=HIVE`
* Use classpath of module: choose `presto-native-execution` module.

Run NativeSidecarPluginQueryRunner:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.facebook.presto.hive.metastore.Storage;
import com.facebook.presto.hive.metastore.StorageFormat;
import com.facebook.presto.hive.metastore.Table;
import com.facebook.presto.iceberg.CatalogType;
import com.facebook.presto.iceberg.FileFormat;
import com.facebook.presto.iceberg.IcebergQueryRunner;
import com.facebook.presto.spi.PrestoException;
Expand All @@ -44,6 +45,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -309,6 +311,10 @@ public static class IcebergQueryRunnerBuilder
private Path dataDirectory = nativeQueryRunnerParameters.dataDirectory;
private String serverBinary = nativeQueryRunnerParameters.serverBinary.toString();
private Integer workerCount = nativeQueryRunnerParameters.workerCount.orElse(4);
private CatalogType catalogType = Optional
.ofNullable(nativeQueryRunnerParameters.runnerParameters.get("iceberg.catalog.type"))
.map(v -> CatalogType.valueOf(v.toUpperCase()))
.orElse(CatalogType.HIVE);
private Integer cacheMaxSize = 0;
private String storageFormat = ICEBERG_DEFAULT_STORAGE_FORMAT;
private Map<String, String> extraProperties = new HashMap<>();
Expand Down Expand Up @@ -379,6 +385,7 @@ public QueryRunner build()
.setAddStorageFormatToPath(addStorageFormatToPath)
.setDataDirectory(Optional.of(dataDirectory))
.setTpcdsProperties(getNativeWorkerTpcdsProperties())
.setCatalogType(catalogType)
.build().getQueryRunner();
}
}
Expand Down Expand Up @@ -452,7 +459,13 @@ public static NativeQueryRunnerParameters getNativeQueryRunnerParameters()
assertTrue(Files.exists(dataDirectory), format("Data directory at %s is missing. Add -DDATA_DIR=<path/to/data> to your JVM arguments to specify the path", dataDirectory));
log.info("using DATA_DIR at %s", dataDirectory);

return new NativeQueryRunnerParameters(prestoServerPath, dataDirectory, workerCount);
Map<String, String> runnerParams = new HashMap<>();
getProperty("CATALOG_TYPE").ifPresent(v -> {
runnerParams.put("iceberg.catalog.type", v.toUpperCase());
log.info("using CATALOG_TYPE %s", v.toUpperCase());
});

return new NativeQueryRunnerParameters(prestoServerPath, dataDirectory, workerCount, runnerParams);
}

public static Optional<BiFunction<Integer, URI, Process>> getExternalWorkerLauncher(
Expand Down Expand Up @@ -569,12 +582,14 @@ public static class NativeQueryRunnerParameters
public final Path serverBinary;
public final Path dataDirectory;
public final Optional<Integer> workerCount;
public final Map<String, String> runnerParameters;

public NativeQueryRunnerParameters(Path serverBinary, Path dataDirectory, Optional<Integer> workerCount)
public NativeQueryRunnerParameters(Path serverBinary, Path dataDirectory, Optional<Integer> workerCount, Map<String, String> runnerParameters)
{
this.serverBinary = requireNonNull(serverBinary, "serverBinary is null");
this.dataDirectory = requireNonNull(dataDirectory, "dataDirectory is null");
this.workerCount = requireNonNull(workerCount, "workerCount is null");
this.runnerParameters = Collections.unmodifiableMap(new HashMap<>(requireNonNull(runnerParameters, "runnerParameters is null")));
}
}

Expand Down
Loading