private boolean isCandidate()

in paimon-presto-common/src/main/java/org/apache/paimon/presto/PrestoComputePushdown.java [461:497]


        private boolean isCandidate(Map<ColumnHandle, NullableValue> bindings) {
            if (intersection(bindings.keySet(), arguments).isEmpty()) {
                return true;
            }

            Function<VariableReferenceExpression, Object> variableResolver =
                    variable -> {
                        ColumnHandle column = assignments.get(variable.getName());
                        checkArgument(column != null, "Missing column assignment for %s", variable);

                        if (!bindings.containsKey(column)) {
                            return variable;
                        }

                        return bindings.get(column).getValue();
                    };

            // Skip pruning if evaluation fails in a recoverable way. Failing here can cause
            // spurious query failures for partitions that would otherwise be filtered out.
            Object optimized = null;
            try {
                optimized =
                        evaluator
                                .getExpressionOptimizer()
                                .optimize(expression, OPTIMIZED, session, variableResolver);
            } catch (PrestoException e) {
                propagateIfUnhandled(e);
                return true;
            }

            // If any conjuncts evaluate to FALSE or null, then the whole predicate will never be
            // true and so the partition should be pruned
            return !Boolean.FALSE.equals(optimized)
                    && optimized != null
                    && (!(optimized instanceof ConstantExpression)
                            || !((ConstantExpression) optimized).isNull());
        }