1717import org .testng .annotations .Test ;
1818
1919import java .math .BigDecimal ;
20+ import java .sql .Timestamp ;
2021
2122import static io .trino .tempto .assertions .QueryAssert .Row .row ;
2223import static io .trino .tempto .assertions .QueryAssert .assertThat ;
@@ -34,12 +35,38 @@ public void testSelect()
3435 {
3536 String schemaName = "test_" + randomNameSuffix ();
3637 String tableName = schemaName + ".tab" ;
38+
3739 onExasol ().executeQuery ("CREATE SCHEMA " + schemaName );
40+
3841 try {
39- onExasol ().executeQuery ("CREATE TABLE " + tableName + " (id integer, name varchar(5))" );
40- onExasol ().executeQuery ("INSERT INTO " + tableName + " VALUES (1, 'a')" );
42+ onExasol ().executeQuery ("""
43+ CREATE TABLE %s (
44+ id INTEGER,
45+ name VARCHAR(5),
46+ tmstmp TIMESTAMP(6),
47+ tmstmp_timezone TIMESTAMP(6) WITH LOCAL TIME ZONE
48+ )
49+ """ .formatted (tableName ));
50+
51+ onExasol ().executeQuery ("""
52+ INSERT INTO %s
53+ VALUES (
54+ 1,
55+ 'a',
56+ TO_TIMESTAMP('2018-04-01 02:13:55.123456', 'YYYY-MM-DD HH24:MI:SS.FF6'),
57+ TO_TIMESTAMP('2018-04-01 02:13:55.123456', 'YYYY-MM-DD HH24:MI:SS.FF6')
58+ )
59+ """ .formatted (tableName ));
60+
61+ Timestamp expectedTimestamp = Timestamp .valueOf ("2018-04-01 02:13:55.123456" );
62+
4163 assertThat (onTrino ().executeQuery ("SELECT * FROM " + tableName ))
42- .containsOnly (row (BigDecimal .valueOf (1 ), "a" ));
64+ .containsOnly (row (
65+ BigDecimal .valueOf (1 ),
66+ "a" ,
67+ expectedTimestamp ,
68+ expectedTimestamp
69+ ));
4370 }
4471 finally {
4572 onExasol ().executeQuery ("DROP TABLE IF EXISTS " + tableName );
0 commit comments