17
17
import org .testng .annotations .Test ;
18
18
19
19
import java .math .BigDecimal ;
20
+ import java .sql .Timestamp ;
20
21
21
22
import static io .trino .tempto .assertions .QueryAssert .Row .row ;
22
23
import static io .trino .tempto .assertions .QueryAssert .assertThat ;
@@ -34,12 +35,38 @@ public void testSelect()
34
35
{
35
36
String schemaName = "test_" + randomNameSuffix ();
36
37
String tableName = schemaName + ".tab" ;
38
+
37
39
onExasol ().executeQuery ("CREATE SCHEMA " + schemaName );
40
+
38
41
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
+
41
63
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
+ ));
43
70
}
44
71
finally {
45
72
onExasol ().executeQuery ("DROP TABLE IF EXISTS " + tableName );
0 commit comments