Skip to content

Commit 188a393

Browse files
committed
Update SingleStore JDBC driver to 1.2.4
According to https://docs.singlestore.com/cloud/developer-resources/connect-with-application-development-tools/connect-with-java-jdbc/the-singlestore-jdbc-driver/ this version supports 8.0-8.5 lines. 8.0 will reach EOL by December 2024.
1 parent ce093e2 commit 188a393

File tree

4 files changed

+31
-82
lines changed

4 files changed

+31
-82
lines changed

plugin/trino-singlestore/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<dependency>
2828
<groupId>com.singlestore</groupId>
2929
<artifactId>singlestore-jdbc-client</artifactId>
30-
<version>1.2.3</version>
30+
<version>1.2.4</version>
3131
</dependency>
3232

3333
<dependency>

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

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
8383
SUPPORTS_RENAME_SCHEMA,
8484
SUPPORTS_RENAME_TABLE_ACROSS_SCHEMAS,
8585
SUPPORTS_ROW_TYPE,
86+
SUPPORTS_NEGATIVE_DATE,
8687
SUPPORTS_SET_COLUMN_TYPE -> false;
8788
default -> super.hasBehavior(connectorBehavior);
8889
};
@@ -114,14 +115,15 @@ protected TestTable createTableWithUnsupportedColumn()
114115
protected Optional<DataMappingTestSetup> filterDataMappingSmokeTestData(DataMappingTestSetup dataMappingTestSetup)
115116
{
116117
String typeName = dataMappingTestSetup.getTrinoTypeName();
117-
118118
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"
121121
case "boolean" -> Optional.empty();
122122
// SingleStore supports only second precision
123123
// Skip 'time' that is alias of time(3) here and add test cases in TestSingleStoreTypeMapping.testTime instead
124124
case "time" -> Optional.empty();
125+
// https://docs.singlestore.com/cloud/reference/sql-reference/data-types/time-and-date/
126+
case "date" -> Optional.of(new DataMappingTestSetup(dataMappingTestSetup.getTrinoTypeName(), "DATE '1000-01-01'", "DATE '9999-12-31'"));
125127
case "timestamp(3) with time zone", "timestamp(6) with time zone" -> Optional.of(dataMappingTestSetup.asUnsupported());
126128
// TODO this should either work or fail cleanly
127129
case "timestamp" -> Optional.empty();
@@ -177,6 +179,14 @@ public void testNameEscaping()
177179
assertThat(getQueryRunner().tableExists(getSession(), "test_table")).isFalse();
178180
}
179181

182+
@Test
183+
@Override
184+
public void testDateYearOfEraPredicate()
185+
{
186+
assertThatThrownBy(super::testDateYearOfEraPredicate)
187+
.hasMessageContaining("Invalid DATE/TIME in type conversion");
188+
}
189+
180190
@Test
181191
public void testSingleStoreTinyint()
182192
{
@@ -311,24 +321,6 @@ public void testPredicatePushdown()
311321
.isNotFullyPushedDown(AggregationNode.class);
312322
}
313323

314-
@Test
315-
@Override
316-
public void testCreateTableAsSelectNegativeDate()
317-
{
318-
// TODO (https://github.com/trinodb/trino/issues/10320) SingleStore stores '0000-00-00' when inserted negative dates and it throws an exception during reading the row
319-
assertThatThrownBy(super::testCreateTableAsSelectNegativeDate)
320-
.hasStackTraceContaining("TrinoException: Driver returned null LocalDate for a non-null value");
321-
}
322-
323-
@Test
324-
@Override
325-
public void testInsertNegativeDate()
326-
{
327-
// TODO (https://github.com/trinodb/trino/issues/10320) SingleStore stores '0000-00-00' when inserted negative dates and it throws an exception during reading the row
328-
assertThatThrownBy(super::testInsertNegativeDate)
329-
.hasStackTraceContaining("TrinoException: Driver returned null LocalDate for a non-null value");
330-
}
331-
332324
@Test
333325
@Override
334326
public void testNativeQueryCreateStatement()
@@ -397,7 +389,7 @@ protected OptionalInt maxSchemaNameLength()
397389
protected void verifySchemaNameLengthFailurePermissible(Throwable e)
398390
{
399391
// The error message says 60 char, but the actual limitation is 62
400-
assertThat(e).hasMessageContaining("Distributed MemSQL requires the length of the database name to be at most 60 characters");
392+
assertThat(e).hasMessageContaining("Distributed SingleStore requires the length of the database name to be at most 60 characters");
401393
}
402394

