Search in sources :

Example 1 with NationGenerator

use of io.airlift.tpch.NationGenerator in project hetu-core by openlookeng.

the class TestOrcAcidPageSource method assertRead.

private static void assertRead(Map<NationColumn, Integer> columns, OptionalLong nationKeyPredicate, Optional<DeleteDeltaLocations> deleteDeltaLocations, LongPredicate deletedRows) {
    TupleDomain<HiveColumnHandle> tupleDomain = TupleDomain.all();
    if (nationKeyPredicate.isPresent()) {
        tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(toHiveColumnHandle(NATION_KEY, ALL_COLUMNS.get(NATION_KEY)), Domain.singleValue(BIGINT, nationKeyPredicate.getAsLong())));
    }
    List<Nation> actual = readFile(columns, tupleDomain, deleteDeltaLocations);
    List<Nation> expected = new ArrayList<>();
    for (Nation nation : ImmutableList.copyOf(new NationGenerator().iterator())) {
        if (nationKeyPredicate.isPresent() && nationKeyPredicate.getAsLong() != nation.getNationKey()) {
            continue;
        }
        if (deletedRows.test(nation.getNationKey())) {
            continue;
        }
        expected.addAll(nCopies(1000, nation));
    }
    assertEqualsByColumns(columns.keySet(), actual, expected);
}
Also used : Nation(io.airlift.tpch.Nation) ArrayList(java.util.ArrayList) NationGenerator(io.airlift.tpch.NationGenerator) HiveColumnHandle(io.prestosql.plugin.hive.HiveColumnHandle)

Example 2 with NationGenerator

use of io.airlift.tpch.NationGenerator in project boostkit-bigdata by kunpengcompute.

the class TestOrcAcidPageSource method assertRead.

private static void assertRead(Map<NationColumn, Integer> columns, OptionalLong nationKeyPredicate, Optional<DeleteDeltaLocations> deleteDeltaLocations, LongPredicate deletedRows) {
    TupleDomain<HiveColumnHandle> tupleDomain = TupleDomain.all();
    if (nationKeyPredicate.isPresent()) {
        tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(toHiveColumnHandle(NATION_KEY, ALL_COLUMNS.get(NATION_KEY)), Domain.singleValue(BIGINT, nationKeyPredicate.getAsLong())));
    }
    List<Nation> actual = readFile(columns, tupleDomain, deleteDeltaLocations);
    List<Nation> expected = new ArrayList<>();
    for (Nation nation : ImmutableList.copyOf(new NationGenerator().iterator())) {
        if (nationKeyPredicate.isPresent() && nationKeyPredicate.getAsLong() != nation.getNationKey()) {
            continue;
        }
        if (deletedRows.test(nation.getNationKey())) {
            continue;
        }
        expected.addAll(nCopies(1000, nation));
    }
    assertEqualsByColumns(columns.keySet(), actual, expected);
}
Also used : Nation(io.airlift.tpch.Nation) ArrayList(java.util.ArrayList) NationGenerator(io.airlift.tpch.NationGenerator) HiveColumnHandle(io.prestosql.plugin.hive.HiveColumnHandle)

Aggregations

Nation (io.airlift.tpch.Nation)2 NationGenerator (io.airlift.tpch.NationGenerator)2 HiveColumnHandle (io.prestosql.plugin.hive.HiveColumnHandle)2 ArrayList (java.util.ArrayList)2