Search in sources :

Example 1 with CubeRangeCanonicalizer

use of io.prestosql.operator.CubeRangeCanonicalizer in project hetu-core by openlookeng.

the class TestExpressionDomainTranslator method mergeAndAssert.

private Expression mergeAndAssert(boolean contains, Expression expression, Expression partExpression) {
    CubeRangeCanonicalizer canonicalizer = new CubeRangeCanonicalizer(metadata, TEST_SESSION, TYPES);
    Expression transformed = canonicalizer.mergePredicates(expression);
    ExpressionDomainTranslator.ExtractionResult expressionTD = ExpressionDomainTranslator.fromPredicate(metadata, TEST_SESSION, transformed, TYPES);
    Assert.assertEquals(expressionTD.getRemainingExpression(), BooleanLiteral.TRUE_LITERAL, "Still some part of expression not converted into TupleDomain");
    ExpressionDomainTranslator.ExtractionResult partTD = ExpressionDomainTranslator.fromPredicate(metadata, TEST_SESSION, partExpression, TYPES);
    Assert.assertEquals(partTD.getRemainingExpression(), BooleanLiteral.TRUE_LITERAL, "Still some part of expression not converted into TupleDomain");
    Assert.assertEquals(contains, expressionTD.getTupleDomain().contains(partTD.getTupleDomain()));
    return transformed;
}
Also used : CubeRangeCanonicalizer(io.prestosql.operator.CubeRangeCanonicalizer) ExtractionResult(io.prestosql.sql.planner.ExpressionDomainTranslator.ExtractionResult) InListExpression(io.prestosql.sql.tree.InListExpression) NotExpression(io.prestosql.sql.tree.NotExpression) ComparisonExpression(io.prestosql.sql.tree.ComparisonExpression) Expression(io.prestosql.sql.tree.Expression)

Aggregations

CubeRangeCanonicalizer (io.prestosql.operator.CubeRangeCanonicalizer)1 ExtractionResult (io.prestosql.sql.planner.ExpressionDomainTranslator.ExtractionResult)1 ComparisonExpression (io.prestosql.sql.tree.ComparisonExpression)1 Expression (io.prestosql.sql.tree.Expression)1 InListExpression (io.prestosql.sql.tree.InListExpression)1 NotExpression (io.prestosql.sql.tree.NotExpression)1