403395
@Override
@@ -424,6 +416,18 @@ protected void verifyColumnNameLengthFailurePermissible(Throwable e)
424416
assertThat(e).hasMessageMatching(".*Identifier name '.*' is too long");
425417
}
426418

419+
@Override
420+
protected String errorMessageForInsertNegativeDate(String date)
421+
{
422+
return ".*Invalid DATE/TIME in type conversion";
423+
}
424+
425+
@Override
426+
protected String errorMessageForCreateTableAsSelectNegativeDate(String date)
427+
{
428+
return ".*Invalid DATE/TIME in type conversion";
429+
}
430+
427431
@Override
428432
protected SqlExecutor onRemoteDatabase()
429433
{

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

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@
2222

2323
import java.time.ZoneId;
2424

25-
import static io.trino.spi.type.BigintType.BIGINT;
2625
import static io.trino.spi.type.DateType.DATE;
27-
import static io.trino.spi.type.IntegerType.INTEGER;
28-
import static io.trino.spi.type.SmallintType.SMALLINT;
29-
import static io.trino.spi.type.TinyintType.TINYINT;
30-
import static io.trino.spi.type.VarcharType.createVarcharType;
3126
import static java.time.ZoneOffset.UTC;
3227

3328
final class TestSingleStoreTypeMapping
@@ -41,46 +36,6 @@ protected QueryRunner createQueryRunner()
4136
return SingleStoreQueryRunner.builder(singleStoreServer).build();
4237
}
4338

