diff --git a/presto-native-execution/presto_cpp/main/tests/TaskStatusTest.cpp b/presto-native-execution/presto_cpp/main/tests/TaskStatusTest.cpp index 5f375ce45c75a..d74d1e9ed89ea 100644 --- a/presto-native-execution/presto_cpp/main/tests/TaskStatusTest.cpp +++ b/presto-native-execution/presto_cpp/main/tests/TaskStatusTest.cpp @@ -79,8 +79,7 @@ TEST_F(TaskStatusTest, executionFailureInfoOptionalFieldsEmpty) { ASSERT_EQ(thriftExecutionFailureInfo.type(), "type"); ASSERT_EQ(thriftExecutionFailureInfo.errorLocation()->columnNumber(), 2); - ASSERT_EQ(thriftExecutionFailureInfo.remoteHost()->host(), "localhost"); - ASSERT_EQ(thriftExecutionFailureInfo.remoteHost()->port(), 8080); + ASSERT_EQ(thriftExecutionFailureInfo.remoteHost()->hostPortString(), "localhost:8080"); ASSERT_EQ(thriftExecutionFailureInfo.errorCode()->type(), facebook::presto::thrift::ErrorType::INTERNAL_ERROR); ASSERT_EQ(thriftExecutionFailureInfo.errorCode()->retriable(), false); ASSERT_EQ(thriftExecutionFailureInfo.errorCause(), facebook::presto::thrift::ErrorCause::EXCEEDS_BROADCAST_MEMORY_LIMIT); diff --git a/presto-native-execution/presto_cpp/main/thrift/ProtocolToThrift.cpp b/presto-native-execution/presto_cpp/main/thrift/ProtocolToThrift.cpp index df6dc9eabae2b..f347e088a4b7a 100644 --- a/presto-native-execution/presto_cpp/main/thrift/ProtocolToThrift.cpp +++ b/presto-native-execution/presto_cpp/main/thrift/ProtocolToThrift.cpp @@ -427,19 +427,12 @@ void fromThrift( void toThrift( const facebook::presto::protocol::HostAddress& proto, HostAddress& thrift) { - std::vector parts; - folly::split(":", proto, parts); - if (parts.size() == 2) { - thrift.host_ref() = parts[0]; - thrift.port_ref() = std::stoi(parts[1]); - } + toThrift(proto, *thrift.hostPortString_ref()); } void fromThrift( const HostAddress& thrift, facebook::presto::protocol::HostAddress& proto) { - std::string hostAddressStr = - *thrift.host_ref() + "." + std::to_string(*thrift.port_ref()); - fromThrift(hostAddressStr, proto); + fromThrift(*thrift.hostPortString_ref(), proto); } void toThrift( const facebook::presto::protocol::OutputBufferId& proto, @@ -635,12 +628,12 @@ void fromThrift( void toThrift( const facebook::presto::protocol::TimeZoneKey& proto, TimeZoneKey& thrift) { - toThrift(proto, *thrift.key_ref()); + toThrift(proto, *thrift.timeZoneKey_ref()); } void fromThrift( const TimeZoneKey& thrift, facebook::presto::protocol::TimeZoneKey& proto) { - fromThrift(*thrift.key_ref(), proto); + fromThrift(*thrift.timeZoneKey_ref(), proto); } void toThrift( const facebook::presto::protocol::ResourceEstimates& proto, diff --git a/presto-native-execution/presto_cpp/main/thrift/presto_protocol-to-thrift-json.yml b/presto-native-execution/presto_cpp/main/thrift/presto_protocol-to-thrift-json.yml index 08d809b945417..b4e44171674e0 100644 --- a/presto-native-execution/presto_cpp/main/thrift/presto_protocol-to-thrift-json.yml +++ b/presto-native-execution/presto_cpp/main/thrift/presto_protocol-to-thrift-json.yml @@ -49,9 +49,10 @@ WrapperStruct: TransactionId: RuntimeStats: SqlFunctionId: + HostAddress: + TimeZoneKey: Special: - HostAddress: QualifiedObjectName: MetadataUpdatesWrapper: OperatorInfoUnion: @@ -59,6 +60,5 @@ Special: SplitWrapper: TableWriteInfoWrapper: TaskId: - TimeZoneKey: Type: TypeSignature: diff --git a/presto-native-execution/presto_cpp/main/thrift/presto_thrift.thrift b/presto-native-execution/presto_cpp/main/thrift/presto_thrift.thrift index e9a1fe2c6e1dd..2623225df0c11 100644 --- a/presto-native-execution/presto_cpp/main/thrift/presto_thrift.thrift +++ b/presto-native-execution/presto_cpp/main/thrift/presto_thrift.thrift @@ -98,8 +98,7 @@ struct ErrorLocation { 2: i32 columnNumber; } struct HostAddress { - 1: string host; - 2: i32 port; + 1: string hostPortString; } struct StageId { 1: string queryId; @@ -237,8 +236,7 @@ struct TransactionId { 1: string uuid; } struct TimeZoneKey { - 1: string id; - 2: i16 key; + 1: i16 timeZoneKey; } struct ResourceEstimates { 1: optional double executionTime; diff --git a/presto-native-execution/presto_cpp/main/thrift/special/HostAddress.cpp.inc b/presto-native-execution/presto_cpp/main/thrift/special/HostAddress.cpp.inc deleted file mode 100644 index 640836b32a1db..0000000000000 --- a/presto-native-execution/presto_cpp/main/thrift/special/HostAddress.cpp.inc +++ /dev/null @@ -1,28 +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. - */ - -void toThrift(const facebook::presto::protocol::HostAddress& proto, HostAddress& thrift) { - std::vector parts; - folly::split(":", proto, parts); - if (parts.size() == 2) { - thrift.host_ref() = parts[0]; - thrift.port_ref() = std::stoi(parts[1]); - } -} -void fromThrift(const HostAddress& thrift, facebook::presto::protocol::HostAddress& proto) { - std::string hostAddressStr = - *thrift.host_ref() + "." + - std::to_string(*thrift.port_ref()); - fromThrift(hostAddressStr, proto); -} diff --git a/presto-native-execution/presto_cpp/main/thrift/special/TimeZoneKey.cpp.inc b/presto-native-execution/presto_cpp/main/thrift/special/TimeZoneKey.cpp.inc deleted file mode 100644 index 99f51c98ee086..0000000000000 --- a/presto-native-execution/presto_cpp/main/thrift/special/TimeZoneKey.cpp.inc +++ /dev/null @@ -1,20 +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. - */ - -void toThrift(const facebook::presto::protocol::TimeZoneKey& proto, TimeZoneKey& thrift) { - toThrift(proto, *thrift.key_ref()); -} -void fromThrift(const TimeZoneKey& thrift, facebook::presto::protocol::TimeZoneKey& proto) { - fromThrift(*thrift.key_ref(), proto); -} diff --git a/presto-native-execution/presto_cpp/main/thrift/thrift2json.py b/presto-native-execution/presto_cpp/main/thrift/thrift2json.py index 8dd1a305d5d28..8560f037c68f5 100755 --- a/presto-native-execution/presto_cpp/main/thrift/thrift2json.py +++ b/presto-native-execution/presto_cpp/main/thrift/thrift2json.py @@ -1,4 +1,4 @@ -#!/Library/Developer/CommandLineTools/usr/bin/python3 +#!/usr/bin/env python3 # 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