|
7 | 7 | import org.junit.ClassRule; |
8 | 8 | import org.junit.Test; |
9 | 9 |
|
| 10 | +import tech.ydb.core.Issue; |
| 11 | +import tech.ydb.core.Status; |
| 12 | +import tech.ydb.core.StatusCode; |
10 | 13 | import tech.ydb.table.SessionRetryContext; |
11 | 14 | import tech.ydb.table.impl.SimpleTableClient; |
12 | 15 | import tech.ydb.table.query.DataQueryResult; |
@@ -138,5 +141,20 @@ public void timestampReadTest() { |
138 | 141 | assertTimestamp(rs.getColumn("t3"), true, Instant.parse("2105-12-31T23:59:59.999999Z")); |
139 | 142 | assertTimestamp(rs.getColumn("t4"), false, Instant.ofEpochSecond(0, 0)); |
140 | 143 | assertTimestamp(rs.getColumn("t5"), false, Instant.ofEpochSecond(4291747199l, 999999000l)); |
| 144 | + |
| 145 | + Status invalid = CTX.supplyResult( |
| 146 | + s -> s.executeDataQuery("SELECT " |
| 147 | + + "Timestamp('1969-12-31T23:59:59.999999Z') as t6," |
| 148 | + + "Timestamp('2106-01-01T00:00:00.000000Z') as t7;", |
| 149 | + TxControl.serializableRw() |
| 150 | + ) |
| 151 | + ).join().getStatus(); |
| 152 | + |
| 153 | + Assert.assertEquals(StatusCode.GENERIC_ERROR, invalid.getCode()); |
| 154 | + Issue[] issues = invalid.getIssues(); |
| 155 | + Assert.assertEquals(2, issues.length); |
| 156 | + Assert.assertEquals("Invalid value \"1969-12-31T23:59:59.999999Z\" for type Timestamp", issues[0].getMessage()); |
| 157 | + Assert.assertEquals("Invalid value \"2106-01-01T00:00:00.000000Z\" for type Timestamp", issues[1].getMessage()); |
| 158 | + |
141 | 159 | } |
142 | 160 | } |
0 commit comments