From 5df200319a03778b1bd9959d7b06555458a0573e Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Mon, 18 Aug 2025 10:47:43 -0600 Subject: [PATCH 01/11] Add executionType to server info, add to tests --- .../facebook/presto/client/ExecutionType.java | 57 +++++++++++++++++++ .../facebook/presto/client/ServerInfo.java | 18 +++++- .../presto/client/TestServerInfo.java | 8 +-- .../presto/server/ServerInfoResource.java | 10 +++- presto-native-execution/velox | 2 +- 5 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 presto-client/src/main/java/com/facebook/presto/client/ExecutionType.java diff --git a/presto-client/src/main/java/com/facebook/presto/client/ExecutionType.java b/presto-client/src/main/java/com/facebook/presto/client/ExecutionType.java new file mode 100644 index 0000000000000..487b6eedc8260 --- /dev/null +++ b/presto-client/src/main/java/com/facebook/presto/client/ExecutionType.java @@ -0,0 +1,57 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.facebook.presto.client; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +import static java.util.Objects.requireNonNull; + +public enum ExecutionType +{ + JAVA("java"), + NATIVE("native"), + NATIVE_GPU("native-gpu"); + + private final String value; + + ExecutionType(String value) + { + this.value = requireNonNull(value, "value is null"); + } + + @JsonValue + public String getValue() + { + return value; + } + + @JsonCreator + public static ExecutionType fromValue(String value) + { + requireNonNull(value, "value is null"); + for (ExecutionType executionType : ExecutionType.values()) { + if (executionType.getValue().equals(value)) { + return executionType; + } + } + throw new IllegalArgumentException("Unknown execution type: " + value); + } + + @Override + public String toString() + { + return value; + } +} diff --git a/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java b/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java index 6de636a82404e..13cb63a52e05a 100644 --- a/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java +++ b/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java @@ -38,6 +38,7 @@ public class ServerInfo // optional to maintain compatibility with older servers private final Optional uptime; + private final Optional executionType; @ThriftConstructor @JsonCreator @@ -46,13 +47,15 @@ public ServerInfo( @JsonProperty("environment") String environment, @JsonProperty("coordinator") boolean coordinator, @JsonProperty("starting") boolean starting, - @JsonProperty("uptime") Optional uptime) + @JsonProperty("uptime") Optional uptime, + @JsonProperty("executionType") Optional executionType) { this.nodeVersion = requireNonNull(nodeVersion, "nodeVersion is null"); this.environment = requireNonNull(environment, "environment is null"); this.coordinator = coordinator; this.starting = starting; this.uptime = requireNonNull(uptime, "uptime is null"); + this.executionType = executionType; } @ThriftField(1) @@ -90,6 +93,13 @@ public Optional getUptime() return uptime; } + @ThriftField(6) + @JsonProperty + public Optional getExecutionType() + { + return executionType; + } + @Override public boolean equals(Object o) { @@ -102,13 +112,14 @@ public boolean equals(Object o) ServerInfo that = (ServerInfo) o; return Objects.equals(nodeVersion, that.nodeVersion) && - Objects.equals(environment, that.environment); + Objects.equals(environment, that.environment) && + Objects.equals(executionType, that.executionType); } @Override public int hashCode() { - return Objects.hash(nodeVersion, environment); + return Objects.hash(nodeVersion, environment, executionType); } @Override @@ -118,6 +129,7 @@ public String toString() .add("nodeVersion", nodeVersion) .add("environment", environment) .add("coordinator", coordinator) + .add("executionType", executionType.map(ExecutionType::toString).orElse(null)) .add("uptime", uptime.orElse(null)) .omitNullValues() .toString(); diff --git a/presto-client/src/test/java/com/facebook/presto/client/TestServerInfo.java b/presto-client/src/test/java/com/facebook/presto/client/TestServerInfo.java index ba9ab0df881e1..aa14995445b1e 100644 --- a/presto-client/src/test/java/com/facebook/presto/client/TestServerInfo.java +++ b/presto-client/src/test/java/com/facebook/presto/client/TestServerInfo.java @@ -67,14 +67,14 @@ public Object[][] codecCombinations() @Test public void testJsonRoundTrip() { - assertJsonRoundTrip(new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m")))); - assertJsonRoundTrip(new ServerInfo(UNKNOWN, "test", true, false, Optional.empty())); + assertJsonRoundTrip(new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m")), Optional.of(ExecutionType.JAVA))); + assertJsonRoundTrip(new ServerInfo(UNKNOWN, "test", true, false, Optional.empty(), Optional.empty())); } @Test public void testBackwardsCompatible() { - ServerInfo newServerInfo = new ServerInfo(UNKNOWN, "test", true, false, Optional.empty()); + ServerInfo newServerInfo = new ServerInfo(UNKNOWN, "test", true, false, Optional.empty(), Optional.empty()); ServerInfo legacyServerInfo = SERVER_INFO_CODEC.fromJson("{\"nodeVersion\":{\"version\":\"\"},\"environment\":\"test\",\"coordinator\":true}"); assertEquals(newServerInfo, legacyServerInfo); } @@ -108,7 +108,7 @@ public void testRoundTripSerializeFacebookCompactProtocol(ThriftCodec readCodec, ThriftCodec writeCodec, diff --git a/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java b/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java index 8c686288caef8..11cc4f3a41ee5 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java +++ b/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java @@ -14,11 +14,13 @@ package com.facebook.presto.server; import com.facebook.airlift.node.NodeInfo; +import com.facebook.presto.client.ExecutionType; import com.facebook.presto.client.NodeVersion; import com.facebook.presto.client.ServerInfo; import com.facebook.presto.execution.resourceGroups.ResourceGroupManager; import com.facebook.presto.metadata.StaticCatalogStore; import com.facebook.presto.spi.NodeState; +import com.facebook.presto.sql.analyzer.FeaturesConfig; import com.facebook.presto.spi.NodeStats; import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Inject; @@ -58,10 +60,11 @@ public class ServerInfoResource private final long startTime = System.nanoTime(); private final NodeResourceStatusProvider nodeResourceStatusProvider; private final ResourceGroupManager resourceGroupManager; + private final FeaturesConfig featuresConfig; private NodeState nodeState = ACTIVE; @Inject - public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConfig serverConfig, StaticCatalogStore catalogStore, GracefulShutdownHandler shutdownHandler, NodeResourceStatusProvider nodeResourceStatusProvider, ResourceGroupManager resourceGroupManager) + public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConfig serverConfig, StaticCatalogStore catalogStore, GracefulShutdownHandler shutdownHandler, NodeResourceStatusProvider nodeResourceStatusProvider, ResourceGroupManager resourceGroupManager, FeaturesConfig featuresConfig) { this.version = requireNonNull(nodeVersion, "nodeVersion is null"); this.environment = requireNonNull(nodeInfo, "nodeInfo is null").getEnvironment(); @@ -71,6 +74,7 @@ public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConf this.shutdownHandler = requireNonNull(shutdownHandler, "shutdownHandler is null"); this.nodeResourceStatusProvider = requireNonNull(nodeResourceStatusProvider, "nodeResourceStatusProvider is null"); this.resourceGroupManager = requireNonNull(resourceGroupManager, "resourceGroupManager is null"); + this.featuresConfig = requireNonNull(featuresConfig, "featuresConfig is null"); } @GET @@ -78,7 +82,9 @@ public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConf public ServerInfo getInfo() { boolean starting = resourceManager ? true : !catalogStore.areCatalogsLoaded(); - return new ServerInfo(version, environment, coordinator, starting, Optional.of(nanosSince(startTime))); + Optional executionType = featuresConfig.isNativeExecutionEnabled() ? + Optional.of(ExecutionType.NATIVE) : Optional.of(ExecutionType.JAVA); + return new ServerInfo(version, environment, coordinator, starting, Optional.of(nanosSince(startTime)), executionType); } @PUT diff --git a/presto-native-execution/velox b/presto-native-execution/velox index 904378eb6349c..ccd765d3d9e70 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit 904378eb6349c2665f3aa324dd6cd5a13840baed +Subproject commit ccd765d3d9e70ddc4cb222b00433b0922915b6cc From 7c061af3d755b3c6e2563b546b18566621017a5c Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Wed, 20 Aug 2025 22:25:40 -0600 Subject: [PATCH 02/11] Update cpp server to include execution type --- .../presto/jdbc/TestQueryExecutor.java | 3 +- .../presto_cpp/main/PrestoServer.cpp | 10 +- .../presto_protocol_arrow_flight.json | 128 ++++++++++++++ .../connector/hive/presto_protocol_hive.cpp | 20 ++- .../iceberg/presto_protocol_iceberg.cpp | 11 +- .../core/presto_protocol_core.cpp | 156 ++++++++++++++---- .../core/presto_protocol_core.h | 34 ++++ .../core/special/ExecutionType.cpp.inc | 55 ++++++ .../core/special/ExecutionType.hpp.inc | 19 +++ .../core/special/ServerInfo.cpp.inc | 52 ++++++ .../core/special/ServerInfo.hpp.inc | 26 +++ .../router/cluster/ClusterStatusResource.java | 3 +- 12 files changed, 467 insertions(+), 50 deletions(-) create mode 100644 presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json create mode 100644 presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc create mode 100644 presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc create mode 100644 presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc create mode 100644 presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc diff --git a/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestQueryExecutor.java b/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestQueryExecutor.java index c3b37334781a7..2dc7c4a6365e8 100644 --- a/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestQueryExecutor.java +++ b/presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestQueryExecutor.java @@ -15,6 +15,7 @@ import com.facebook.airlift.json.JsonCodec; import com.facebook.airlift.units.Duration; +import com.facebook.presto.client.ExecutionType; import com.facebook.presto.client.ServerInfo; import okhttp3.OkHttpClient; import okhttp3.mockwebserver.MockResponse; @@ -57,7 +58,7 @@ public void teardown() public void testGetServerInfo() throws Exception { - ServerInfo expected = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m"))); + ServerInfo expected = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m")), Optional.of(ExecutionType.JAVA)); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index 80b3531ceb05b..b5f3dec66ce0f 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -1617,12 +1617,20 @@ void PrestoServer::reportMemoryInfo(proxygen::ResponseHandler* downstream) { } void PrestoServer::reportServerInfo(proxygen::ResponseHandler* downstream) { + // Determine execution type based on GPU support +#ifdef VELOX_ENABLE_GPU + auto executionType = std::make_shared(protocol::ExecutionType::NATIVE_CUDF); +#else + auto executionType = std::make_shared(protocol::ExecutionType::NATIVE); +#endif + const protocol::ServerInfo serverInfo{ {nodeVersion_}, environment_, false, false, - std::make_shared(getUptime(start_))}; + std::make_shared(getUptime(start_)), + executionType}; http::sendOkResponse(downstream, json(serverInfo)); } diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json b/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json new file mode 100644 index 0000000000000..0b6ddc1d947ca --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json @@ -0,0 +1,128 @@ +[ + { + "comment": "// This file is generated DO NOT EDIT @generated" + }, + { + "class_name": "ArrowColumnHandle", + "struct": true, + "fields": [ + { + "field_type": "String", + "field_name": "columnName", + "field_text": "String", + "_N": 1, + "field_local": true + }, + { + "field_type": "Type", + "field_name": "columnType", + "field_text": "Type", + "_N": 2, + "field_local": true + } + ], + "subclass": true, + "super_class": "ColumnHandle", + "json_key": "arrow-flight" + }, + { + "class_name": "ArrowSplit", + "struct": true, + "fields": [ + { + "field_type": "String", + "field_name": "schemaName", + "field_text": "String", + "_N": 1, + "field_local": true + }, + { + "field_type": "String", + "field_name": "tableName", + "field_text": "String", + "_N": 2, + "field_local": true + }, + { + "field_type": "byte[]", + "field_name": "flightEndpointBytes", + "field_text": "String", + "_N": 3, + "field_local": true + } + ], + "subclass": true, + "super_class": "ConnectorSplit", + "json_key": "arrow-flight" + }, + { + "class_name": "ArrowTableHandle", + "struct": true, + "fields": [ + { + "field_type": "String", + "field_name": "schema", + "field_text": "String", + "_N": 1, + "field_local": true + }, + { + "field_type": "String", + "field_name": "table", + "field_text": "String", + "_N": 2, + "field_local": true + } + ], + "subclass": true, + "super_class": "ConnectorTableHandle", + "json_key": "arrow-flight" + }, + { + "class_name": "ColumnHandle", + "field_name": "columnHandle", + "abstract": true, + "super_class": "JsonEncodedSubclass", + "comparable": true, + "subclasses": [ + { + "type": "ArrowColumnHandle", + "name": "arrowColumnHandle", + "key": "arrow-flight", + "_N": 1, + "_last": true + } + ], + "fields": [] + }, + { + "class_name": "ArrowTableLayoutHandle", + "struct": true, + "fields": [ + { + "field_type": "ArrowTableHandle", + "field_name": "table", + "field_text": "ArrowTableHandle", + "_N": 1, + "field_local": true + }, + { + "field_type": "List", + "field_name": "columnHandles", + "field_text": "List", + "_N": 2, + "field_local": true + }, + { + "field_type": "TupleDomain", + "field_name": "tupleDomain", + "field_text": "TupleDomain>", + "_N": 3, + "field_local": true + } + ], + "subclass": true, + "super_class": "ConnectorTableLayoutHandle", + "json_key": "arrow-flight" + } +] diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp b/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp index 8011da82eee47..24e90b78e2e8c 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp @@ -370,9 +370,10 @@ namespace facebook::presto::protocol::hive { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - BucketFunctionType_enum_table[] = { // NOLINT: cert-err58-cpp - {BucketFunctionType::HIVE_COMPATIBLE, "HIVE_COMPATIBLE"}, - {BucketFunctionType::PRESTO_NATIVE, "PRESTO_NATIVE"}}; + BucketFunctionType_enum_table[] = + { // NOLINT: cert-err58-cpp + {BucketFunctionType::HIVE_COMPATIBLE, "HIVE_COMPATIBLE"}, + {BucketFunctionType::PRESTO_NATIVE, "PRESTO_NATIVE"}}; void to_json(json& j, const BucketFunctionType& e) { static_assert( std::is_enum::value, @@ -598,12 +599,13 @@ namespace facebook::presto::protocol::hive { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - HiveCompressionCodec_enum_table[] = { // NOLINT: cert-err58-cpp - {HiveCompressionCodec::NONE, "NONE"}, - {HiveCompressionCodec::SNAPPY, "SNAPPY"}, - {HiveCompressionCodec::GZIP, "GZIP"}, - {HiveCompressionCodec::LZ4, "LZ4"}, - {HiveCompressionCodec::ZSTD, "ZSTD"}}; + HiveCompressionCodec_enum_table[] = + { // NOLINT: cert-err58-cpp + {HiveCompressionCodec::NONE, "NONE"}, + {HiveCompressionCodec::SNAPPY, "SNAPPY"}, + {HiveCompressionCodec::GZIP, "GZIP"}, + {HiveCompressionCodec::LZ4, "LZ4"}, + {HiveCompressionCodec::ZSTD, "ZSTD"}}; void to_json(json& j, const HiveCompressionCodec& e) { static_assert( std::is_enum::value, diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp b/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp index 3229da2e88d07..1af077191a2a8 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp @@ -25,11 +25,12 @@ namespace facebook::presto::protocol::iceberg { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - ChangelogOperation_enum_table[] = { // NOLINT: cert-err58-cpp - {ChangelogOperation::INSERT, "INSERT"}, - {ChangelogOperation::DELETE, "DELETE"}, - {ChangelogOperation::UPDATE_BEFORE, "UPDATE_BEFORE"}, - {ChangelogOperation::UPDATE_AFTER, "UPDATE_AFTER"}}; + ChangelogOperation_enum_table[] = + { // NOLINT: cert-err58-cpp + {ChangelogOperation::INSERT, "INSERT"}, + {ChangelogOperation::DELETE, "DELETE"}, + {ChangelogOperation::UPDATE_BEFORE, "UPDATE_BEFORE"}, + {ChangelogOperation::UPDATE_AFTER, "UPDATE_AFTER"}}; void to_json(json& j, const ChangelogOperation& e) { static_assert( std::is_enum::value, diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp index 50d7de6024075..b5730508fb2a7 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp @@ -36,10 +36,11 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - NodeSelectionStrategy_enum_table[] = { // NOLINT: cert-err58-cpp - {NodeSelectionStrategy::HARD_AFFINITY, "HARD_AFFINITY"}, - {NodeSelectionStrategy::SOFT_AFFINITY, "SOFT_AFFINITY"}, - {NodeSelectionStrategy::NO_PREFERENCE, "NO_PREFERENCE"}}; + NodeSelectionStrategy_enum_table[] = + { // NOLINT: cert-err58-cpp + {NodeSelectionStrategy::HARD_AFFINITY, "HARD_AFFINITY"}, + {NodeSelectionStrategy::SOFT_AFFINITY, "SOFT_AFFINITY"}, + {NodeSelectionStrategy::NO_PREFERENCE, "NO_PREFERENCE"}}; void to_json(json& j, const NodeSelectionStrategy& e) { static_assert( std::is_enum::value, @@ -558,11 +559,12 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - AggregationNodeStep_enum_table[] = { // NOLINT: cert-err58-cpp - {AggregationNodeStep::PARTIAL, "PARTIAL"}, - {AggregationNodeStep::FINAL, "FINAL"}, - {AggregationNodeStep::INTERMEDIATE, "INTERMEDIATE"}, - {AggregationNodeStep::SINGLE, "SINGLE"}}; + AggregationNodeStep_enum_table[] = + { // NOLINT: cert-err58-cpp + {AggregationNodeStep::PARTIAL, "PARTIAL"}, + {AggregationNodeStep::FINAL, "FINAL"}, + {AggregationNodeStep::INTERMEDIATE, "INTERMEDIATE"}, + {AggregationNodeStep::SINGLE, "SINGLE"}}; void to_json(json& j, const AggregationNodeStep& e) { static_assert( std::is_enum::value, @@ -6144,9 +6146,10 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - JoinDistributionType_enum_table[] = { // NOLINT: cert-err58-cpp - {JoinDistributionType::PARTITIONED, "PARTITIONED"}, - {JoinDistributionType::REPLICATED, "REPLICATED"}}; + JoinDistributionType_enum_table[] = + { // NOLINT: cert-err58-cpp + {JoinDistributionType::PARTITIONED, "PARTITIONED"}, + {JoinDistributionType::REPLICATED, "REPLICATED"}}; void to_json(json& j, const JoinDistributionType& e) { static_assert( std::is_enum::value, @@ -8211,14 +8214,17 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - StageExecutionStrategy_enum_table[] = { // NOLINT: cert-err58-cpp - {StageExecutionStrategy::UNGROUPED_EXECUTION, "UNGROUPED_EXECUTION"}, - {StageExecutionStrategy::FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, - "FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, - {StageExecutionStrategy::DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, - "DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, - {StageExecutionStrategy::RECOVERABLE_GROUPED_EXECUTION, - "RECOVERABLE_GROUPED_EXECUTION"}}; + StageExecutionStrategy_enum_table[] = + { // NOLINT: cert-err58-cpp + {StageExecutionStrategy::UNGROUPED_EXECUTION, + "UNGROUPED_EXECUTION"}, + {StageExecutionStrategy::FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, + "FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, + {StageExecutionStrategy:: + DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, + "DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, + {StageExecutionStrategy::RECOVERABLE_GROUPED_EXECUTION, + "RECOVERABLE_GROUPED_EXECUTION"}}; void to_json(json& j, const StageExecutionStrategy& e) { static_assert( std::is_enum::value, @@ -9391,6 +9397,73 @@ void from_json(const json& j, SemiJoinNode& p) { "dynamicFilters"); } } // namespace facebook::presto::protocol +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace facebook::presto::protocol { + +static const std::pair ExecutionType_enum_table[] = + { // NOLINT: cert-err58-cpp + {ExecutionType::JAVA, "JAVA"}, + {ExecutionType::NATIVE, "NATIVE"}, + {ExecutionType::NATIVE_CUDF, "NATIVE_CUDF"}}; + +void to_json(json& j, const ExecutionType& e) { + static_assert( + std::is_enum::value, "ExecutionType must be an enum!"); + const auto* it = std::find_if( + std::begin(ExecutionType_enum_table), + std::end(ExecutionType_enum_table), + [e](const std::pair& ej_pair) -> bool { + return ej_pair.first == e; + }); + j = ((it != std::end(ExecutionType_enum_table)) + ? it + : std::begin(ExecutionType_enum_table)) + ->second; +} + +void from_json(const json& j, ExecutionType& e) { + static_assert( + std::is_enum::value, "ExecutionType must be an enum!"); + const auto* it = std::find_if( + std::begin(ExecutionType_enum_table), + std::end(ExecutionType_enum_table), + [&j](const std::pair& ej_pair) -> bool { + return ej_pair.second == j; + }); + e = ((it != std::end(ExecutionType_enum_table)) + ? it + : std::begin(ExecutionType_enum_table)) + ->first; +} + +} // namespace facebook::presto::protocol +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + namespace facebook::presto::protocol { void to_json(json& j, const ServerInfo& p) { @@ -9408,6 +9481,13 @@ void to_json(json& j, const ServerInfo& p) { j, "coordinator", p.coordinator, "ServerInfo", "bool", "coordinator"); to_json_key(j, "starting", p.starting, "ServerInfo", "bool", "starting"); to_json_key(j, "uptime", p.uptime, "ServerInfo", "Duration", "uptime"); + to_json_key( + j, + "executionType", + p.executionType, + "ServerInfo", + "ExecutionType", + "executionType"); } void from_json(const json& j, ServerInfo& p) { @@ -9424,7 +9504,15 @@ void from_json(const json& j, ServerInfo& p) { j, "coordinator", p.coordinator, "ServerInfo", "bool", "coordinator"); from_json_key(j, "starting", p.starting, "ServerInfo", "bool", "starting"); from_json_key(j, "uptime", p.uptime, "ServerInfo", "Duration", "uptime"); + from_json_key( + j, + "executionType", + p.executionType, + "ServerInfo", + "ExecutionType", + "executionType"); } + } // namespace facebook::presto::protocol namespace facebook::presto::protocol { @@ -9888,12 +9976,13 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - SystemPartitionFunction_enum_table[] = { // NOLINT: cert-err58-cpp - {SystemPartitionFunction::SINGLE, "SINGLE"}, - {SystemPartitionFunction::HASH, "HASH"}, - {SystemPartitionFunction::ROUND_ROBIN, "ROUND_ROBIN"}, - {SystemPartitionFunction::BROADCAST, "BROADCAST"}, - {SystemPartitionFunction::UNKNOWN, "UNKNOWN"}}; + SystemPartitionFunction_enum_table[] = + { // NOLINT: cert-err58-cpp + {SystemPartitionFunction::SINGLE, "SINGLE"}, + {SystemPartitionFunction::HASH, "HASH"}, + {SystemPartitionFunction::ROUND_ROBIN, "ROUND_ROBIN"}, + {SystemPartitionFunction::BROADCAST, "BROADCAST"}, + {SystemPartitionFunction::UNKNOWN, "UNKNOWN"}}; void to_json(json& j, const SystemPartitionFunction& e) { static_assert( std::is_enum::value, @@ -9930,13 +10019,14 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - SystemPartitioning_enum_table[] = { // NOLINT: cert-err58-cpp - {SystemPartitioning::SINGLE, "SINGLE"}, - {SystemPartitioning::FIXED, "FIXED"}, - {SystemPartitioning::SOURCE, "SOURCE"}, - {SystemPartitioning::SCALED, "SCALED"}, - {SystemPartitioning::COORDINATOR_ONLY, "COORDINATOR_ONLY"}, - {SystemPartitioning::ARBITRARY, "ARBITRARY"}}; + SystemPartitioning_enum_table[] = + { // NOLINT: cert-err58-cpp + {SystemPartitioning::SINGLE, "SINGLE"}, + {SystemPartitioning::FIXED, "FIXED"}, + {SystemPartitioning::SOURCE, "SOURCE"}, + {SystemPartitioning::SCALED, "SCALED"}, + {SystemPartitioning::COORDINATOR_ONLY, "COORDINATOR_ONLY"}, + {SystemPartitioning::ARBITRARY, "ARBITRARY"}}; void to_json(json& j, const SystemPartitioning& e) { static_assert( std::is_enum::value, diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h index dae1c63b907d5..c16cadb53eb5c 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h @@ -2154,6 +2154,39 @@ struct SemiJoinNode : public PlanNode { void to_json(json& j, const SemiJoinNode& p); void from_json(const json& j, SemiJoinNode& p); } // namespace facebook::presto::protocol +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace facebook::presto::protocol { +enum class ExecutionType { JAVA, NATIVE, NATIVE_CUDF }; +extern void to_json(json& j, const ExecutionType& e); +extern void from_json(const json& j, ExecutionType& e); +} // namespace facebook::presto::protocol +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + namespace facebook::presto::protocol { struct ServerInfo { NodeVersion nodeVersion = {}; @@ -2161,6 +2194,7 @@ struct ServerInfo { bool coordinator = {}; bool starting = {}; std::shared_ptr uptime = {}; + std::shared_ptr executionType = {}; }; void to_json(json& j, const ServerInfo& p); void from_json(const json& j, ServerInfo& p); diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc new file mode 100644 index 0000000000000..8d397ff18df1a --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc @@ -0,0 +1,55 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace facebook::presto::protocol { + +static const std::pair + ExecutionType_enum_table[] = { // NOLINT: cert-err58-cpp + {ExecutionType::JAVA, "JAVA"}, + {ExecutionType::NATIVE, "NATIVE"}, + {ExecutionType::NATIVE_CUDF, "NATIVE_CUDF"}}; + +void to_json(json& j, const ExecutionType& e) { + static_assert( + std::is_enum::value, + "ExecutionType must be an enum!"); + const auto* it = std::find_if( + std::begin(ExecutionType_enum_table), + std::end(ExecutionType_enum_table), + [e](const std::pair& ej_pair) -> bool { + return ej_pair.first == e; + }); + j = ((it != std::end(ExecutionType_enum_table)) + ? it + : std::begin(ExecutionType_enum_table)) + ->second; +} + +void from_json(const json& j, ExecutionType& e) { + static_assert( + std::is_enum::value, + "ExecutionType must be an enum!"); + const auto* it = std::find_if( + std::begin(ExecutionType_enum_table), + std::end(ExecutionType_enum_table), + [&j](const std::pair& ej_pair) -> bool { + return ej_pair.second == j; + }); + e = ((it != std::end(ExecutionType_enum_table)) + ? it + : std::begin(ExecutionType_enum_table)) + ->first; +} + +} // namespace facebook::presto::protocol diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc new file mode 100644 index 0000000000000..6cba58eab9cc1 --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc @@ -0,0 +1,19 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace facebook::presto::protocol { +enum class ExecutionType { JAVA, NATIVE, NATIVE_CUDF }; +extern void to_json(json& j, const ExecutionType& e); +extern void from_json(const json& j, ExecutionType& e); +} // namespace facebook::presto::protocol diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc new file mode 100644 index 0000000000000..d41f37ebbcea1 --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc @@ -0,0 +1,52 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace facebook::presto::protocol { + +void to_json(json& j, const ServerInfo& p) { + j = json::object(); + to_json_key( + j, + "nodeVersion", + p.nodeVersion, + "ServerInfo", + "NodeVersion", + "nodeVersion"); + to_json_key( + j, "environment", p.environment, "ServerInfo", "String", "environment"); + to_json_key( + j, "coordinator", p.coordinator, "ServerInfo", "bool", "coordinator"); + to_json_key(j, "starting", p.starting, "ServerInfo", "bool", "starting"); + to_json_key(j, "uptime", p.uptime, "ServerInfo", "Duration", "uptime"); + to_json_key(j, "executionType", p.executionType, "ServerInfo", "ExecutionType", "executionType"); +} + +void from_json(const json& j, ServerInfo& p) { + from_json_key( + j, + "nodeVersion", + p.nodeVersion, + "ServerInfo", + "NodeVersion", + "nodeVersion"); + from_json_key( + j, "environment", p.environment, "ServerInfo", "String", "environment"); + from_json_key( + j, "coordinator", p.coordinator, "ServerInfo", "bool", "coordinator"); + from_json_key(j, "starting", p.starting, "ServerInfo", "bool", "starting"); + from_json_key(j, "uptime", p.uptime, "ServerInfo", "Duration", "uptime"); + from_json_key(j, "executionType", p.executionType, "ServerInfo", "ExecutionType", "executionType"); +} + +} // namespace facebook::presto::protocol diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc new file mode 100644 index 0000000000000..35c2891be170e --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc @@ -0,0 +1,26 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace facebook::presto::protocol { +struct ServerInfo { + NodeVersion nodeVersion = {}; + String environment = {}; + bool coordinator = {}; + bool starting = {}; + std::shared_ptr uptime = {}; + std::shared_ptr executionType = {}; +}; +void to_json(json& j, const ServerInfo& p); +void from_json(const json& j, ServerInfo& p); +} // namespace facebook::presto::protocol diff --git a/presto-router/src/main/java/com/facebook/presto/router/cluster/ClusterStatusResource.java b/presto-router/src/main/java/com/facebook/presto/router/cluster/ClusterStatusResource.java index 2a44d1d75cac0..0527ef917c1b0 100755 --- a/presto-router/src/main/java/com/facebook/presto/router/cluster/ClusterStatusResource.java +++ b/presto-router/src/main/java/com/facebook/presto/router/cluster/ClusterStatusResource.java @@ -14,6 +14,7 @@ package com.facebook.presto.router.cluster; import com.facebook.airlift.node.NodeInfo; +import com.facebook.presto.client.ExecutionType; import com.facebook.presto.client.ServerInfo; import com.facebook.presto.router.cluster.ClusterManager.ClusterStatusTracker; import com.fasterxml.jackson.annotation.JsonCreator; @@ -55,7 +56,7 @@ public ClusterStatusResource(NodeInfo nodeInfo, ClusterStatusTracker clusterStat @Produces(APPLICATION_JSON) public ServerInfo getInfo() { - return new ServerInfo(UNKNOWN, environment, true, false, Optional.empty()); + return new ServerInfo(UNKNOWN, environment, true, false, Optional.empty(), Optional.of(ExecutionType.JAVA)); } @GET From c005580260aff2541e60b71d6802d18d1013b72f Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Thu, 21 Aug 2025 21:56:35 -0600 Subject: [PATCH 03/11] Fix deps from bad merge, fix additional test that use ServerInfo --- .../presto_protocol/core/presto_protocol_core.cpp | 6 +++--- .../presto_protocol/core/special/ExecutionType.cpp.inc | 6 +++--- .../spark/execution/http/TestPrestoSparkHttpClient.java | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp index b5730508fb2a7..50f5986ca2b21 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp @@ -9415,9 +9415,9 @@ namespace facebook::presto::protocol { static const std::pair ExecutionType_enum_table[] = { // NOLINT: cert-err58-cpp - {ExecutionType::JAVA, "JAVA"}, - {ExecutionType::NATIVE, "NATIVE"}, - {ExecutionType::NATIVE_CUDF, "NATIVE_CUDF"}}; + {ExecutionType::JAVA, "java"}, + {ExecutionType::NATIVE, "native"}, + {ExecutionType::NATIVE_CUDF, "native_cudf"}}; void to_json(json& j, const ExecutionType& e) { static_assert( diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc index 8d397ff18df1a..0341777a2ab6d 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc @@ -16,9 +16,9 @@ namespace facebook::presto::protocol { static const std::pair ExecutionType_enum_table[] = { // NOLINT: cert-err58-cpp - {ExecutionType::JAVA, "JAVA"}, - {ExecutionType::NATIVE, "NATIVE"}, - {ExecutionType::NATIVE_CUDF, "NATIVE_CUDF"}}; + {ExecutionType::JAVA, "java"}, + {ExecutionType::NATIVE, "native"}, + {ExecutionType::NATIVE_CUDF, "native_cudf"}}; void to_json(json& j, const ExecutionType& e) { static_assert( diff --git a/presto-spark-base/src/test/java/com/facebook/presto/spark/execution/http/TestPrestoSparkHttpClient.java b/presto-spark-base/src/test/java/com/facebook/presto/spark/execution/http/TestPrestoSparkHttpClient.java index 012af7ed13418..57670b9cc1cde 100644 --- a/presto-spark-base/src/test/java/com/facebook/presto/spark/execution/http/TestPrestoSparkHttpClient.java +++ b/presto-spark-base/src/test/java/com/facebook/presto/spark/execution/http/TestPrestoSparkHttpClient.java @@ -16,6 +16,7 @@ import com.facebook.airlift.json.JsonCodec; import com.facebook.airlift.units.DataSize; import com.facebook.airlift.units.Duration; +import com.facebook.presto.client.ExecutionType; import com.facebook.presto.client.ServerInfo; import com.facebook.presto.execution.QueryManagerConfig; import com.facebook.presto.execution.TaskId; @@ -304,7 +305,7 @@ public void testUpdateTaskWithRetries() public void testGetServerInfo() { TaskId taskId = new TaskId("testid", 0, 0, 0, 0); - ServerInfo expected = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m"))); + ServerInfo expected = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m")), Optional.of(ExecutionType.JAVA)); PrestoSparkHttpServerClient workerClient = new PrestoSparkHttpServerClient( new TestingOkHttpClient(scheduledExecutorService, new TestingResponseManager(taskId.toString())), @@ -325,7 +326,7 @@ public void testGetServerInfo() public void testGetServerInfoWithRetry() { TaskId taskId = new TaskId("testid", 0, 0, 0, 0); - ServerInfo expected = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m"))); + ServerInfo expected = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m")), Optional.of(ExecutionType.JAVA)); Duration maxTimeout = new Duration(1, TimeUnit.MINUTES); NativeExecutionProcess process = createNativeExecutionProcess( maxTimeout, @@ -1171,7 +1172,7 @@ public static class TestingServerResponseManager public Response createServerInfoResponse(Request request) throws PrestoException { - ServerInfo serverInfo = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m"))); + ServerInfo serverInfo = new ServerInfo(UNKNOWN, "test", true, false, Optional.of(Duration.valueOf("2m")), Optional.of(ExecutionType.JAVA)); byte[] responseBody = serverInfoCodec.toBytes(serverInfo); return new Response.Builder() From b8bb0c888739f337a5e7f80df9b2ee6aeb2286f9 Mon Sep 17 00:00:00 2001 From: Joe O'Hallaron Date: Tue, 26 Aug 2025 09:32:20 -0600 Subject: [PATCH 04/11] Use PRESTO flag instead of VELOX flag --- presto-native-execution/presto_cpp/main/PrestoServer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index b5f3dec66ce0f..170ee8c8f9788 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -1617,8 +1617,9 @@ void PrestoServer::reportMemoryInfo(proxygen::ResponseHandler* downstream) { } void PrestoServer::reportServerInfo(proxygen::ResponseHandler* downstream) { + // Determine execution type based on GPU support -#ifdef VELOX_ENABLE_GPU +#ifdef PRESTO_ENABLE_CUDF auto executionType = std::make_shared(protocol::ExecutionType::NATIVE_CUDF); #else auto executionType = std::make_shared(protocol::ExecutionType::NATIVE); From 50ba27ae704268cbb8702838cd74dfddd754314d Mon Sep 17 00:00:00 2001 From: johallar Date: Fri, 10 Oct 2025 20:23:35 +0000 Subject: [PATCH 05/11] java code always execution type java --- .../com/facebook/presto/server/ServerInfoResource.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java b/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java index 11cc4f3a41ee5..a1fb84c3d1f18 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java +++ b/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java @@ -60,11 +60,10 @@ public class ServerInfoResource private final long startTime = System.nanoTime(); private final NodeResourceStatusProvider nodeResourceStatusProvider; private final ResourceGroupManager resourceGroupManager; - private final FeaturesConfig featuresConfig; private NodeState nodeState = ACTIVE; @Inject - public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConfig serverConfig, StaticCatalogStore catalogStore, GracefulShutdownHandler shutdownHandler, NodeResourceStatusProvider nodeResourceStatusProvider, ResourceGroupManager resourceGroupManager, FeaturesConfig featuresConfig) + public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConfig serverConfig, StaticCatalogStore catalogStore, GracefulShutdownHandler shutdownHandler, NodeResourceStatusProvider nodeResourceStatusProvider, ResourceGroupManager resourceGroupManager) { this.version = requireNonNull(nodeVersion, "nodeVersion is null"); this.environment = requireNonNull(nodeInfo, "nodeInfo is null").getEnvironment(); @@ -74,7 +73,6 @@ public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConf this.shutdownHandler = requireNonNull(shutdownHandler, "shutdownHandler is null"); this.nodeResourceStatusProvider = requireNonNull(nodeResourceStatusProvider, "nodeResourceStatusProvider is null"); this.resourceGroupManager = requireNonNull(resourceGroupManager, "resourceGroupManager is null"); - this.featuresConfig = requireNonNull(featuresConfig, "featuresConfig is null"); } @GET @@ -82,8 +80,7 @@ public ServerInfoResource(NodeVersion nodeVersion, NodeInfo nodeInfo, ServerConf public ServerInfo getInfo() { boolean starting = resourceManager ? true : !catalogStore.areCatalogsLoaded(); - Optional executionType = featuresConfig.isNativeExecutionEnabled() ? - Optional.of(ExecutionType.NATIVE) : Optional.of(ExecutionType.JAVA); + Optional executionType = Optional.of(ExecutionType.JAVA); return new ServerInfo(version, environment, coordinator, starting, Optional.of(nanosSince(startTime)), executionType); } From bcb898dc7eb594f4f1fabd2e587e71c7ea6ccfb4 Mon Sep 17 00:00:00 2001 From: johallar Date: Fri, 10 Oct 2025 21:09:53 +0000 Subject: [PATCH 06/11] Don't include execution type in hash or comparison --- .../src/main/java/com/facebook/presto/client/ServerInfo.java | 5 ++--- .../java/com/facebook/presto/server/ServerInfoResource.java | 1 - presto-native-execution/velox | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java b/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java index 13cb63a52e05a..81bc58edbefbf 100644 --- a/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java +++ b/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java @@ -112,14 +112,13 @@ public boolean equals(Object o) ServerInfo that = (ServerInfo) o; return Objects.equals(nodeVersion, that.nodeVersion) && - Objects.equals(environment, that.environment) && - Objects.equals(executionType, that.executionType); + Objects.equals(environment, that.environment); } @Override public int hashCode() { - return Objects.hash(nodeVersion, environment, executionType); + return Objects.hash(nodeVersion, environment); } @Override diff --git a/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java b/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java index a1fb84c3d1f18..e4016134a5d97 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java +++ b/presto-main/src/main/java/com/facebook/presto/server/ServerInfoResource.java @@ -20,7 +20,6 @@ import com.facebook.presto.execution.resourceGroups.ResourceGroupManager; import com.facebook.presto.metadata.StaticCatalogStore; import com.facebook.presto.spi.NodeState; -import com.facebook.presto.sql.analyzer.FeaturesConfig; import com.facebook.presto.spi.NodeStats; import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Inject; diff --git a/presto-native-execution/velox b/presto-native-execution/velox index ccd765d3d9e70..aa406cbd6d9c5 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit ccd765d3d9e70ddc4cb222b00433b0922915b6cc +Subproject commit aa406cbd6d9c5aaa6b137ac4c7abc54b1bcfc7af From 43764143db9dd8bf7f55016f7f1863e50f111ded Mon Sep 17 00:00:00 2001 From: johallar Date: Wed, 15 Oct 2025 23:07:27 +0000 Subject: [PATCH 07/11] Rerun make presto_protocol, no errors --- .../presto_protocol_arrow_flight.json | 1 + .../connector/hive/presto_protocol_hive.cpp | 20 ++-- .../iceberg/presto_protocol_iceberg.cpp | 11 +- .../core/presto_protocol_core.cpp | 102 ++++++------------ .../core/presto_protocol_core.h | 28 ----- 5 files changed, 48 insertions(+), 114 deletions(-) diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json b/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json index 0b6ddc1d947ca..7a1974ee648a3 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/arrow_flight/presto_protocol_arrow_flight.json @@ -4,6 +4,7 @@ }, { "class_name": "ArrowColumnHandle", + "hinc": "// ArrowColumnHandle is special since it needs an implementation of\n// operator<().\n\nnamespace facebook::presto::protocol::arrow_flight {\nstruct ArrowColumnHandle : public ColumnHandle {\n String columnName = {};\n Type columnType = {};\n\n ArrowColumnHandle() noexcept;\n\n bool operator<(const ColumnHandle& o) const override {\n return columnName < dynamic_cast(o).columnName;\n }\n};\n\nvoid to_json(json& j, const ArrowColumnHandle& p);\nvoid from_json(const json& j, ArrowColumnHandle& p);\n\n} // namespace facebook::presto::protocol::arrow_flight", "struct": true, "fields": [ { diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp b/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp index 24e90b78e2e8c..8011da82eee47 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/hive/presto_protocol_hive.cpp @@ -370,10 +370,9 @@ namespace facebook::presto::protocol::hive { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - BucketFunctionType_enum_table[] = - { // NOLINT: cert-err58-cpp - {BucketFunctionType::HIVE_COMPATIBLE, "HIVE_COMPATIBLE"}, - {BucketFunctionType::PRESTO_NATIVE, "PRESTO_NATIVE"}}; + BucketFunctionType_enum_table[] = { // NOLINT: cert-err58-cpp + {BucketFunctionType::HIVE_COMPATIBLE, "HIVE_COMPATIBLE"}, + {BucketFunctionType::PRESTO_NATIVE, "PRESTO_NATIVE"}}; void to_json(json& j, const BucketFunctionType& e) { static_assert( std::is_enum::value, @@ -599,13 +598,12 @@ namespace facebook::presto::protocol::hive { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - HiveCompressionCodec_enum_table[] = - { // NOLINT: cert-err58-cpp - {HiveCompressionCodec::NONE, "NONE"}, - {HiveCompressionCodec::SNAPPY, "SNAPPY"}, - {HiveCompressionCodec::GZIP, "GZIP"}, - {HiveCompressionCodec::LZ4, "LZ4"}, - {HiveCompressionCodec::ZSTD, "ZSTD"}}; + HiveCompressionCodec_enum_table[] = { // NOLINT: cert-err58-cpp + {HiveCompressionCodec::NONE, "NONE"}, + {HiveCompressionCodec::SNAPPY, "SNAPPY"}, + {HiveCompressionCodec::GZIP, "GZIP"}, + {HiveCompressionCodec::LZ4, "LZ4"}, + {HiveCompressionCodec::ZSTD, "ZSTD"}}; void to_json(json& j, const HiveCompressionCodec& e) { static_assert( std::is_enum::value, diff --git a/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp b/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp index 1af077191a2a8..3229da2e88d07 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/connector/iceberg/presto_protocol_iceberg.cpp @@ -25,12 +25,11 @@ namespace facebook::presto::protocol::iceberg { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - ChangelogOperation_enum_table[] = - { // NOLINT: cert-err58-cpp - {ChangelogOperation::INSERT, "INSERT"}, - {ChangelogOperation::DELETE, "DELETE"}, - {ChangelogOperation::UPDATE_BEFORE, "UPDATE_BEFORE"}, - {ChangelogOperation::UPDATE_AFTER, "UPDATE_AFTER"}}; + ChangelogOperation_enum_table[] = { // NOLINT: cert-err58-cpp + {ChangelogOperation::INSERT, "INSERT"}, + {ChangelogOperation::DELETE, "DELETE"}, + {ChangelogOperation::UPDATE_BEFORE, "UPDATE_BEFORE"}, + {ChangelogOperation::UPDATE_AFTER, "UPDATE_AFTER"}}; void to_json(json& j, const ChangelogOperation& e) { static_assert( std::is_enum::value, diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp index 50f5986ca2b21..5ab664013a1e3 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp @@ -36,11 +36,10 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - NodeSelectionStrategy_enum_table[] = - { // NOLINT: cert-err58-cpp - {NodeSelectionStrategy::HARD_AFFINITY, "HARD_AFFINITY"}, - {NodeSelectionStrategy::SOFT_AFFINITY, "SOFT_AFFINITY"}, - {NodeSelectionStrategy::NO_PREFERENCE, "NO_PREFERENCE"}}; + NodeSelectionStrategy_enum_table[] = { // NOLINT: cert-err58-cpp + {NodeSelectionStrategy::HARD_AFFINITY, "HARD_AFFINITY"}, + {NodeSelectionStrategy::SOFT_AFFINITY, "SOFT_AFFINITY"}, + {NodeSelectionStrategy::NO_PREFERENCE, "NO_PREFERENCE"}}; void to_json(json& j, const NodeSelectionStrategy& e) { static_assert( std::is_enum::value, @@ -559,12 +558,11 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - AggregationNodeStep_enum_table[] = - { // NOLINT: cert-err58-cpp - {AggregationNodeStep::PARTIAL, "PARTIAL"}, - {AggregationNodeStep::FINAL, "FINAL"}, - {AggregationNodeStep::INTERMEDIATE, "INTERMEDIATE"}, - {AggregationNodeStep::SINGLE, "SINGLE"}}; + AggregationNodeStep_enum_table[] = { // NOLINT: cert-err58-cpp + {AggregationNodeStep::PARTIAL, "PARTIAL"}, + {AggregationNodeStep::FINAL, "FINAL"}, + {AggregationNodeStep::INTERMEDIATE, "INTERMEDIATE"}, + {AggregationNodeStep::SINGLE, "SINGLE"}}; void to_json(json& j, const AggregationNodeStep& e) { static_assert( std::is_enum::value, @@ -6146,10 +6144,9 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - JoinDistributionType_enum_table[] = - { // NOLINT: cert-err58-cpp - {JoinDistributionType::PARTITIONED, "PARTITIONED"}, - {JoinDistributionType::REPLICATED, "REPLICATED"}}; + JoinDistributionType_enum_table[] = { // NOLINT: cert-err58-cpp + {JoinDistributionType::PARTITIONED, "PARTITIONED"}, + {JoinDistributionType::REPLICATED, "REPLICATED"}}; void to_json(json& j, const JoinDistributionType& e) { static_assert( std::is_enum::value, @@ -8214,17 +8211,14 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - StageExecutionStrategy_enum_table[] = - { // NOLINT: cert-err58-cpp - {StageExecutionStrategy::UNGROUPED_EXECUTION, - "UNGROUPED_EXECUTION"}, - {StageExecutionStrategy::FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, - "FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, - {StageExecutionStrategy:: - DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, - "DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, - {StageExecutionStrategy::RECOVERABLE_GROUPED_EXECUTION, - "RECOVERABLE_GROUPED_EXECUTION"}}; + StageExecutionStrategy_enum_table[] = { // NOLINT: cert-err58-cpp + {StageExecutionStrategy::UNGROUPED_EXECUTION, "UNGROUPED_EXECUTION"}, + {StageExecutionStrategy::FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, + "FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, + {StageExecutionStrategy::DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, + "DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION"}, + {StageExecutionStrategy::RECOVERABLE_GROUPED_EXECUTION, + "RECOVERABLE_GROUPED_EXECUTION"}}; void to_json(json& j, const StageExecutionStrategy& e) { static_assert( std::is_enum::value, @@ -9397,20 +9391,6 @@ void from_json(const json& j, SemiJoinNode& p) { "dynamicFilters"); } } // namespace facebook::presto::protocol -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - namespace facebook::presto::protocol { static const std::pair ExecutionType_enum_table[] = @@ -9450,20 +9430,6 @@ void from_json(const json& j, ExecutionType& e) { } } // namespace facebook::presto::protocol -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - namespace facebook::presto::protocol { void to_json(json& j, const ServerInfo& p) { @@ -9976,13 +9942,12 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - SystemPartitionFunction_enum_table[] = - { // NOLINT: cert-err58-cpp - {SystemPartitionFunction::SINGLE, "SINGLE"}, - {SystemPartitionFunction::HASH, "HASH"}, - {SystemPartitionFunction::ROUND_ROBIN, "ROUND_ROBIN"}, - {SystemPartitionFunction::BROADCAST, "BROADCAST"}, - {SystemPartitionFunction::UNKNOWN, "UNKNOWN"}}; + SystemPartitionFunction_enum_table[] = { // NOLINT: cert-err58-cpp + {SystemPartitionFunction::SINGLE, "SINGLE"}, + {SystemPartitionFunction::HASH, "HASH"}, + {SystemPartitionFunction::ROUND_ROBIN, "ROUND_ROBIN"}, + {SystemPartitionFunction::BROADCAST, "BROADCAST"}, + {SystemPartitionFunction::UNKNOWN, "UNKNOWN"}}; void to_json(json& j, const SystemPartitionFunction& e) { static_assert( std::is_enum::value, @@ -10019,14 +9984,13 @@ namespace facebook::presto::protocol { // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays static const std::pair - SystemPartitioning_enum_table[] = - { // NOLINT: cert-err58-cpp - {SystemPartitioning::SINGLE, "SINGLE"}, - {SystemPartitioning::FIXED, "FIXED"}, - {SystemPartitioning::SOURCE, "SOURCE"}, - {SystemPartitioning::SCALED, "SCALED"}, - {SystemPartitioning::COORDINATOR_ONLY, "COORDINATOR_ONLY"}, - {SystemPartitioning::ARBITRARY, "ARBITRARY"}}; + SystemPartitioning_enum_table[] = { // NOLINT: cert-err58-cpp + {SystemPartitioning::SINGLE, "SINGLE"}, + {SystemPartitioning::FIXED, "FIXED"}, + {SystemPartitioning::SOURCE, "SOURCE"}, + {SystemPartitioning::SCALED, "SCALED"}, + {SystemPartitioning::COORDINATOR_ONLY, "COORDINATOR_ONLY"}, + {SystemPartitioning::ARBITRARY, "ARBITRARY"}}; void to_json(json& j, const SystemPartitioning& e) { static_assert( std::is_enum::value, diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h index c16cadb53eb5c..befa696999724 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h @@ -2154,39 +2154,11 @@ struct SemiJoinNode : public PlanNode { void to_json(json& j, const SemiJoinNode& p); void from_json(const json& j, SemiJoinNode& p); } // namespace facebook::presto::protocol -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - namespace facebook::presto::protocol { enum class ExecutionType { JAVA, NATIVE, NATIVE_CUDF }; extern void to_json(json& j, const ExecutionType& e); extern void from_json(const json& j, ExecutionType& e); } // namespace facebook::presto::protocol -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - namespace facebook::presto::protocol { struct ServerInfo { NodeVersion nodeVersion = {}; From 581037cbb540159a86c703aea5fecc3f9a1861cf Mon Sep 17 00:00:00 2001 From: johallar Date: Thu, 16 Oct 2025 19:59:32 +0000 Subject: [PATCH 08/11] Reset velox to commit pinned on presto master --- presto-native-execution/velox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presto-native-execution/velox b/presto-native-execution/velox index aa406cbd6d9c5..d4b1ab2733410 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit aa406cbd6d9c5aaa6b137ac4c7abc54b1bcfc7af +Subproject commit d4b1ab273341063bac3e4a9ba49899df558f164b From 41296a862f80c543632ce7655fccb4362ffbd72b Mon Sep 17 00:00:00 2001 From: johallar Date: Fri, 17 Oct 2025 15:49:05 +0000 Subject: [PATCH 09/11] Normalize enums java<->cpp --- .../presto_cpp/main/PrestoServer.cpp | 2 +- .../presto_protocol/core/presto_protocol_core.cpp | 2 +- .../presto_protocol/core/presto_protocol_core.h | 10 +++++----- .../presto_protocol/core/special/ExecutionType.cpp.inc | 2 +- .../presto_protocol/core/special/ExecutionType.hpp.inc | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index 7413dc2ebf777..72634a95303cb 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -1640,7 +1640,7 @@ void PrestoServer::reportServerInfo(proxygen::ResponseHandler* downstream) { // Determine execution type based on GPU support #ifdef PRESTO_ENABLE_CUDF - auto executionType = std::make_shared(protocol::ExecutionType::NATIVE_CUDF); + auto executionType = std::make_shared(protocol::ExecutionType::NATIVE_GPU); #else auto executionType = std::make_shared(protocol::ExecutionType::NATIVE); #endif diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp index 6c7b6d9d73dfb..66e856c4c015c 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp @@ -9397,7 +9397,7 @@ static const std::pair ExecutionType_enum_table[] = { // NOLINT: cert-err58-cpp {ExecutionType::JAVA, "java"}, {ExecutionType::NATIVE, "native"}, - {ExecutionType::NATIVE_CUDF, "native_cudf"}}; + {ExecutionType::NATIVE_GPU, "native-gpu"}}; void to_json(json& j, const ExecutionType& e) { static_assert( diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h index 3b3f5f3aa4896..54d0c1ed5aa77 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h @@ -69,21 +69,21 @@ extern const char* const PRESTO_ABORT_TASK_URL_PARAM; class Exception : public std::runtime_error { public: explicit Exception(const std::string& message) - : std::runtime_error(message) {}; + : std::runtime_error(message){}; }; class TypeError : public Exception { public: - explicit TypeError(const std::string& message) : Exception(message) {}; + explicit TypeError(const std::string& message) : Exception(message){}; }; class OutOfRange : public Exception { public: - explicit OutOfRange(const std::string& message) : Exception(message) {}; + explicit OutOfRange(const std::string& message) : Exception(message){}; }; class ParseError : public Exception { public: - explicit ParseError(const std::string& message) : Exception(message) {}; + explicit ParseError(const std::string& message) : Exception(message){}; }; using String = std::string; @@ -2155,7 +2155,7 @@ void to_json(json& j, const SemiJoinNode& p); void from_json(const json& j, SemiJoinNode& p); } // namespace facebook::presto::protocol namespace facebook::presto::protocol { -enum class ExecutionType { JAVA, NATIVE, NATIVE_CUDF }; +enum class ExecutionType { JAVA, NATIVE, NATIVE_GPU }; extern void to_json(json& j, const ExecutionType& e); extern void from_json(const json& j, ExecutionType& e); } // namespace facebook::presto::protocol diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc index 0341777a2ab6d..a51ff0ceb2463 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.cpp.inc @@ -18,7 +18,7 @@ static const std::pair ExecutionType_enum_table[] = { // NOLINT: cert-err58-cpp {ExecutionType::JAVA, "java"}, {ExecutionType::NATIVE, "native"}, - {ExecutionType::NATIVE_CUDF, "native_cudf"}}; + {ExecutionType::NATIVE_GPU, "native-gpu"}}; void to_json(json& j, const ExecutionType& e) { static_assert( diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc index 6cba58eab9cc1..b76a0b400a40a 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc +++ b/presto-native-execution/presto_cpp/presto_protocol/core/special/ExecutionType.hpp.inc @@ -13,7 +13,7 @@ */ namespace facebook::presto::protocol { -enum class ExecutionType { JAVA, NATIVE, NATIVE_CUDF }; +enum class ExecutionType { JAVA, NATIVE, NATIVE_GPU }; extern void to_json(json& j, const ExecutionType& e); extern void from_json(const json& j, ExecutionType& e); } // namespace facebook::presto::protocol From 1e84e79e8a959ecdd88a6564aef7185ddaccbe0a Mon Sep 17 00:00:00 2001 From: johallar Date: Tue, 21 Oct 2025 18:29:26 +0000 Subject: [PATCH 10/11] Remove the ServerInfo inc files --- .../core/presto_protocol_core.cpp | 1 - .../core/special/ServerInfo.cpp.inc | 52 ------------------- .../core/special/ServerInfo.hpp.inc | 26 ---------- 3 files changed, 79 deletions(-) delete mode 100644 presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc delete mode 100644 presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp index 66e856c4c015c..e5f21ed07559a 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp @@ -9478,7 +9478,6 @@ void from_json(const json& j, ServerInfo& p) { "ExecutionType", "executionType"); } - } // namespace facebook::presto::protocol namespace facebook::presto::protocol { diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc deleted file mode 100644 index d41f37ebbcea1..0000000000000 --- a/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.cpp.inc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace facebook::presto::protocol { - -void to_json(json& j, const ServerInfo& p) { - j = json::object(); - to_json_key( - j, - "nodeVersion", - p.nodeVersion, - "ServerInfo", - "NodeVersion", - "nodeVersion"); - to_json_key( - j, "environment", p.environment, "ServerInfo", "String", "environment"); - to_json_key( - j, "coordinator", p.coordinator, "ServerInfo", "bool", "coordinator"); - to_json_key(j, "starting", p.starting, "ServerInfo", "bool", "starting"); - to_json_key(j, "uptime", p.uptime, "ServerInfo", "Duration", "uptime"); - to_json_key(j, "executionType", p.executionType, "ServerInfo", "ExecutionType", "executionType"); -} - -void from_json(const json& j, ServerInfo& p) { - from_json_key( - j, - "nodeVersion", - p.nodeVersion, - "ServerInfo", - "NodeVersion", - "nodeVersion"); - from_json_key( - j, "environment", p.environment, "ServerInfo", "String", "environment"); - from_json_key( - j, "coordinator", p.coordinator, "ServerInfo", "bool", "coordinator"); - from_json_key(j, "starting", p.starting, "ServerInfo", "bool", "starting"); - from_json_key(j, "uptime", p.uptime, "ServerInfo", "Duration", "uptime"); - from_json_key(j, "executionType", p.executionType, "ServerInfo", "ExecutionType", "executionType"); -} - -} // namespace facebook::presto::protocol diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc b/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc deleted file mode 100644 index 35c2891be170e..0000000000000 --- a/presto-native-execution/presto_cpp/presto_protocol/core/special/ServerInfo.hpp.inc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace facebook::presto::protocol { -struct ServerInfo { - NodeVersion nodeVersion = {}; - String environment = {}; - bool coordinator = {}; - bool starting = {}; - std::shared_ptr uptime = {}; - std::shared_ptr executionType = {}; -}; -void to_json(json& j, const ServerInfo& p); -void from_json(const json& j, ServerInfo& p); -} // namespace facebook::presto::protocol From 440f65263617cf60286d8bfa63e7fa92e327dac4 Mon Sep 17 00:00:00 2001 From: johallar Date: Tue, 28 Oct 2025 15:40:54 +0000 Subject: [PATCH 11/11] Add backwards compatible constructor --- .../facebook/presto/client/ServerInfo.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java b/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java index 81bc58edbefbf..7e498f5fbb08c 100644 --- a/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java +++ b/presto-client/src/main/java/com/facebook/presto/client/ServerInfo.java @@ -55,7 +55,24 @@ public ServerInfo( this.coordinator = coordinator; this.starting = starting; this.uptime = requireNonNull(uptime, "uptime is null"); - this.executionType = executionType; + this.executionType = requireNonNull(executionType, "executionType is null"); + } + + @ThriftConstructor + @JsonCreator + public ServerInfo( + @JsonProperty("nodeVersion") NodeVersion nodeVersion, + @JsonProperty("environment") String environment, + @JsonProperty("coordinator") boolean coordinator, + @JsonProperty("starting") boolean starting, + @JsonProperty("uptime") Optional uptime) + { + this.nodeVersion = requireNonNull(nodeVersion, "nodeVersion is null"); + this.environment = requireNonNull(environment, "environment is null"); + this.coordinator = coordinator; + this.starting = starting; + this.uptime = requireNonNull(uptime, "uptime is null"); + this.executionType = Optional.empty(); } @ThriftField(1)