use of io.questdb.std.str.StringSink in project questdb by questdb.
the class CastShortToSymbolFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
final Function arg = args.getQuick(0);
if (arg.isConstant()) {
final StringSink sink = Misc.getThreadLocalBuilder();
sink.put(arg.getShort(null));
return SymbolConstant.newInstance(sink);
}
return new Func(arg);
}
use of io.questdb.std.str.StringSink in project questdb by questdb.
the class CastDateToStrFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
Function func = args.getQuick(0);
if (func.isConstant()) {
StringSink sink = Misc.getThreadLocalBuilder();
sink.put(func.getDate(null));
return new StrConstant(Chars.toString(sink));
}
return new Func(args.getQuick(0));
}
use of io.questdb.std.str.StringSink in project questdb by questdb.
the class CastLongToSymbolFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
final Function arg = args.getQuick(0);
if (arg.isConstant()) {
final StringSink sink = Misc.getThreadLocalBuilder();
sink.put(arg.getLong(null));
return SymbolConstant.newInstance(sink);
}
return new Func(arg);
}
use of io.questdb.std.str.StringSink in project questdb by questdb.
the class CastCharToSymbolFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
final Function arg = args.getQuick(0);
if (arg.isConstant()) {
final char value = arg.getChar(null);
if (value == 0) {
return SymbolConstant.NULL;
}
final StringSink sink = Misc.getThreadLocalBuilder();
sink.put(value);
return SymbolConstant.newInstance(Chars.toString(sink));
}
return new Func(arg);
}
use of io.questdb.std.str.StringSink in project questdb by questdb.
the class CastIntToSymbolFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
final Function arg = args.getQuick(0);
if (arg.isConstant()) {
final StringSink sink = Misc.getThreadLocalBuilder();
sink.put(arg.getInt(null));
return SymbolConstant.newInstance(sink);
}
return new Func(arg);
}
Aggregations