Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanups #18783

Merged
merged 2 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static io.trino.cli.TestAlignedTablePrinter.rows;
import static org.testng.Assert.assertEquals;

@SuppressWarnings("Duplicates")
public class TestVerticalRecordPrinter
{
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ public void setTransactionIsolation(int level)
isolationLevel.set(level);
}

@SuppressWarnings("MagicConstant")
@Override
public int getTransactionIsolation()
throws SQLException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public boolean isNull()
return tokens[columnIndex].isEmpty();
}

@SuppressWarnings("SimplifiableConditionalExpression")
@Override
public boolean getBoolean()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,47 +52,27 @@ protected QueryRunner createQueryRunner()
return createAccumuloQueryRunner(ImmutableMap.of());
}

@SuppressWarnings("DuplicateBranchesInSwitch")
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_DELETE:
case SUPPORTS_UPDATE:
case SUPPORTS_MERGE:
return false;

case SUPPORTS_TOPN_PUSHDOWN:
return false;

case SUPPORTS_RENAME_SCHEMA:
case SUPPORTS_DROP_SCHEMA_CASCADE:
return false;

case SUPPORTS_CREATE_TABLE_WITH_TABLE_COMMENT:
case SUPPORTS_RENAME_TABLE_ACROSS_SCHEMAS:
return false;

case SUPPORTS_ADD_COLUMN:
case SUPPORTS_SET_COLUMN_TYPE:
return false;

case SUPPORTS_COMMENT_ON_TABLE:
case SUPPORTS_COMMENT_ON_COLUMN:
return false;

case SUPPORTS_CREATE_MATERIALIZED_VIEW:
return false;

case SUPPORTS_NOT_NULL_CONSTRAINT:
return false;

case SUPPORTS_ROW_TYPE:
return false;
martint marked this conversation as resolved.
Show resolved Hide resolved

default:
return super.hasBehavior(connectorBehavior);
}
return switch (connectorBehavior) {
case SUPPORTS_ADD_COLUMN,
SUPPORTS_COMMENT_ON_COLUMN,
SUPPORTS_COMMENT_ON_TABLE,
SUPPORTS_CREATE_MATERIALIZED_VIEW,
SUPPORTS_CREATE_TABLE_WITH_TABLE_COMMENT,
SUPPORTS_DELETE,
SUPPORTS_DROP_SCHEMA_CASCADE,
SUPPORTS_MERGE,
SUPPORTS_NOT_NULL_CONSTRAINT,
SUPPORTS_RENAME_SCHEMA,
SUPPORTS_RENAME_TABLE_ACROSS_SCHEMAS,
SUPPORTS_ROW_TYPE,
SUPPORTS_SET_COLUMN_TYPE,
SUPPORTS_TOPN_PUSHDOWN,
SUPPORTS_UPDATE -> false;
default -> super.hasBehavior(connectorBehavior);
};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ public boolean isNull(int field)
}
}

@SuppressWarnings("UnusedDeclaration")
@Override
public void close()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,18 @@ public void afterClass()
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_UPDATE: // not supported by any JDBC connector
case SUPPORTS_MERGE: // not supported by any JDBC connector
return false;

case SUPPORTS_CREATE_VIEW: // not supported by DefaultJdbcMetadata
case SUPPORTS_CREATE_MATERIALIZED_VIEW: // not supported by DefaultJdbcMetadata
return false;

case SUPPORTS_PREDICATE_EXPRESSION_PUSHDOWN:
// TODO support pushdown of complex expressions in predicates
return false;

case SUPPORTS_DYNAMIC_FILTER_PUSHDOWN:
// Dynamic filters can be pushed down only if predicate push down is supported.
// It is possible for a connector to have predicate push down support but not push down dynamic filters.
// TODO default SUPPORTS_DYNAMIC_FILTER_PUSHDOWN to SUPPORTS_PREDICATE_PUSHDOWN
return super.hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN);

