use of org.apache.drill.exec.util.Text in project drill by apache.
the class IcebergQueriesTest method testSelectSnapshotsMetadata.
@Test
public void testSelectSnapshotsMetadata() throws Exception {
String query = "select * from dfs.tmp.`testAllTypes#snapshots`";
List<Snapshot> snapshots = new ArrayList<>();
table.snapshots().forEach(snapshots::add);
JsonStringHashMap<Object, Object> summaryMap = new JsonStringHashMap<>();
snapshots.get(0).summary().forEach((k, v) -> summaryMap.put(new Text(k.getBytes(StandardCharsets.UTF_8)), new Text(v.getBytes(StandardCharsets.UTF_8))));
JsonStringHashMap<Object, Object> secondSummaryMap = new JsonStringHashMap<>();
snapshots.get(1).summary().forEach((k, v) -> secondSummaryMap.put(new Text(k.getBytes(StandardCharsets.UTF_8)), new Text(v.getBytes(StandardCharsets.UTF_8))));
testBuilder().sqlQuery(query).unOrdered().baselineColumns("committed_at", "snapshot_id", "parent_id", "operation", "manifest_list", "summary").baselineValues(LocalDateTime.ofInstant(Instant.ofEpochMilli(snapshots.get(0).timestampMillis()), ZoneId.of("UTC")), snapshots.get(0).snapshotId(), snapshots.get(0).parentId(), snapshots.get(0).operation(), snapshots.get(0).manifestListLocation(), summaryMap).baselineValues(LocalDateTime.ofInstant(Instant.ofEpochMilli(snapshots.get(1).timestampMillis()), ZoneId.of("UTC")), snapshots.get(1).snapshotId(), snapshots.get(1).parentId(), snapshots.get(1).operation(), snapshots.get(1).manifestListLocation(), secondSummaryMap).go();
}
Aggregations