44-
@Test
45-
void testUnsupportedTinyint()
46-
{
47-
// SingleStore stores incorrect results when the values are out of supported range. This test should be fixed when SingleStore changes the behavior.
48-
SqlDataTypeTest.create()
49-
.addRoundTrip("tinyint", "-129", TINYINT, "TINYINT '-128'")
50-
.addRoundTrip("tinyint", "128", TINYINT, "TINYINT '127'")
51-
.execute(getQueryRunner(), singleStoreCreateAndInsert("tpch.test_unsupported_tinyint"));
52-
}
53-
54-
@Test
55-
void testUnsupportedSmallint()
56-
{
57-
// SingleStore stores incorrect results when the values are out of supported range. This test should be fixed when SingleStore changes the behavior.
58-
SqlDataTypeTest.create()
59-
.addRoundTrip("smallint", "-32769", SMALLINT, "SMALLINT '-32768'")
60-
.addRoundTrip("smallint", "32768", SMALLINT, "SMALLINT '32767'")
61-
.execute(getQueryRunner(), singleStoreCreateAndInsert("tpch.test_unsupported_smallint"));
62-
}
63-
64-
@Test
65-
void testUnsupportedInteger()
66-
{
67-
// SingleStore stores incorrect results when the values are out of supported range. This test should be fixed when SingleStore changes the behavior.
68-
SqlDataTypeTest.create()
69-
.addRoundTrip("integer", "-2147483649", INTEGER, "INTEGER '-2147483648'")
70-
.addRoundTrip("integer", "2147483648", INTEGER, "INTEGER '2147483647'")
71-
.execute(getQueryRunner(), singleStoreCreateAndInsert("tpch.test_unsupported_integer"));
72-
}
73-
74-
@Test
75-
void testUnsupportedBigint()
76-
{
77-
// SingleStore stores incorrect results when the values are out of supported range. This test should be fixed when SingleStore changes the behavior.
78-
SqlDataTypeTest.create()
79-
.addRoundTrip("bigint", "-9223372036854775809", BIGINT, "BIGINT '-9223372036854775808'")
80-
.addRoundTrip("bigint", "9223372036854775808", BIGINT, "BIGINT '9223372036854775807'")
81-
.execute(getQueryRunner(), singleStoreCreateAndInsert("tpch.test_unsupported_bigint"));
82-
}
83-
8439
@Test
8540
void testOlderDate()
8641
{
@@ -100,21 +55,12 @@ private void testOlderDate(ZoneId sessionZone)
10055
.build();
10156

10257
SqlDataTypeTest.create()
103-
.addRoundTrip("date", "CAST('0000-01-01' AS date)", DATE, "DATE '0000-01-01'")
104-
.addRoundTrip("date", "CAST('0001-01-01' AS date)", DATE, "DATE '0001-01-01'")
58+
.addRoundTrip("date", "CAST('1000-01-01' AS date)", DATE, "DATE '1000-01-01'")
59+
.addRoundTrip("date", "CAST('1000-01-01' AS date)", DATE, "DATE '1000-01-01'")
10560
.execute(getQueryRunner(), session, singleStoreCreateAndInsert("tpch.test_date"))
10661
.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_date"))
10762
.execute(getQueryRunner(), session, trinoCreateAsSelect("test_date"))
10863
.execute(getQueryRunner(), session, trinoCreateAndInsert(session, "test_date"))
10964
.execute(getQueryRunner(), session, trinoCreateAndInsert("test_date"));
11065
}
111-
112-
@Test
113-
void testSingleStoreCreatedParameterizedVarcharUnicodeEmoji()
114-
{
115-
// SingleStore version >= 7.5 supports utf8mb4, but older versions store an empty character for a 4 bytes character
116-
SqlDataTypeTest.create()
117-
.addRoundTrip("varchar(1) " + CHARACTER_SET_UTF8, "'😂'", createVarcharType(1), "CAST('' AS varchar(1))")
118-
.execute(getQueryRunner(), singleStoreCreateAndInsert("tpch.singlestore_test_parameterized_varchar_unicode"));
119-
}
12066
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public class TestingSingleStoreServer
3030
{
3131
private static final String MEM_SQL_LICENSE = requiredNonEmptySystemProperty("memsql.license");
3232

33-
public static final String DEFAULT_TAG = "memsql/cluster-in-a-box:centos-7.1.13-11ddea2a3a-3.0.0-1.9.0";
34-
public static final String LATEST_TESTED_TAG = "memsql/cluster-in-a-box:alma-8.0.4-c190bb9c08-4.0.10-1.14.4";
33+
public static final String DEFAULT_TAG = "memsql/cluster-in-a-box:alma-8.0.19-f48780d261-4.0.11-1.16.0";
34+
public static final String LATEST_TESTED_TAG = "memsql/cluster-in-a-box:alma-8.5.22-fe61f40cd1-4.1.0-1.17.11";
3535

3636
public static final Integer SINGLESTORE_PORT = 3306;
3737

@@ -44,14 +44,13 @@ public TestingSingleStoreServer(String dockerImageName)
4444
{
4545
super(DockerImageName.parse(dockerImageName));
4646
addEnv("ROOT_PASSWORD", "memsql_root_password");
47-
String option = dockerImageName.equals(LATEST_TESTED_TAG) ? "bash" : "";
4847
withCommand("sh", "-xeuc",
49-
option + " /startup && " +
48+
"bash /startup && " +
5049
// Lower the size of pre-allocated log files to 1MB (minimum allowed) to reduce disk footprint
5150
"memsql-admin update-config --yes --all --set-global --key \"log_file_size_partitions\" --value \"1048576\" && " +
5251
"memsql-admin update-config --yes --all --set-global --key \"log_file_size_ref_dbs\" --value \"1048576\" && " +
5352
// re-execute startup to actually start the nodes (first run performs setup but doesn't start the nodes)
54-
"exec " + option + " /startup");
53+
"exec bash /startup");
5554
start();
5655
}
5756

0 commit comments

Comments
 (0)