default:
return super.hasBehavior(connectorBehavior);
}
return switch (connectorBehavior) {
case SUPPORTS_CREATE_MATERIALIZED_VIEW,
SUPPORTS_CREATE_VIEW,
SUPPORTS_MERGE,
SUPPORTS_PREDICATE_EXPRESSION_PUSHDOWN,
SUPPORTS_UPDATE -> false;
// Dynamic filters can be pushed down only if predicate push down is supported.
// It is possible for a connector to have predicate push down support but not push down dynamic filters.
// TODO default SUPPORTS_DYNAMIC_FILTER_PUSHDOWN to SUPPORTS_PREDICATE_PUSHDOWN
case SUPPORTS_DYNAMIC_FILTER_PUSHDOWN -> super.hasBehavior(SUPPORTS_PREDICATE_PUSHDOWN);
default -> super.hasBehavior(connectorBehavior);
};
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,23 @@ protected QueryRunner createQueryRunner()
return createH2QueryRunner(REQUIRED_TPCH_TABLES, properties);
}

@SuppressWarnings("DuplicateBranchesInSwitch")
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_LIMIT_PUSHDOWN:
case SUPPORTS_TOPN_PUSHDOWN:
case SUPPORTS_AGGREGATION_PUSHDOWN:
return false;

case SUPPORTS_CREATE_TABLE_WITH_TABLE_COMMENT:
case SUPPORTS_CREATE_TABLE_WITH_COLUMN_COMMENT:
case SUPPORTS_RENAME_TABLE_ACROSS_SCHEMAS:
return false;

case SUPPORTS_ADD_COLUMN_WITH_COMMENT:
return false;

case SUPPORTS_COMMENT_ON_TABLE:
case SUPPORTS_COMMENT_ON_COLUMN:
return false;

case SUPPORTS_ARRAY:
case SUPPORTS_ROW_TYPE:
return false;

default:
return super.hasBehavior(connectorBehavior);
}
return switch (connectorBehavior) {
case SUPPORTS_ADD_COLUMN_WITH_COMMENT,
SUPPORTS_AGGREGATION_PUSHDOWN,
SUPPORTS_ARRAY,
SUPPORTS_COMMENT_ON_COLUMN,
SUPPORTS_COMMENT_ON_TABLE,
SUPPORTS_CREATE_TABLE_WITH_COLUMN_COMMENT,
SUPPORTS_CREATE_TABLE_WITH_TABLE_COMMENT,
SUPPORTS_LIMIT_PUSHDOWN,
SUPPORTS_RENAME_TABLE_ACROSS_SCHEMAS,
SUPPORTS_ROW_TYPE,
SUPPORTS_TOPN_PUSHDOWN -> false;
default -> super.hasBehavior(connectorBehavior);
};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,19 @@
public abstract class BaseBigQueryConnectorSmokeTest
extends BaseConnectorSmokeTest
{
@SuppressWarnings("DuplicateBranchesInSwitch")
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_DELETE:
case SUPPORTS_UPDATE:
case SUPPORTS_MERGE:
return false;
case SUPPORTS_TRUNCATE:
return true;

case SUPPORTS_RENAME_TABLE:
case SUPPORTS_RENAME_SCHEMA:
return false;

case SUPPORTS_CREATE_VIEW:
case SUPPORTS_CREATE_MATERIALIZED_VIEW:
return false;

default:
return super.hasBehavior(connectorBehavior);
}
return switch (connectorBehavior) {
case SUPPORTS_TRUNCATE -> true;
case SUPPORTS_CREATE_MATERIALIZED_VIEW,
SUPPORTS_CREATE_VIEW,
SUPPORTS_DELETE,
SUPPORTS_MERGE,
SUPPORTS_RENAME_SCHEMA,
SUPPORTS_RENAME_TABLE,
SUPPORTS_UPDATE -> false;
default -> super.hasBehavior(connectorBehavior);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,46 +63,27 @@ public void initBigQueryExecutor(String gcpStorageBucket)
this.gcpStorageBucket = gcpStorageBucket;
}

