Skip to content

Commit

Permalink
Skip negative test of DateTime/DateTime32 on 21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zhicwu committed Oct 7, 2021
1 parent f66139a commit 77e67bc
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.clickhouse.client.ClickHouseResponseSummary;
import com.clickhouse.client.ClickHouseUtils;
import com.clickhouse.client.ClickHouseValue;
import com.clickhouse.client.ClickHouseVersion;
import com.clickhouse.client.ClickHouseWriter;
import com.clickhouse.client.config.ClickHouseClientOption;
import com.clickhouse.client.data.ClickHouseDateTimeValue;
Expand Down Expand Up @@ -378,10 +379,6 @@ public void testReadWriteGeoTypes() throws Exception {
@Test(dataProvider = "simpleTypeProvider", groups = "integration")
public void testReadWriteSimpleTypes(String dataType, String zero, String negativeOne, String positiveOne)
throws Exception {
// if (ClickHouseDataType.Date32.name().equals(dataType)) {
// return;
// }

ClickHouseNode server = getServer(ClickHouseProtocol.GRPC);

String typeName = dataType;
Expand Down Expand Up @@ -423,9 +420,11 @@ public void testReadWriteSimpleTypes(String dataType, String zero, String negati
return;
}

ClickHouseVersion version = null;
try (ClickHouseClient client = ClickHouseClient.newInstance(ClickHouseProtocol.GRPC);
ClickHouseResponse resp = client.connect(server).format(ClickHouseFormat.RowBinaryWithNamesAndTypes)
.query(ClickHouseUtils.format("select * except(no) from test_%s order by no", columnName))
ClickHouseResponse resp = client
.connect(server).format(ClickHouseFormat.RowBinaryWithNamesAndTypes).query(ClickHouseUtils
.format("select * except(no), version() from test_%s order by no", columnName))
.execute().get()) {
List<String[]> records = new ArrayList<>();
for (ClickHouseRecord record : resp.records()) {
Expand All @@ -440,12 +439,24 @@ public void testReadWriteSimpleTypes(String dataType, String zero, String negati
Assert.assertEquals(records.size(), 4);
Assert.assertEquals(records.get(0)[0], zero);
Assert.assertEquals(records.get(0)[1], null);
if (version == null) {
version = ClickHouseVersion.of(records.get(0)[2]);
}

Assert.assertEquals(records.get(1)[0], zero);
Assert.assertEquals(records.get(1)[1], zero);
Assert.assertEquals(records.get(2)[0], negativeOne);
Assert.assertEquals(records.get(2)[1], negativeOne);
Assert.assertEquals(records.get(3)[0], positiveOne);
Assert.assertEquals(records.get(3)[1], positiveOne);

if ((ClickHouseDataType.DateTime.name().equals(dataType)
|| ClickHouseDataType.DateTime32.name().equals(dataType)) && version.getMajor() == 21
&& version.getMinor() == 3) {
// skip DateTime and DateTime32 negative test on 21.3 since it's not doing well
// see /~https://github.com/ClickHouse/ClickHouse/issues/29835 for more
} else {
Assert.assertEquals(records.get(2)[0], negativeOne);
Assert.assertEquals(records.get(2)[1], negativeOne);
}
}
}

Expand Down

0 comments on commit 77e67bc

Please sign in to comment.