Search in sources :

Example 1 with SimpleColumnChecksum

use of com.facebook.presto.verifier.checksum.SimpleColumnChecksum in project presto by prestodb.

the class TestStructuredColumnMismatchResolver method testMixed.

@Test
public void testMixed() {
    ColumnMatchResult<?> resolvable1 = createMismatchedColumn(new ArrayType(new ArrayType(DOUBLE)), new ArrayColumnChecksum(binary(0xa), binary(0xc), 1), new ArrayColumnChecksum(binary(0xb), binary(0xc), 1));
    ColumnMatchResult<?> resolvable2 = createMismatchedColumn(mapType(REAL, DOUBLE), new MapColumnChecksum(binary(0x1), binary(0xa), binary(0xa), binary(0xc), 1), new MapColumnChecksum(binary(0x4), binary(0xb), binary(0xb), binary(0xc), 1));
    ColumnMatchResult<?> nonResolvable = createMismatchedColumn(VARCHAR, new SimpleColumnChecksum(binary(0xa)), new SimpleColumnChecksum(binary(0xb)));
    assertResolved(resolvable1, resolvable2);
    assertNotResolved(resolvable1, nonResolvable);
    assertNotResolved(nonResolvable, resolvable2);
    assertNotResolved(resolvable1, nonResolvable, resolvable2);
}
Also used : ArrayType(com.facebook.presto.common.type.ArrayType) SimpleColumnChecksum(com.facebook.presto.verifier.checksum.SimpleColumnChecksum) MapColumnChecksum(com.facebook.presto.verifier.checksum.MapColumnChecksum) ArrayColumnChecksum(com.facebook.presto.verifier.checksum.ArrayColumnChecksum) Test(org.testng.annotations.Test)

Example 2 with SimpleColumnChecksum

use of com.facebook.presto.verifier.checksum.SimpleColumnChecksum in project presto by prestodb.

the class TestIgnoredFunctionsMismatchResolver method testDefault.

@Test
public void testDefault() {
    ColumnMatchResult<?> mismatchedColumn = createMismatchedColumn(VARCHAR, new SimpleColumnChecksum(binary(0xa)), new SimpleColumnChecksum(binary(0xb)));
    // resolved
    assertResolved(createBundle("CREATE TABLE test AS SELECT rand() x FROM source"), mismatchedColumn);
    assertResolved(createBundle("CREATE TABLE test AS SELECT presto.default.rand() x FROM source"), mismatchedColumn);
    assertResolved(createBundle("SELECT arbitrary(x) FROM source"), mismatchedColumn);
    assertResolved(createBundle("INSERT INTO target SELECT presto.default.arbitrary(x) FROM source"), mismatchedColumn);
    assertResolved(createBundle("SELECT arbitrary(rand()) FROM source"), mismatchedColumn);
    assertResolved(createBundle("SELECT sum(rand()) FROM source"), mismatchedColumn);
    // not resolved
    assertNotResolved(createBundle("SELECT count() FROM source"), mismatchedColumn);
}
Also used : SimpleColumnChecksum(com.facebook.presto.verifier.checksum.SimpleColumnChecksum) Test(org.testng.annotations.Test)

Aggregations

SimpleColumnChecksum (com.facebook.presto.verifier.checksum.SimpleColumnChecksum)2 Test (org.testng.annotations.Test)2 ArrayType (com.facebook.presto.common.type.ArrayType)1 ArrayColumnChecksum (com.facebook.presto.verifier.checksum.ArrayColumnChecksum)1 MapColumnChecksum (com.facebook.presto.verifier.checksum.MapColumnChecksum)1