@SuppressWarnings("DuplicateBranchesInSwitch")
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_DELETE:
case SUPPORTS_UPDATE:
case SUPPORTS_MERGE:
return false;
case SUPPORTS_TRUNCATE:
return true;

case SUPPORTS_TOPN_PUSHDOWN:
case SUPPORTS_DEREFERENCE_PUSHDOWN:
return false;

case SUPPORTS_RENAME_SCHEMA:
return false;

case SUPPORTS_RENAME_TABLE:
return false;

case SUPPORTS_ADD_COLUMN:
case SUPPORTS_RENAME_COLUMN:
case SUPPORTS_SET_COLUMN_TYPE:
return false;

case SUPPORTS_CREATE_VIEW:
case SUPPORTS_CREATE_MATERIALIZED_VIEW:
return false;

case SUPPORTS_NOT_NULL_CONSTRAINT:
return false;

case SUPPORTS_NEGATIVE_DATE:
return false;

default:
return super.hasBehavior(connectorBehavior);
}
return switch (connectorBehavior) {
case SUPPORTS_TRUNCATE -> true;
case SUPPORTS_ADD_COLUMN,
SUPPORTS_CREATE_MATERIALIZED_VIEW,
SUPPORTS_CREATE_VIEW,
SUPPORTS_DELETE,
SUPPORTS_DEREFERENCE_PUSHDOWN,
SUPPORTS_MERGE,
SUPPORTS_NEGATIVE_DATE,
SUPPORTS_NOT_NULL_CONSTRAINT,
SUPPORTS_RENAME_COLUMN,
SUPPORTS_RENAME_SCHEMA,
SUPPORTS_RENAME_TABLE,
SUPPORTS_SET_COLUMN_TYPE,
SUPPORTS_TOPN_PUSHDOWN,
SUPPORTS_UPDATE -> false;
default -> super.hasBehavior(connectorBehavior);
};
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,23 @@ public abstract class BaseCassandraConnectorSmokeTest
public static final String KEYSPACE = "smoke_test";
public static final ZonedDateTime TIMESTAMP_VALUE = ZonedDateTime.of(1970, 1, 1, 3, 4, 5, 0, ZoneId.of("UTC"));

@SuppressWarnings("DuplicateBranchesInSwitch")
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_TOPN_PUSHDOWN:
return false;

case SUPPORTS_CREATE_SCHEMA:
return false;

case SUPPORTS_RENAME_TABLE:
return false;

case SUPPORTS_COMMENT_ON_TABLE:
case SUPPORTS_COMMENT_ON_COLUMN:
return false;

case SUPPORTS_CREATE_VIEW:
case SUPPORTS_CREATE_MATERIALIZED_VIEW:
return false;

case SUPPORTS_UPDATE:
return false;
case SUPPORTS_DELETE:
return true;
case SUPPORTS_MERGE:
return false;

case SUPPORTS_ARRAY:
return false;

default:
return super.hasBehavior(connectorBehavior);
}
return switch (connectorBehavior) {
case SUPPORTS_DELETE -> true;
case SUPPORTS_ARRAY,
SUPPORTS_COMMENT_ON_COLUMN,
SUPPORTS_COMMENT_ON_TABLE,
SUPPORTS_CREATE_MATERIALIZED_VIEW,
SUPPORTS_CREATE_SCHEMA,
SUPPORTS_CREATE_VIEW,
SUPPORTS_MERGE,
SUPPORTS_RENAME_TABLE,
SUPPORTS_TOPN_PUSHDOWN,
SUPPORTS_UPDATE -> false;
default -> super.hasBehavior(connectorBehavior);
};
}

@Override
Expand Down
Loading