diff --git a/presto-main/src/test/java/io/prestosql/sql/planner/TestEffectivePredicateExtractor.java b/presto-main/src/test/java/io/prestosql/sql/planner/TestEffectivePredicateExtractor.java index f5c95bc93..740088d05 100644 --- a/presto-main/src/test/java/io/prestosql/sql/planner/TestEffectivePredicateExtractor.java +++ b/presto-main/src/test/java/io/prestosql/sql/planner/TestEffectivePredicateExtractor.java @@ -243,7 +243,7 @@ public class TestEffectivePredicateExtractor // Rewrite in terms of group by symbols assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts( + normalizeConjunctsSet( lessThan(AE, bigintLiteral(10)), lessThan(BE, AE), greaterThan(AE, bigintLiteral(2)), @@ -302,7 +302,7 @@ public class TestEffectivePredicateExtractor // Rewrite in terms of project output symbols assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts( + normalizeConjunctsSet( lessThan(DE, bigintLiteral(10)), equals(DE, EE))); } @@ -322,7 +322,7 @@ public class TestEffectivePredicateExtractor // Pass through assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts( + normalizeConjunctsSet( equals(AE, BE), equals(BE, CE), lessThan(CE, bigintLiteral(10)))); @@ -344,7 +344,7 @@ public class TestEffectivePredicateExtractor // Pass through assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts( + normalizeConjunctsSet( equals(AE, BE), equals(BE, CE), lessThan(CE, bigintLiteral(10)))); @@ -366,7 +366,7 @@ public class TestEffectivePredicateExtractor // Pass through assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts( + normalizeConjunctsSet( equals(AE, BE), equals(BE, CE), lessThan(CE, bigintLiteral(10)))); @@ -395,7 +395,7 @@ public class TestEffectivePredicateExtractor // Pass through assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts( + normalizeConjunctsSet( equals(AE, BE), equals(BE, CE), lessThan(CE, bigintLiteral(10)))); @@ -440,7 +440,7 @@ public class TestEffectivePredicateExtractor assignments, predicate, Optional.empty(), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false); effectivePredicate = effectivePredicateExtractorWithoutTableProperties.extract(SESSION, node, TypeProvider.empty(), typeAnalyzer); - assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(bigintLiteral(2L), BE), equals(bigintLiteral(1L), AE))); + assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjunctsSet(equals(bigintLiteral(2L), BE), equals(bigintLiteral(1L), AE))); node = new TableScanNode( newId(), @@ -464,7 +464,7 @@ public class TestEffectivePredicateExtractor Optional.empty(), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false); effectivePredicate = effectivePredicateExtractor.extract(SESSION, node, TypeProvider.empty(), typeAnalyzer); - assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(equals(bigintLiteral(2L), BE), equals(bigintLiteral(1L), AE))); + assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjunctsSet(equals(bigintLiteral(2L), BE), equals(bigintLiteral(1L), AE))); node = new TableScanNode( newId(), @@ -659,7 +659,7 @@ public class TestEffectivePredicateExtractor // All predicates having output symbol should be carried through assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts(lessThan(BE, AE), + normalizeConjunctsSet(lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), equals(DE, EE), lessThan(FE, bigintLiteral(100)), @@ -775,7 +775,7 @@ public class TestEffectivePredicateExtractor // All right side symbols having output symbols should be checked against NULL assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts(lessThan(BE, AE), + normalizeConjunctsSet(lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), or(equals(DE, EE), and(isNull(DE), isNull(EE))), or(lessThan(FE, bigintLiteral(100)), isNull(FE)), @@ -820,7 +820,7 @@ public class TestEffectivePredicateExtractor // False literal on the right side should be ignored assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts(lessThan(BE, AE), + normalizeConjunctsSet(lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), or(equals(AE, DE), isNull(DE)))); } @@ -868,7 +868,7 @@ public class TestEffectivePredicateExtractor // All left side symbols should be checked against NULL assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts(or(lessThan(BE, AE), and(isNull(BE), isNull(AE))), + normalizeConjunctsSet(or(lessThan(BE, AE), and(isNull(BE), isNull(AE))), or(lessThan(CE, bigintLiteral(10)), isNull(CE)), equals(DE, EE), lessThan(FE, bigintLiteral(100)), @@ -912,7 +912,7 @@ public class TestEffectivePredicateExtractor // False literal on the left side should be ignored assertEquals(normalizeConjuncts(effectivePredicate), - normalizeConjuncts(equals(DE, EE), + normalizeConjunctsSet(equals(DE, EE), lessThan(FE, bigintLiteral(100)), or(equals(AE, DE), isNull(AE)))); } @@ -1002,12 +1002,12 @@ public class TestEffectivePredicateExtractor return new IsNullPredicate(expression); } - private Set normalizeConjuncts(Expression... conjuncts) + private Set normalizeConjunctsSet(Expression... conjuncts) { - return normalizeOneConjuncts(Arrays.asList(conjuncts)); + return normalizeConjunctsCollection(Arrays.asList(conjuncts)); } - private Set normalizeOneConjuncts(Collection conjuncts) + private Set normalizeConjunctsCollection(Collection conjuncts) { return normalizeConjuncts(combineConjuncts(conjuncts)); } diff --git a/presto-main/src/test/java/io/prestosql/utils/MockSplit.java b/presto-main/src/test/java/io/prestosql/utils/MockSplit.java index fa1695f19..f12f77ae4 100644 --- a/presto-main/src/test/java/io/prestosql/utils/MockSplit.java +++ b/presto-main/src/test/java/io/prestosql/utils/MockSplit.java @@ -68,10 +68,7 @@ public class MockSplit @JsonProperty("endIndex") long endIndex, @JsonProperty("lastModifiedTime") long lastModifiedTime) { - this.filepath = filepath; - this.startIndex = startIndex; - this.endIndex = endIndex; - this.lastModifiedTime = lastModifiedTime; + this(filepath, startIndex, endIndex, lastModifiedTime); this.schema = TEST_SCHEMA; this.table = TEST_TABLE; } diff --git a/presto-rcfile/src/main/java/io/prestosql/rcfile/RcFileWriteValidation.java b/presto-rcfile/src/main/java/io/prestosql/rcfile/RcFileWriteValidation.java index d1f9c433e..716ac8844 100644 --- a/presto-rcfile/src/main/java/io/prestosql/rcfile/RcFileWriteValidation.java +++ b/presto-rcfile/src/main/java/io/prestosql/rcfile/RcFileWriteValidation.java @@ -127,11 +127,11 @@ public class RcFileWriteValidation { this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); - ImmutableList.Builder columnHashes = ImmutableList.builder(); + ImmutableList.Builder localColumnHashes = ImmutableList.builder(); for (Type ignored : types) { - columnHashes.add(new XxHash64()); + localColumnHashes.add(new XxHash64()); } - this.columnHashes = columnHashes.build(); + this.columnHashes = localColumnHashes.build(); } public static WriteChecksumBuilder createWriteChecksumBuilder(Map readColumns) @@ -143,13 +143,13 @@ public class RcFileWriteValidation .max().getAsInt() + 1; checkArgument(readColumns.size() == columnCount, "checksum requires all columns to be read"); - ImmutableList.Builder types = ImmutableList.builder(); + ImmutableList.Builder localTypes = ImmutableList.builder(); for (int column = 0; column < columnCount; column++) { Type type = readColumns.get(column); checkArgument(type != null, "checksum requires all columns to be read"); - types.add(type); + localTypes.add(type); } - return new WriteChecksumBuilder(types.build()); + return new WriteChecksumBuilder(localTypes.build()); } public void addRowGroup(int rowCount) diff --git a/presto-rcfile/src/main/java/io/prestosql/rcfile/text/StringEncoding.java b/presto-rcfile/src/main/java/io/prestosql/rcfile/text/StringEncoding.java index 6cabe4532..b4060fba7 100644 --- a/presto-rcfile/src/main/java/io/prestosql/rcfile/text/StringEncoding.java +++ b/presto-rcfile/src/main/java/io/prestosql/rcfile/text/StringEncoding.java @@ -54,7 +54,7 @@ public class StringEncoding throw new IllegalArgumentException("escape not implemented"); } String escapedValue = unescapeText(new String(slice.getBytes(), StandardCharsets.UTF_8)); - if (escapedValue.getBytes().length < slice.getBytes().length) { + if (escapedValue.getBytes(StandardCharsets.UTF_8).length < slice.getBytes().length) { sliceOutput.writeBytes(escapedValue.getBytes(StandardCharsets.UTF_8)); } else {