Search in sources :

Example 1 with RowExpressionInterpreter

use of io.prestosql.sql.planner.RowExpressionInterpreter in project hetu-core by openlookeng.

the class FilterStatsCalculator method simplifyExpression.

private RowExpression simplifyExpression(ConnectorSession session, RowExpression predicate) {
    RowExpressionInterpreter interpreter = new RowExpressionInterpreter(predicate, metadata, session, OPTIMIZED);
    Object value = interpreter.optimize();
    if (value == null) {
        // Expression evaluates to SQL null, which in Filter is equivalent to false. This assumes the expression is a top-level expression (eg. not in NOT).
        value = false;
    }
    return LiteralEncoder.toRowExpression(value, BOOLEAN);
}
Also used : RowExpressionInterpreter(io.prestosql.sql.planner.RowExpressionInterpreter)

Aggregations

RowExpressionInterpreter (io.prestosql.sql.planner.RowExpressionInterpreter)1