use of com.facebook.presto.sql.planner.LiteralInterpreter.toExpression in project presto by prestodb.
the class TestDomainTranslator method testNonImplictCastOnSymbolSide.
@Test
void testNonImplictCastOnSymbolSide() {
// we expect TupleDomain.all here().
// see comment in DomainTranslator.Visitor.visitComparisonExpression()
// CAST(timestamp as DATE) = date_literal
Expression originalExpression = equal(new Cast(C_TIMESTAMP.toSymbolReference(), DATE.toString()), LiteralInterpreter.toExpression(DATE_VALUE, DATE));
ExtractionResult result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), originalExpression);
assertEquals(result.getTupleDomain(), TupleDomain.all());
// CAST(DECIMAL as BIGINT) = bigint_literal
originalExpression = equal(new Cast(C_DECIMAL_12_2.toSymbolReference(), BIGINT.toString()), bigintLiteral(135L));
result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), originalExpression);
assertEquals(result.getTupleDomain(), TupleDomain.all());
}
Aggregations