Skip to content

Commit ce093e2

Browse files
committed
Use switch statement
1 parent 2a1727a commit ce093e2

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

plugin/trino-singlestore/src/test/java/io/trino/plugin/singlestore/TestSingleStoreConnectorTest.java

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,34 +115,20 @@ protected Optional<DataMappingTestSetup> filterDataMappingSmokeTestData(DataMapp
115115
{
116116
String typeName = dataMappingTestSetup.getTrinoTypeName();
117117

118-
if (typeName.equals("boolean")) {
118+
return switch (typeName) {
119119
// SingleStore does not have built-in support for boolean type. SingleStore provides BOOLEAN as the synonym of TINYINT(1)
120120
// Querying the column with a boolean predicate subsequently fails with "Cannot apply operator: tinyint = boolean"
121-
return Optional.empty();
122-
}
123-
124-
if (typeName.equals("time")) {
121+
case "boolean" -> Optional.empty();
125122
// SingleStore supports only second precision
126123
// Skip 'time' that is alias of time(3) here and add test cases in TestSingleStoreTypeMapping.testTime instead
127-
return Optional.empty();
128-
}
129-
130-
if (typeName.equals("timestamp(3) with time zone") ||
131-
typeName.equals("timestamp(6) with time zone")) {
132-
return Optional.of(dataMappingTestSetup.asUnsupported());
133-
}
134-
135-
if (typeName.equals("timestamp")) {
124+
case "time" -> Optional.empty();
125+
case "timestamp(3) with time zone", "timestamp(6) with time zone" -> Optional.of(dataMappingTestSetup.asUnsupported());
136126
// TODO this should either work or fail cleanly
137-
return Optional.empty();
138-
}
139-
140-
if (typeName.equals("varchar")) {
127+
case "timestamp" -> Optional.empty();
141128
// TODO fails due to case insensitive UTF-8 comparisons
142-
return Optional.empty();
143-
}
144-
145-
return Optional.of(dataMappingTestSetup);
129+
case "varchar" -> Optional.empty();
130+
default -> Optional.of(dataMappingTestSetup);
131+
};
146132
}
147133

148134
@Test

0 commit comments

Comments
 (0)