class ScalarsAndRefsToTrue extends SymbolVisitor<Void, Symbol> {

    private static final ScalarsAndRefsToTrue INSTANCE = new ScalarsAndRefsToTrue();

    private ScalarsAndRefsToTrue() {
    }

    public static Symbol rewrite(Symbol symbol) {
        return symbol.accept(INSTANCE, null);
    }

    @Override
    public Symbol visitFunction(Function symbol, Void context) {<FILL_FUNCTION_BODY>}

    @Override
    public Symbol visitMatchPredicate(MatchPredicate matchPredicate, Void context) {
        return Literal.BOOLEAN_TRUE;
    }

    @Override
    protected Symbol visitSymbol(Symbol symbol, Void context) {
        if (symbol.valueType().id() == DataTypes.UNDEFINED.id()) {
            return Literal.NULL;
        }
        return Literal.BOOLEAN_TRUE;
    }

    @Override
    public Symbol visitLiteral(Literal<?> symbol, Void context) {
        return symbol;
    }
}

        String functionName = symbol.name();

        if (functionName.equals(NotPredicate.NAME)) {
            Symbol argument = symbol.arguments().get(0);
            if (argument instanceof Reference) {
                return argument.accept(this, context);
            } else if (argument instanceof Function) {
                if (!Operators.LOGICAL_OPERATORS.contains(((Function) argument).name())) {
                    return argument.accept(this, context);
                }
            }
        }

        List<Symbol> newArgs = new ArrayList<>(symbol.arguments().size());
        boolean allLiterals = true;
        boolean isNull = false;
        for (Symbol arg : symbol.arguments()) {
            Symbol processedArg = arg.accept(this, context);
            newArgs.add(processedArg);
            if (!processedArg.symbolType().isValueSymbol()) {
                allLiterals = false;
            }
            if (processedArg.valueType().id() == DataTypes.UNDEFINED.id()) {
                isNull = true;
            }
        }
        if (allLiterals && !Operators.LOGICAL_OPERATORS.contains(functionName)) {
            return isNull ? Literal.NULL : Literal.BOOLEAN_TRUE;
        }
        return new Function(symbol.signature(), newArgs, symbol.valueType());
    
<methods>public non-sealed void <init>() ,public io.crate.expression.symbol.Symbol visitAggregation(io.crate.expression.symbol.Aggregation, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitAlias(io.crate.expression.symbol.AliasSymbol, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitDynamicReference(io.crate.expression.symbol.DynamicReference, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitFetchMarker(io.crate.expression.symbol.FetchMarker, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitFetchReference(io.crate.expression.symbol.FetchReference, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitFetchStub(io.crate.expression.symbol.FetchStub, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitField(io.crate.expression.symbol.ScopedSymbol, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitFunction(io.crate.expression.symbol.Function, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitInputColumn(io.crate.expression.symbol.InputColumn, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitLiteral(Literal<?>, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitMatchPredicate(io.crate.expression.symbol.MatchPredicate, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitOuterColumn(io.crate.expression.symbol.OuterColumn, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitParameterSymbol(io.crate.expression.symbol.ParameterSymbol, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitReference(io.crate.metadata.Reference, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitSelectSymbol(io.crate.expression.symbol.SelectSymbol, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitVoidReference(io.crate.expression.symbol.VoidReference, java.lang.Void) ,public io.crate.expression.symbol.Symbol visitWindowFunction(io.crate.expression.symbol.WindowFunction, java.lang.Void) <variables>