From d27c8d90c0165e643497dfb631990ff7e21005d5 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 31 Mar 2023 11:11:57 +0200 Subject: [PATCH] Simplify TestingConnectorBehavior declarations Use `true` or a related behavior as the default rather than `false`. Few cases being off by default remain, but generally true as the default is much easier to reason about. False defaults were usually a result of incremental additions, where it's easier to add a behavior that is not widely adopted, but are harder to think about in a long run. --- .../testing/TestingConnectorBehavior.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java b/testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java index 03e4611c149..b727323af35 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/TestingConnectorBehavior.java @@ -37,13 +37,12 @@ public enum TestingConnectorBehavior SUPPORTS_TOPN_PUSHDOWN_WITH_VARCHAR(fallback -> fallback.test(SUPPORTS_TOPN_PUSHDOWN) && fallback.test(SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY)), SUPPORTS_AGGREGATION_PUSHDOWN, - // Most connectors don't support aggregation pushdown for statistical functions - SUPPORTS_AGGREGATION_PUSHDOWN_STDDEV(false), - SUPPORTS_AGGREGATION_PUSHDOWN_VARIANCE(false), - SUPPORTS_AGGREGATION_PUSHDOWN_COVARIANCE(false), - SUPPORTS_AGGREGATION_PUSHDOWN_CORRELATION(false), - SUPPORTS_AGGREGATION_PUSHDOWN_REGRESSION(false), - SUPPORTS_AGGREGATION_PUSHDOWN_COUNT_DISTINCT(false), + SUPPORTS_AGGREGATION_PUSHDOWN_STDDEV(SUPPORTS_AGGREGATION_PUSHDOWN), + SUPPORTS_AGGREGATION_PUSHDOWN_VARIANCE(SUPPORTS_AGGREGATION_PUSHDOWN), + SUPPORTS_AGGREGATION_PUSHDOWN_COVARIANCE(SUPPORTS_AGGREGATION_PUSHDOWN), + SUPPORTS_AGGREGATION_PUSHDOWN_CORRELATION(SUPPORTS_AGGREGATION_PUSHDOWN), + SUPPORTS_AGGREGATION_PUSHDOWN_REGRESSION(SUPPORTS_AGGREGATION_PUSHDOWN), + SUPPORTS_AGGREGATION_PUSHDOWN_COUNT_DISTINCT(SUPPORTS_AGGREGATION_PUSHDOWN), SUPPORTS_JOIN_PUSHDOWN( // Currently no connector supports Join pushdown by default. JDBC connectors may support Join pushdown and BaseJdbcConnectorTest @@ -73,13 +72,13 @@ public enum TestingConnectorBehavior SUPPORTS_SET_COLUMN_TYPE, SUPPORTS_COMMENT_ON_TABLE, - SUPPORTS_COMMENT_ON_VIEW(false), - SUPPORTS_COMMENT_ON_COLUMN, - SUPPORTS_COMMENT_ON_VIEW_COLUMN(false), + SUPPORTS_COMMENT_ON_COLUMN(SUPPORTS_COMMENT_ON_TABLE), + SUPPORTS_COMMENT_ON_VIEW(SUPPORTS_COMMENT_ON_TABLE), + SUPPORTS_COMMENT_ON_VIEW_COLUMN(SUPPORTS_COMMENT_ON_VIEW), - SUPPORTS_CREATE_VIEW(false), + SUPPORTS_CREATE_VIEW, - SUPPORTS_CREATE_MATERIALIZED_VIEW(false), + SUPPORTS_CREATE_MATERIALIZED_VIEW, SUPPORTS_CREATE_MATERIALIZED_VIEW_GRACE_PERIOD(SUPPORTS_CREATE_MATERIALIZED_VIEW), SUPPORTS_CREATE_FEDERATED_MATERIALIZED_VIEW(SUPPORTS_CREATE_MATERIALIZED_VIEW), // i.e. an MV that spans catalogs SUPPORTS_RENAME_MATERIALIZED_VIEW(SUPPORTS_CREATE_MATERIALIZED_VIEW), @@ -88,14 +87,15 @@ public enum TestingConnectorBehavior SUPPORTS_INSERT, SUPPORTS_NOT_NULL_CONSTRAINT(SUPPORTS_CREATE_TABLE), - SUPPORTS_DELETE(false), + SUPPORTS_MERGE, + + SUPPORTS_DELETE(SUPPORTS_MERGE), SUPPORTS_ROW_LEVEL_DELETE(SUPPORTS_DELETE), - SUPPORTS_UPDATE(false), + SUPPORTS_UPDATE(SUPPORTS_MERGE), - SUPPORTS_MERGE(false), - SUPPORTS_TRUNCATE(false), + SUPPORTS_TRUNCATE(SUPPORTS_DELETE), SUPPORTS_NEGATIVE_DATE,