diff --git a/.github/workflows/arrow-flight-tests.yml b/.github/workflows/arrow-flight-tests.yml index a1ab312745d8f..67290ace0e399 100644 --- a/.github/workflows/arrow-flight-tests.yml +++ b/.github/workflows/arrow-flight-tests.yml @@ -69,7 +69,7 @@ jobs: prestocpp-linux-build-for-test: runs-on: ubuntu-22.04 container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt @@ -183,7 +183,7 @@ jobs: needs: prestocpp-linux-build-for-test runs-on: ubuntu-22.04 container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt diff --git a/.github/workflows/prestocpp-linux-adapters-build.yml b/.github/workflows/prestocpp-linux-adapters-build.yml index 546cf0f395e46..d45bd35a27f6d 100644 --- a/.github/workflows/prestocpp-linux-adapters-build.yml +++ b/.github/workflows/prestocpp-linux-adapters-build.yml @@ -11,7 +11,7 @@ jobs: prestocpp-linux-adapters-build: runs-on: ubuntu-22.04 container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 concurrency: group: ${{ github.workflow }}-prestocpp-linux-adapters-build-${{ github.event.pull_request.number }} cancel-in-progress: true diff --git a/.github/workflows/prestocpp-linux-build-and-unit-test.yml b/.github/workflows/prestocpp-linux-build-and-unit-test.yml index 8b6698c2b4b31..566146da290fd 100644 --- a/.github/workflows/prestocpp-linux-build-and-unit-test.yml +++ b/.github/workflows/prestocpp-linux-build-and-unit-test.yml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-22.04 needs: changes container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 concurrency: group: ${{ github.workflow }}-prestocpp-linux-build-test-${{ github.event.pull_request.number }} cancel-in-progress: true @@ -135,7 +135,7 @@ jobs: needs: [changes, prestocpp-linux-build-for-test] runs-on: ubuntu-22.04 container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt @@ -260,7 +260,7 @@ jobs: storage-format: [PARQUET, DWRF] enable-sidecar: [true, false] container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt @@ -388,7 +388,7 @@ jobs: group: ${{ github.workflow }}-prestocpp-linux-presto-on-spark-e2e-tests-${{ matrix.storage-format }}-${{ matrix.enable-sidecar }}-${{ github.event.pull_request.number }} cancel-in-progress: true container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt @@ -501,7 +501,7 @@ jobs: needs: [changes, prestocpp-linux-build-for-test] runs-on: ubuntu-22.04 container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt @@ -613,7 +613,7 @@ jobs: needs: [changes, prestocpp-linux-build-for-test] runs-on: ubuntu-22.04 container: - image: prestodb/presto-native-dependency:0.297-202601311423-22d722a9 + image: prestodb/presto-native-dependency:0.297-202602271419-160459b8 volumes: - /usr:/host_usr - /opt:/host_opt diff --git a/presto-native-execution/CMake/arrow/arrow-flight.patch b/presto-native-execution/CMake/arrow/arrow-flight.patch new file mode 100644 index 0000000000000..385e08f5fcd8d --- /dev/null +++ b/presto-native-execution/CMake/arrow/arrow-flight.patch @@ -0,0 +1,319 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# 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. + +--- a/cpp/src/arrow/flight/types.h ++++ b/cpp/src/arrow/flight/types.h +@@ -465,8 +465,150 @@ + static FlightDescriptor Path(std::vector path) { + return FlightDescriptor{PATH, "", std::move(path)}; + } ++}; ++ ++struct ARROW_FLIGHT_EXPORT Ticket : public internal::BaseType { ++ std::string ticket; ++ ++ Ticket() = default; ++ Ticket(std::string ticket) // NOLINT runtime/explicit ++ : ticket(std::move(ticket)) {} ++ ++ std::string ToString() const; ++ bool Equals(const Ticket& other) const; ++ ++ using SuperT::Deserialize; ++ using SuperT::SerializeToString; ++ ++ /// \brief Get the wire-format representation of this type. ++ /// ++ /// Useful when interoperating with non-Flight systems (e.g. REST ++ /// services) that may want to return Flight types. ++ /// ++ /// Use `SerializeToString()` if you want a Result-returning version. ++ arrow::Status SerializeToString(std::string* out) const; ++ ++ /// \brief Parse the wire-format representation of this type. ++ /// ++ /// Useful when interoperating with non-Flight systems (e.g. REST ++ /// services) that may want to return Flight types. ++ /// ++ /// Use `Deserialize(serialized)` if you want a Result-returning version. ++ static arrow::Status Deserialize(std::string_view serialized, Ticket* out); ++}; ++ ++struct ARROW_FLIGHT_EXPORT Location : public internal::BaseType { ++ public: ++ /// \brief Initialize a blank location. ++ Location(); ++ ++ ~Location(); ++ ++ /// \brief Initialize a location by parsing a URI string ++ static arrow::Result Parse(const std::string& uri_string); ++ ++ /// \brief Get the fallback URI. ++ /// ++ /// arrow-flight-reuse-connection://? means that a client may attempt to ++ /// reuse an existing connection to a Flight service to fetch data instead ++ /// of creating a new connection to one of the other locations listed in a ++ /// FlightEndpoint response. ++ static const Location& ReuseConnection(); ++ ++ /// \brief Initialize a location for a non-TLS, gRPC-based Flight ++ /// service from a host and port ++ /// \param[in] host The hostname to connect to ++ /// \param[in] port The port ++ /// \return Arrow result with the resulting location ++ static arrow::Result ForGrpcTcp(const std::string& host, const int port); ++ ++ /// \brief Initialize a location for a TLS-enabled, gRPC-based Flight ++ /// service from a host and port ++ /// \param[in] host The hostname to connect to ++ /// \param[in] port The port ++ /// \return Arrow result with the resulting location ++ static arrow::Result ForGrpcTls(const std::string& host, const int port); ++ ++ /// \brief Initialize a location for a domain socket-based Flight ++ /// service ++ /// \param[in] path The path to the domain socket ++ /// \return Arrow result with the resulting location ++ static arrow::Result ForGrpcUnix(const std::string& path); ++ ++ /// \brief Initialize a location based on a URI scheme ++ static arrow::Result ForScheme(const std::string& scheme, ++ const std::string& host, const int port); ++ ++ /// \brief Get the scheme of this URI. ++ std::string scheme() const; ++ ++ /// \brief Get a representation of this URI as a string. ++ std::string ToString() const; ++ bool Equals(const Location& other) const; ++ ++ using SuperT::Deserialize; ++ using SuperT::SerializeToString; ++ ++ /// \brief Serialize this message to its wire-format representation. ++ /// ++ /// Use `SerializeToString()` if you want a Result-returning version. ++ arrow::Status SerializeToString(std::string* out) const; ++ ++ /// \brief Deserialize this message from its wire-format representation. ++ /// ++ /// Use `Deserialize(serialized)` if you want a Result-returning version. ++ static arrow::Status Deserialize(std::string_view serialized, Location* out); ++ ++ private: ++ friend class FlightClient; ++ friend class FlightServerBase; ++ std::shared_ptr uri_; ++}; ++ ++/// \brief A flight ticket and list of locations where the ticket can be ++struct ARROW_FLIGHT_EXPORT FlightEndpoint : public internal::BaseType { ++ /// Opaque ticket identify; use with DoGet RPC ++ Ticket ticket; ++ ++ /// List of locations where ticket can be redeemed. If the list is empty, the ++ /// ticket can only be redeemed on the current service where the ticket was ++ /// generated ++ std::vector locations; ++ ++ /// Expiration time of this stream. If present, clients may assume ++ /// they can retry DoGet requests. Otherwise, clients should avoid ++ /// retrying DoGet requests. ++ std::optional expiration_time; ++ ++ /// Opaque Application-defined metadata ++ std::string app_metadata; ++ ++ FlightEndpoint() = default; ++ FlightEndpoint(Ticket ticket, std::vector locations, ++ std::optional expiration_time, std::string app_metadata) ++ : ticket(std::move(ticket)), ++ locations(std::move(locations)), ++ expiration_time(expiration_time), ++ app_metadata(std::move(app_metadata)) {} ++ ++ std::string ToString() const; ++ bool Equals(const FlightEndpoint& other) const; ++ ++ using SuperT::Deserialize; ++ using SuperT::SerializeToString; ++ ++ /// \brief Serialize this message to its wire-format representation. ++ /// ++ /// Use `SerializeToString()` if you want a Result-returning version. ++ arrow::Status SerializeToString(std::string* out) const; ++ ++ /// \brief Deserialize this message from its wire-format representation. ++ /// ++ /// Use `Deserialize(serialized)` if you want a Result-returning version. ++ static arrow::Status Deserialize(std::string_view serialized, FlightEndpoint* out); + }; + ++/// \brief The request of the RenewFlightEndpoint action. + /// \brief The access coordinates for retrieval of a dataset, returned by + /// GetFlightInfo + class ARROW_FLIGHT_EXPORT FlightInfo +@@ -704,150 +846,7 @@ + + /// \brief Data structure providing an opaque identifier or credential to use + /// when requesting a data stream with the DoGet RPC +-struct ARROW_FLIGHT_EXPORT Ticket : public internal::BaseType { +- std::string ticket; +- +- Ticket() = default; +- Ticket(std::string ticket) // NOLINT runtime/explicit +- : ticket(std::move(ticket)) {} +- +- std::string ToString() const; +- bool Equals(const Ticket& other) const; +- +- using SuperT::Deserialize; +- using SuperT::SerializeToString; +- +- /// \brief Get the wire-format representation of this type. +- /// +- /// Useful when interoperating with non-Flight systems (e.g. REST +- /// services) that may want to return Flight types. +- /// +- /// Use `SerializeToString()` if you want a Result-returning version. +- arrow::Status SerializeToString(std::string* out) const; +- +- /// \brief Parse the wire-format representation of this type. +- /// +- /// Useful when interoperating with non-Flight systems (e.g. REST +- /// services) that may want to return Flight types. +- /// +- /// Use `Deserialize(serialized)` if you want a Result-returning version. +- static arrow::Status Deserialize(std::string_view serialized, Ticket* out); +-}; +- +-/// \brief A host location (a URI) +-struct ARROW_FLIGHT_EXPORT Location : public internal::BaseType { +- public: +- /// \brief Initialize a blank location. +- Location(); +- +- ~Location(); +- +- /// \brief Initialize a location by parsing a URI string +- static arrow::Result Parse(const std::string& uri_string); +- +- /// \brief Get the fallback URI. +- /// +- /// arrow-flight-reuse-connection://? means that a client may attempt to +- /// reuse an existing connection to a Flight service to fetch data instead +- /// of creating a new connection to one of the other locations listed in a +- /// FlightEndpoint response. +- static const Location& ReuseConnection(); +- +- /// \brief Initialize a location for a non-TLS, gRPC-based Flight +- /// service from a host and port +- /// \param[in] host The hostname to connect to +- /// \param[in] port The port +- /// \return Arrow result with the resulting location +- static arrow::Result ForGrpcTcp(const std::string& host, const int port); +- +- /// \brief Initialize a location for a TLS-enabled, gRPC-based Flight +- /// service from a host and port +- /// \param[in] host The hostname to connect to +- /// \param[in] port The port +- /// \return Arrow result with the resulting location +- static arrow::Result ForGrpcTls(const std::string& host, const int port); +- +- /// \brief Initialize a location for a domain socket-based Flight +- /// service +- /// \param[in] path The path to the domain socket +- /// \return Arrow result with the resulting location +- static arrow::Result ForGrpcUnix(const std::string& path); +- +- /// \brief Initialize a location based on a URI scheme +- static arrow::Result ForScheme(const std::string& scheme, +- const std::string& host, const int port); +- +- /// \brief Get the scheme of this URI. +- std::string scheme() const; +- +- /// \brief Get a representation of this URI as a string. +- std::string ToString() const; +- bool Equals(const Location& other) const; +- +- using SuperT::Deserialize; +- using SuperT::SerializeToString; +- +- /// \brief Serialize this message to its wire-format representation. +- /// +- /// Use `SerializeToString()` if you want a Result-returning version. +- arrow::Status SerializeToString(std::string* out) const; +- +- /// \brief Deserialize this message from its wire-format representation. +- /// +- /// Use `Deserialize(serialized)` if you want a Result-returning version. +- static arrow::Status Deserialize(std::string_view serialized, Location* out); +- +- private: +- friend class FlightClient; +- friend class FlightServerBase; +- std::shared_ptr uri_; +-}; +- +-/// \brief A flight ticket and list of locations where the ticket can be + /// redeemed +-struct ARROW_FLIGHT_EXPORT FlightEndpoint : public internal::BaseType { +- /// Opaque ticket identify; use with DoGet RPC +- Ticket ticket; +- +- /// List of locations where ticket can be redeemed. If the list is empty, the +- /// ticket can only be redeemed on the current service where the ticket was +- /// generated +- std::vector locations; +- +- /// Expiration time of this stream. If present, clients may assume +- /// they can retry DoGet requests. Otherwise, clients should avoid +- /// retrying DoGet requests. +- std::optional expiration_time; +- +- /// Opaque Application-defined metadata +- std::string app_metadata; +- +- FlightEndpoint() = default; +- FlightEndpoint(Ticket ticket, std::vector locations, +- std::optional expiration_time, std::string app_metadata) +- : ticket(std::move(ticket)), +- locations(std::move(locations)), +- expiration_time(expiration_time), +- app_metadata(std::move(app_metadata)) {} +- +- std::string ToString() const; +- bool Equals(const FlightEndpoint& other) const; +- +- using SuperT::Deserialize; +- using SuperT::SerializeToString; +- +- /// \brief Serialize this message to its wire-format representation. +- /// +- /// Use `SerializeToString()` if you want a Result-returning version. +- arrow::Status SerializeToString(std::string* out) const; +- +- /// \brief Deserialize this message from its wire-format representation. +- /// +- /// Use `Deserialize(serialized)` if you want a Result-returning version. +- static arrow::Status Deserialize(std::string_view serialized, FlightEndpoint* out); +-}; +- +-/// \brief The request of the RenewFlightEndpoint action. + struct ARROW_FLIGHT_EXPORT RenewFlightEndpointRequest + : public internal::BaseType { + FlightEndpoint endpoint; + diff --git a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt index 459cbc9e623b9..4deeaeb1f9111 100644 --- a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt @@ -90,7 +90,6 @@ if(PRESTO_ENABLE_REMOTE_FUNCTIONS) presto_server_remote_function_test presto_server_remote_function velox_expression - velox_temp_path GTest::gmock GTest::gtest GTest::gtest_main diff --git a/presto-native-execution/presto_cpp/main/tests/RemoteFunctionRegistererTest.cpp b/presto-native-execution/presto_cpp/main/tests/RemoteFunctionRegistererTest.cpp index 7788cc22c38e1..c93973b394c94 100644 --- a/presto-native-execution/presto_cpp/main/tests/RemoteFunctionRegistererTest.cpp +++ b/presto-native-execution/presto_cpp/main/tests/RemoteFunctionRegistererTest.cpp @@ -16,8 +16,8 @@ #include #include #include "velox/common/base/Fs.h" -#include "velox/exec/tests/utils/TempDirectoryPath.h" -#include "velox/exec/tests/utils/TempFilePath.h" +#include "velox/common/testutil/TempDirectoryPath.h" +#include "velox/common/testutil/TempFilePath.h" #include "velox/expression/VectorFunction.h" using namespace facebook::velox; @@ -56,7 +56,7 @@ TEST_F(RemoteFunctionRegistererTest, singleFile) { })"; // Write to a single output file. - auto path = exec::test::TempFilePath::create(); + auto path = common::testutil::TempFilePath::create(); writeToFile(path->getPath(), json); // Check functions do not exist first. @@ -86,7 +86,7 @@ TEST_F(RemoteFunctionRegistererTest, prefixes) { })"; // Write to a single output file. - auto path = exec::test::TempFilePath::create(); + auto path = common::testutil::TempFilePath::create(); writeToFile(path->getPath(), json); EXPECT_TRUE(exec::getVectorFunctionSignatures("mock3") == std::nullopt); @@ -124,7 +124,7 @@ std::string getJson(const std::string& functionName) { } TEST_F(RemoteFunctionRegistererTest, directory) { - auto tempDir = exec::test::TempDirectoryPath::create(); + auto tempDir = common::testutil::TempDirectoryPath::create(); // Create the following structure: // diff --git a/presto-native-execution/scripts/dockerfiles/centos-dependency.dockerfile b/presto-native-execution/scripts/dockerfiles/centos-dependency.dockerfile index 4fd00dadc402d..928692df345c4 100644 --- a/presto-native-execution/scripts/dockerfiles/centos-dependency.dockerfile +++ b/presto-native-execution/scripts/dockerfiles/centos-dependency.dockerfile @@ -32,7 +32,9 @@ COPY velox/scripts /velox/scripts # Copy extra script called during setup. # from https://github.com/facebookincubator/velox/pull/14016 COPY velox/CMake/resolve_dependency_modules/arrow/cmake-compatibility.patch /velox +COPY CMake/arrow/arrow-flight.patch /scripts ENV VELOX_ARROW_CMAKE_PATCH=/velox/cmake-compatibility.patch +ENV EXTRA_ARROW_PATCH=/scripts/arrow-flight.patch RUN bash -c "mkdir build && \ (cd build && ../scripts/setup-centos.sh && \ ../scripts/setup-adapters.sh && \ diff --git a/presto-native-execution/scripts/setup-adapters.sh b/presto-native-execution/scripts/setup-adapters.sh index d91845532ab9d..0cceb12835b73 100755 --- a/presto-native-execution/scripts/setup-adapters.sh +++ b/presto-native-execution/scripts/setup-adapters.sh @@ -14,14 +14,16 @@ # Propagate errors and improve debugging. set -eufx -o pipefail +EXTRA_ARROW_PATCH=${EXTRA_ARROW_PATCH:-""} + JWT_VERSION="v0.6.0" PROMETHEUS_VERSION="v1.2.4" -SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") -if [ -f "${SCRIPT_DIR}/setup-common.sh" ]; then - source "${SCRIPT_DIR}/setup-common.sh" +PRESTO_SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") +if [ -f "${PRESTO_SCRIPT_DIR}/setup-common.sh" ]; then + source "${PRESTO_SCRIPT_DIR}/setup-common.sh" else - source "${SCRIPT_DIR}/../velox/scripts/setup-common.sh" + source "${PRESTO_SCRIPT_DIR}/../velox/scripts/setup-common.sh" fi DEPENDENCY_DIR=${DEPENDENCY_DIR:-$(pwd)} @@ -47,7 +49,10 @@ function install_arrow_flight { # Arrow Flight enabled. The Velox version of Arrow is used. # NOTE: benchmarks are on due to a compilation error with v15.0.0, once updated that can be removed # see https://github.com/apache/arrow/issues/41617 - EXTRA_ARROW_OPTIONS=" -DARROW_FLIGHT=ON -DARROW_BUILD_BENCHMARKS=ON -DgRPC_SOURCE=BUNDLED -DProtobuf_SOURCE=BUNDLED " + if [ -z "$EXTRA_ARROW_PATCH" ]; then + EXTRA_ARROW_PATCH="${PRESTO_SCRIPT_DIR}/../CMake/arrow/arrow-flight.patch" + fi + EXTRA_ARROW_OPTIONS=" -DARROW_FLIGHT=ON -DARROW_BUILD_BENCHMARKS=ON -Dabsl_SOURCE=BUNDLED -DgRPC_SOURCE=BUNDLED -DProtobuf_SOURCE=BUNDLED " install_arrow } diff --git a/presto-native-execution/velox b/presto-native-execution/velox index 54f466296468b..4514fee819453 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit 54f466296468b6f16c643e96713bf01be1adb91e +Subproject commit 4514fee8194533c69a6dc080987f131710ad829e diff --git a/presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/TestNativeSidecarPlugin.java b/presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/TestNativeSidecarPlugin.java index 1c0b1b253c79a..d9c94fe6a2abf 100644 --- a/presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/TestNativeSidecarPlugin.java +++ b/presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/TestNativeSidecarPlugin.java @@ -77,7 +77,7 @@ public class TestNativeSidecarPlugin private static final String REGEX_FUNCTION_NAMESPACE = "native.default.*"; private static final String REGEX_SESSION_NAMESPACE = "Native Execution only.*"; private static final long SIDECAR_HTTP_CLIENT_MAX_CONTENT_SIZE_MB = 128; - private static final int INLINED_SQL_FUNCTIONS_COUNT = 7; + private static final int INLINED_SQL_FUNCTIONS_COUNT = 6; @Override protected void createTables() @@ -566,6 +566,7 @@ public void testOverriddenInlinedSqlInvokedFunctions() assertQuery("SELECT any_values_match(MAP(ARRAY[orderkey], ARRAY[totalprice]), k -> abs(k) > 20) from orders"); assertQuery("SELECT no_values_match(MAP(ARRAY[orderkey], ARRAY[comment]), k -> length(k) > 2) from orders"); assertQuery("SELECT no_keys_match(MAP(ARRAY[comment], ARRAY[custkey]), k -> ends_with(k, 'a')) from orders"); + assertQuery("select count(1) FROM lineitem l left JOIN orders o ON l.orderkey = o.orderkey JOIN customer c ON o.custkey = c.custkey"); } @Test @@ -624,10 +625,6 @@ public void testNonOverriddenInlinedSqlInvokedFunctionsWhenConfigDisabled() "SELECT map_top_n_keys(MAP(ARRAY[regionkey], ARRAY[nationkey]), 5, (x, y) -> if (x < y, cast(1 as bigint), if (x > y, cast(-1 as bigint), cast(0 as bigint)))) from nation", ".*Scalar function native\\.default\\.map_top_n_keys not registered with arguments.*", true); - - assertQueryFails(session, - "select count(1) FROM lineitem l left JOIN orders o ON l.orderkey = o.orderkey JOIN customer c ON o.custkey = c.custkey", - ".*Scalar function name not registered: native.default.key_sampling_percent.*"); } @Test diff --git a/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSimpleSamplingPercent.java b/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSimpleSamplingPercent.java deleted file mode 100644 index a710391760714..0000000000000 --- a/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSimpleSamplingPercent.java +++ /dev/null @@ -1,33 +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. - */ -package com.facebook.presto.scalar.sql; - -import com.facebook.presto.spi.function.Description; -import com.facebook.presto.spi.function.SqlInvokedScalarFunction; -import com.facebook.presto.spi.function.SqlParameter; -import com.facebook.presto.spi.function.SqlType; - -public class NativeSimpleSamplingPercent -{ - private NativeSimpleSamplingPercent() {} - - @SqlInvokedScalarFunction(value = "key_sampling_percent", deterministic = true, calledOnNullInput = false) - @Description("Returns a value between 0.0 and 1.0 using the hash of the given input string") - @SqlParameter(name = "input", type = "varchar") - @SqlType("double") - public static String keySamplingPercent() - { - return "return (abs(from_ieee754_64(xxhash64(cast(input as varbinary)))) % 100) / 100. "; - } -} diff --git a/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSqlInvokedFunctionsPlugin.java b/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSqlInvokedFunctionsPlugin.java index 69d7ff1e78522..48857c7300216 100644 --- a/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSqlInvokedFunctionsPlugin.java +++ b/presto-sql-helpers/presto-native-sql-invoked-functions-plugin/src/main/java/com/facebook/presto/scalar/sql/NativeSqlInvokedFunctionsPlugin.java @@ -27,7 +27,6 @@ public Set> getSqlInvokedFunctions() return ImmutableSet.>builder() .add(NativeArraySqlFunctions.class) .add(NativeMapSqlFunctions.class) - .add(NativeSimpleSamplingPercent.class) .build(); } }