diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddExchanges.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddExchanges.java index b099f7766621..763f31c0b10e 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddExchanges.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddExchanges.java @@ -32,6 +32,7 @@ import com.facebook.presto.spi.plan.DistinctLimitNode; import com.facebook.presto.spi.plan.EquiJoinClause; import com.facebook.presto.spi.plan.FilterNode; +import com.facebook.presto.spi.plan.InputDistribution; import com.facebook.presto.spi.plan.JoinDistributionType; import com.facebook.presto.spi.plan.JoinNode; import com.facebook.presto.spi.plan.LimitNode; @@ -545,7 +546,7 @@ public PlanWithProperties visitDelete(DeleteNode node, PreferredProperties prefe if (!node.getInputDistribution().isPresent()) { return visitPlan(node, preferredProperties); } - DeleteNode.InputDistribution inputDistribution = node.getInputDistribution().get(); + InputDistribution inputDistribution = node.getInputDistribution().get(); List> desiredProperties = new ArrayList<>(); if (!inputDistribution.getPartitionBy().isEmpty()) { desiredProperties.add(new GroupingProperty<>(inputDistribution.getPartitionBy())); diff --git a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java index ebec1d015029..deb048c7709e 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddLocalExchanges.java @@ -25,6 +25,7 @@ import com.facebook.presto.spi.plan.DeleteNode; import com.facebook.presto.spi.plan.DistinctLimitNode; import com.facebook.presto.spi.plan.EquiJoinClause; +import com.facebook.presto.spi.plan.InputDistribution; import com.facebook.presto.spi.plan.JoinNode; import com.facebook.presto.spi.plan.LimitNode; import com.facebook.presto.spi.plan.MarkDistinctNode; @@ -467,7 +468,7 @@ public PlanWithProperties visitDelete(DeleteNode node, StreamPreferredProperties if (!node.getInputDistribution().isPresent()) { return visitPlan(node, parentPreferences); } - DeleteNode.InputDistribution inputDistribution = node.getInputDistribution().get(); + InputDistribution inputDistribution = node.getInputDistribution().get(); StreamPreferredProperties childRequirements = parentPreferences .constrainTo(node.getSource().getOutputVariables()) .withDefaultParallelism(session) 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 60b9a0a601e6..468f9695861e 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 @@ -625,6 +625,10 @@ void to_json(json& j, const std::shared_ptr& p) { j = *std::static_pointer_cast(p); return; } + if (type == ".DeleteNode") { + j = *std::static_pointer_cast(p); + return; + } if (type == ".DistinctLimitNode") { j = *std::static_pointer_cast(p); return; @@ -745,6 +749,12 @@ void from_json(const json& j, std::shared_ptr& p) { p = std::static_pointer_cast(k); return; } + if (type == ".DeleteNode") { + std::shared_ptr k = std::make_shared(); + j.get_to(*k); + p = std::static_pointer_cast(k); + return; + } if (type == ".DistinctLimitNode") { std::shared_ptr k = std::make_shared(); @@ -1210,6 +1220,62 @@ void from_json(const json& j, Assignments& p) { } } // namespace facebook::presto::protocol namespace facebook::presto::protocol { +BaseInputDistribution::BaseInputDistribution() noexcept { + _type = ".BaseInputDistribution"; +} + +void to_json(json& j, const BaseInputDistribution& p) { + j = json::object(); + j["@type"] = ".BaseInputDistribution"; + to_json_key( + j, + "partitionBy", + p.partitionBy, + "BaseInputDistribution", + "List", + "partitionBy"); + to_json_key( + j, + "orderingScheme", + p.orderingScheme, + "BaseInputDistribution", + "OrderingScheme", + "orderingScheme"); + to_json_key( + j, + "inputVariables", + p.inputVariables, + "BaseInputDistribution", + "List", + "inputVariables"); +} + +void from_json(const json& j, BaseInputDistribution& p) { + p._type = j["@type"]; + from_json_key( + j, + "partitionBy", + p.partitionBy, + "BaseInputDistribution", + "List", + "partitionBy"); + from_json_key( + j, + "orderingScheme", + p.orderingScheme, + "BaseInputDistribution", + "OrderingScheme", + "orderingScheme"); + from_json_key( + j, + "inputVariables", + p.inputVariables, + "BaseInputDistribution", + "List", + "inputVariables"); +} +} // namespace facebook::presto::protocol +namespace facebook::presto::protocol { // Loosly copied this here from NLOHMANN_JSON_SERIALIZE_ENUM() // NOLINTNEXTLINE: cppcoreguidelines-avoid-c-arrays @@ -3191,6 +3257,101 @@ void from_json(const json& j, DeleteHandle& p) { } } // namespace facebook::presto::protocol namespace facebook::presto::protocol { +void to_json(json& j, const std::shared_ptr& p) { + if (p == nullptr) { + return; + } + String type = p->_type; + + if (type == ".BaseInputDistribution") { + j = *std::static_pointer_cast(p); + return; + } + + throw TypeError(type + " no abstract type InputDistribution "); +} + +void from_json(const json& j, std::shared_ptr& p) { + String type; + try { + type = p->getSubclassKey(j); + } catch (json::parse_error& e) { + throw ParseError( + std::string(e.what()) + " InputDistribution InputDistribution"); + } + + if (type == ".BaseInputDistribution") { + std::shared_ptr k = + std::make_shared(); + j.get_to(*k); + p = std::static_pointer_cast(k); + return; + } + + throw TypeError(type + " no abstract type InputDistribution "); +} +} // namespace facebook::presto::protocol +namespace facebook::presto::protocol { +DeleteNode::DeleteNode() noexcept { + _type = ".DeleteNode"; +} + +void to_json(json& j, const DeleteNode& p) { + j = json::object(); + j["@type"] = ".DeleteNode"; + to_json_key(j, "id", p.id, "DeleteNode", "PlanNodeId", "id"); + to_json_key(j, "source", p.source, "DeleteNode", "PlanNode", "source"); + to_json_key( + j, + "rowId", + p.rowId, + "DeleteNode", + "VariableReferenceExpression", + "rowId"); + to_json_key( + j, + "outputVariables", + p.outputVariables, + "DeleteNode", + "List", + "outputVariables"); + to_json_key( + j, + "inputDistribution", + p.inputDistribution, + "DeleteNode", + "InputDistribution", + "inputDistribution"); +} + +void from_json(const json& j, DeleteNode& p) { + p._type = j["@type"]; + from_json_key(j, "id", p.id, "DeleteNode", "PlanNodeId", "id"); + from_json_key(j, "source", p.source, "DeleteNode", "PlanNode", "source"); + from_json_key( + j, + "rowId", + p.rowId, + "DeleteNode", + "VariableReferenceExpression", + "rowId"); + from_json_key( + j, + "outputVariables", + p.outputVariables, + "DeleteNode", + "List", + "outputVariables"); + from_json_key( + j, + "inputDistribution", + p.inputDistribution, + "DeleteNode", + "InputDistribution", + "inputDistribution"); +} +} // namespace facebook::presto::protocol +namespace facebook::presto::protocol { DistinctLimitNode::DistinctLimitNode() noexcept { _type = ".DistinctLimitNode"; } @@ -8690,6 +8851,13 @@ void to_json(json& j, const SortNode& p) { "OrderingScheme", "orderingScheme"); to_json_key(j, "isPartial", p.isPartial, "SortNode", "bool", "isPartial"); + to_json_key( + j, + "partitionBy", + p.partitionBy, + "SortNode", + "List", + "partitionBy"); } void from_json(const json& j, SortNode& p) { @@ -8704,6 +8872,13 @@ void from_json(const json& j, SortNode& p) { "OrderingScheme", "orderingScheme"); from_json_key(j, "isPartial", p.isPartial, "SortNode", "bool", "isPartial"); + from_json_key( + j, + "partitionBy", + p.partitionBy, + "SortNode", + "List", + "partitionBy"); } } // namespace facebook::presto::protocol namespace facebook::presto::protocol { 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 902c0c24ce5a..4736dde15721 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 @@ -67,21 +67,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; @@ -313,6 +313,11 @@ void to_json(json& j, const std::shared_ptr& p); void from_json(const json& j, std::shared_ptr& p); } // namespace facebook::presto::protocol namespace facebook::presto::protocol { +struct InputDistribution : public JsonEncodedSubclass {}; +void to_json(json& j, const std::shared_ptr& p); +void from_json(const json& j, std::shared_ptr& p); +} // namespace facebook::presto::protocol +namespace facebook::presto::protocol { struct ValueSet : public JsonEncodedSubclass {}; void to_json(json& j, const std::shared_ptr& p); void from_json(const json& j, std::shared_ptr& p); @@ -524,6 +529,17 @@ void to_json(json& j, const Assignments& p); void from_json(const json& j, Assignments& p); } // namespace facebook::presto::protocol namespace facebook::presto::protocol { +struct BaseInputDistribution : public InputDistribution { + List partitionBy = {}; + std::shared_ptr orderingScheme = {}; + List inputVariables = {}; + + BaseInputDistribution() noexcept; +}; +void to_json(json& j, const BaseInputDistribution& p); +void from_json(const json& j, BaseInputDistribution& p); +} // namespace facebook::presto::protocol +namespace facebook::presto::protocol { enum class BufferType { PARTITIONED, BROADCAST, @@ -1020,6 +1036,18 @@ void to_json(json& j, const DeleteHandle& p); void from_json(const json& j, DeleteHandle& p); } // namespace facebook::presto::protocol namespace facebook::presto::protocol { +struct DeleteNode : public PlanNode { + std::shared_ptr source = {}; + VariableReferenceExpression rowId = {}; + List outputVariables = {}; + std::shared_ptr inputDistribution = {}; + + DeleteNode() noexcept; +}; +void to_json(json& j, const DeleteNode& p); +void from_json(const json& j, DeleteNode& p); +} // namespace facebook::presto::protocol +namespace facebook::presto::protocol { struct DistinctLimitNode : public PlanNode { std::shared_ptr source = {}; int64_t limit = {}; @@ -2025,6 +2053,7 @@ struct SortNode : public PlanNode { std::shared_ptr source = {}; OrderingScheme orderingScheme = {}; bool isPartial = {}; + List partitionBy = {}; SortNode() noexcept; }; diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml index ae0222da2e67..0b3a3fdbcafc 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml @@ -124,11 +124,17 @@ AbstractClasses: - { name: InsertHandle, key: InsertHandle } - { name: DeleteHandle, key: DeleteHandle } + InputDistribution: + super: JsonEncodedSubclass + subclasses: + - { name: BaseInputDistribution, key: .BaseInputDistribution } + PlanNode: super: JsonEncodedSubclass subclasses: - { name: AggregationNode, key: .AggregationNode } - { name: GroupIdNode, key: com.facebook.presto.sql.planner.plan.GroupIdNode } + - { name: DeleteNode, key: .DeleteNode } - { name: DistinctLimitNode, key: .DistinctLimitNode } - { name: EnforceSingleRowNode, key: com.facebook.presto.sql.planner.plan.EnforceSingleRowNode } - { name: ExchangeNode, key: com.facebook.presto.sql.planner.plan.ExchangeNode } @@ -318,3 +324,5 @@ JavaClasses: - presto-spi/src/main/java/com/facebook/presto/spi/plan/ExchangeEncoding.java - presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/nativechecker/PlanConversionFailureInfo.java - presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/nativechecker/PlanConversionResponse.java + - presto-spi/src/main/java/com/facebook/presto/spi/plan/DeleteNode.java + - presto-spi/src/main/java/com/facebook/presto/spi/plan/BaseInputDistribution.java diff --git a/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.yml b/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.yml index 18c9afda02ec..04b6ad016b19 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.yml +++ b/presto-native-execution/presto_cpp/presto_protocol/presto_protocol.yml @@ -123,11 +123,17 @@ AbstractClasses: - { name: InsertHandle, key: InsertHandle } - { name: DeleteHandle, key: DeleteHandle } + InputDistribution: + super: JsonEncodedSubclass + subclasses: + - { name: BaseInputDistribution, key: BaseInputDistribution } + PlanNode: super: JsonEncodedSubclass subclasses: - { name: AggregationNode, key: .AggregationNode } - { name: GroupIdNode, key: com.facebook.presto.sql.planner.plan.GroupIdNode } + - { name: DeleteNode, key: .DeleteNode } - { name: DistinctLimitNode, key: .DistinctLimitNode } - { name: EnforceSingleRowNode, key: com.facebook.presto.sql.planner.plan.EnforceSingleRowNode } - { name: ExchangeNode, key: com.facebook.presto.sql.planner.plan.ExchangeNode } @@ -365,3 +371,5 @@ JavaClasses: - presto-main/src/main/java/com/facebook/presto/connector/system/SystemTransactionHandle.java - presto-spi/src/main/java/com/facebook/presto/spi/function/AggregationFunctionMetadata.java - presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/json/JsonBasedUdfFunctionMetadata.java + - presto-spi/src/main/java/com/facebook/presto/spi/plan/DeleteNode.java + - presto-spi/src/main/java/com/facebook/presto/spi/plan/BaseInputDistribution.java diff --git a/presto-native-execution/presto_cpp/presto_protocol/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/presto_protocol/tests/CMakeLists.txt index 311ee0e24d5f..893ab732a597 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/presto_protocol/tests/CMakeLists.txt @@ -16,6 +16,7 @@ add_executable( CallExpressionTest.cpp ConstantExpressionTest.cpp DataSizeTest.cpp + DeleteTest.cpp DomainTest.cpp DurationTest.cpp LifespanTest.cpp diff --git a/presto-native-execution/presto_cpp/presto_protocol/tests/DeleteTest.cpp b/presto-native-execution/presto_cpp/presto_protocol/tests/DeleteTest.cpp new file mode 100644 index 000000000000..e8efce93b0ff --- /dev/null +++ b/presto-native-execution/presto_cpp/presto_protocol/tests/DeleteTest.cpp @@ -0,0 +1,111 @@ +/* +* 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. +*/ +#include + +#include "presto_cpp/main/common/tests/test_json.h" + +using namespace facebook::presto::protocol; + +using namespace ::testing; + +class DeleteTest : public ::testing::Test {}; + +TEST_F(DeleteTest, TestJsonRoundtrip) { + std::string str = R"( + { + "@type" : ".DeleteNode", + "id" : "0", + "source" : { + "@type" : ".ValuesNode", + "id" : "1", + "outputVariables" : [ { + "@type" : "variable", + "name" : "$row_group_id", + "type" : "varchar" + }, { + "@type" : "variable", + "name" : "$row_number", + "type" : "bigint" + } ], + "rows" : [ [ { + "@type" : "constant", + "valueBlock" : "DgAAAFZBUklBQkxFX1dJRFRIAQAAAAUAAAAABQAAAGFiY2Rl", + "type" : "varchar" + }, { + "@type" : "constant", + "valueBlock" : "CgAAAExPTkdfQVJSQVkBAAAAAAEAAAAAAAAA", + "type" : "bigint" + } ] ] + }, + "rowId" : { + "@type" : "variable", + "name" : "$rowid", + "type" : "varbinary" + }, + "outputVariables" : [ { + "@type" : "variable", + "name" : "$row_group_id", + "type" : "varchar" + }, { + "@type" : "variable", + "name" : "$row_number", + "type" : "bigint" + } ], + "inputDistribution" : { + "@type" : ".BaseInputDistribution", + "partitionBy" : [ { + "@type" : "variable", + "name" : "part_key", + "type" : "varchar" + } ], + "inputVariables" : [ { + "@type" : "variable", + "name" : "filter_key", + "type" : "bigint" + }, { + "@type" : "variable", + "name" : "$row_group_id", + "type" : "varchar" + }, { + "@type" : "variable", + "name" : "$row_number", + "type" : "bigint" + } ] + } + } + )"; + + json j = json::parse(str); + DeleteNode d = j; + + // Check some values ... + ASSERT_NE(d.inputDistribution, nullptr); + ASSERT_EQ(d.inputDistribution->_type, ".BaseInputDistribution"); + + auto inputDistribution = + std::static_pointer_cast(d.inputDistribution); + ASSERT_EQ(inputDistribution->partitionBy[0].name, "part_key"); + ASSERT_EQ(inputDistribution->inputVariables.size(), 3); + ASSERT_EQ(inputDistribution->inputVariables[0].name, "filter_key"); + ASSERT_EQ(inputDistribution->inputVariables[1].name, "$row_group_id"); + ASSERT_EQ(inputDistribution->inputVariables[2].name, "$row_number"); + + ASSERT_EQ(d.outputVariables.size(), 2); + ASSERT_EQ(d.outputVariables[0].name, "$row_group_id"); + ASSERT_EQ(d.outputVariables[1].name, "$row_number"); + + ASSERT_EQ(d.rowId.name, "$rowid"); + + testJsonRoundtrip(j, d); +} diff --git a/presto-native-execution/velox b/presto-native-execution/velox index 12942c1eb76d..01e755ccca67 160000 --- a/presto-native-execution/velox +++ b/presto-native-execution/velox @@ -1 +1 @@ -Subproject commit 12942c1eb76de019b775f4b207bc4595d8ace5c0 +Subproject commit 01e755ccca671bcfa9c78f4a251a4494c4170c7f diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/plan/BaseInputDistribution.java b/presto-spi/src/main/java/com/facebook/presto/spi/plan/BaseInputDistribution.java new file mode 100644 index 000000000000..bce81f2b3a19 --- /dev/null +++ b/presto-spi/src/main/java/com/facebook/presto/spi/plan/BaseInputDistribution.java @@ -0,0 +1,63 @@ +/* + * 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.spi.plan; + +import com.facebook.presto.spi.relation.VariableReferenceExpression; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Optional; + +import static java.util.Objects.requireNonNull; + +public class BaseInputDistribution + implements InputDistribution +{ + private final List partitionedBy; + private final Optional orderingScheme; + private final List inputVariables; + + @JsonCreator + public BaseInputDistribution( + @JsonProperty("partitionBy") List partitionedBy, + @JsonProperty("orderingScheme") Optional orderingScheme, + @JsonProperty("inputVariables") List inputVariables) + { + this.partitionedBy = requireNonNull(partitionedBy, "partitionedBy is null"); + this.orderingScheme = requireNonNull(orderingScheme, "orderingScheme is null"); + this.inputVariables = requireNonNull(inputVariables, "inputVariables is null"); + } + + @JsonProperty + @Override + public List getPartitionBy() + { + return partitionedBy; + } + + @JsonProperty + @Override + public Optional getOrderingScheme() + { + return orderingScheme; + } + + @JsonProperty + @Override + public List getInputVariables() + { + return inputVariables; + } +} diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/plan/DeleteNode.java b/presto-spi/src/main/java/com/facebook/presto/spi/plan/DeleteNode.java index 70d7ae0cee9a..f5e713eaab67 100644 --- a/presto-spi/src/main/java/com/facebook/presto/spi/plan/DeleteNode.java +++ b/presto-spi/src/main/java/com/facebook/presto/spi/plan/DeleteNode.java @@ -115,22 +115,4 @@ public PlanNode assignStatsEquivalentPlanNode(Optional statsEquivalent { return new DeleteNode(getSourceLocation(), getId(), statsEquivalentPlanNode, source, rowId, outputVariables, inputDistribution); } - - public interface InputDistribution - { - default List getPartitionBy() - { - return Collections.emptyList(); - } - - default Optional getOrderingScheme() - { - return Optional.empty(); - } - - default List getInputVariables() - { - return Collections.emptyList(); - } - } } diff --git a/presto-spi/src/main/java/com/facebook/presto/spi/plan/InputDistribution.java b/presto-spi/src/main/java/com/facebook/presto/spi/plan/InputDistribution.java new file mode 100644 index 000000000000..e0afef4a44d6 --- /dev/null +++ b/presto-spi/src/main/java/com/facebook/presto/spi/plan/InputDistribution.java @@ -0,0 +1,40 @@ +/* + * 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.spi.plan; + +import com.facebook.presto.spi.relation.VariableReferenceExpression; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +@JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS, property = "@type") +public interface InputDistribution +{ + default List getPartitionBy() + { + return Collections.emptyList(); + } + + default Optional getOrderingScheme() + { + return Optional.empty(); + } + + default List getInputVariables() + { + return Collections.emptyList(); + } +}