Search in sources :

Example 1 with InterpretedFunctionInvoker

use of io.trino.sql.InterpretedFunctionInvoker in project trino by trinodb.

the class ValuePrinter method castToVarcharOrFail.

public String castToVarcharOrFail(Type type, Object value) throws OperatorNotFoundException {
    if (value == null) {
        return "NULL";
    }
    ResolvedFunction coercion = metadata.getCoercion(session, type, VARCHAR);
    Slice coerced = (Slice) new InterpretedFunctionInvoker(functionManager).invoke(coercion, session.toConnectorSession(), value);
    return coerced.toStringUtf8();
}
Also used : InterpretedFunctionInvoker(io.trino.sql.InterpretedFunctionInvoker) ResolvedFunction(io.trino.metadata.ResolvedFunction) Slice(io.airlift.slice.Slice)

Aggregations

Slice (io.airlift.slice.Slice)1 ResolvedFunction (io.trino.metadata.ResolvedFunction)1 InterpretedFunctionInvoker (io.trino.sql.InterpretedFunctionInvoker)1