<commit_before>package io.crate.planner.symbol;

import io.crate.metadata.FunctionInfo;
import org.cratedb.DataType;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;

import java.io.IOException;

public class Function extends ValueSymbol {

    public static final SymbolFactory<Function> FACTORY = new SymbolFactory<Function>() {
        @Override
        public Function newInstance() {
            return new Function();
        }
    };

    private FunctionInfo info;

    public Function(FunctionInfo info) {
        this.info = info;
    }

    public Function() {

    }

    @Override
    public DataType valueType() {
        return info.returnType();
    }

    @Override
    public SymbolType symbolType() {
        return SymbolType.FUNCTION;
    }

    @Override
    public <C, R> R accept(SymbolVisitor<C, R> visitor, C context) {
        return visitor.visitFunction(this, context);
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        info = new FunctionInfo();
        info.readFrom(in);
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        info.writeTo(out);
    }
}
<commit_msg>add arguments to Function (symbol)<commit_after>package io.crate.planner.symbol;

import io.crate.metadata.FunctionInfo;
import org.cratedb.DataType;
import org.elasticsearch.common.Preconditions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Function extends ValueSymbol {

    public static final SymbolFactory<Function> FACTORY = new SymbolFactory<Function>() {
        @Override
        public Function newInstance() {
            return new Function();
        }
    };

    private List<ValueSymbol> arguments;
    private FunctionInfo info;

    public Function(FunctionInfo info, List<ValueSymbol> arguments) {
        Preconditions.checkArgument(arguments.size() == info.ident().argumentTypes().size());
        this.info = info;
        this.arguments = arguments;
    }

    public Function() {

    }

    public List<ValueSymbol> arguments() {
        return arguments;
    }

    @Override
    public DataType valueType() {
        return info.returnType();
    }

    @Override
    public SymbolType symbolType() {
        return SymbolType.FUNCTION;
    }

    @Override
    public <C, R> R accept(SymbolVisitor<C, R> visitor, C context) {
        return visitor.visitFunction(this, context);
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        info = new FunctionInfo();
        info.readFrom(in);

        int numArguments = in.readVInt();
        arguments = new ArrayList<>(numArguments);
        for (int i = 0; i < numArguments; i++) {
            arguments.add((ValueSymbol)Symbol.fromStream(in));
        }
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        info.writeTo(out);
        out.writeVInt(arguments.size());
        for (ValueSymbol argument : arguments) {
            Symbol.toStream(argument, out);
        }
    }
}
{'fraction_non_alphanumeric': 0.1006815365551425, 'fraction_numerical': 0.0003097893432465923, 'mean_word_length': 2.8032979976442873, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '976607', 'n_tokens_mistral': 881, 'n_tokens_neox': 868, 'n_words': 215}