use of io.questdb.griffin.engine.functions.constants.StrConstant in project questdb by bluestreak01.
the class CastTimestampToStrFunctionFactory 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.getTimestamp(null));
return new StrConstant(Chars.toString(sink));
}
return new Func(args.getQuick(0));
}
use of io.questdb.griffin.engine.functions.constants.StrConstant in project questdb by bluestreak01.
the class CastIntToStrFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
Function intFunc = args.getQuick(0);
if (intFunc.isConstant()) {
StringSink sink = Misc.getThreadLocalBuilder();
sink.put(intFunc.getInt(null));
return new StrConstant(Chars.toString(sink));
}
return new Func(args.getQuick(0));
}
use of io.questdb.griffin.engine.functions.constants.StrConstant in project questdb by bluestreak01.
the class CastShortToStrFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
Function intFunc = args.getQuick(0);
if (intFunc.isConstant()) {
final StringSink sink = Misc.getThreadLocalBuilder();
sink.put(intFunc.getShort(null));
return new StrConstant(Chars.toString(sink));
}
return new Func(args.getQuick(0));
}
use of io.questdb.griffin.engine.functions.constants.StrConstant in project questdb by bluestreak01.
the class CastLongToStrFunctionFactory 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.getLong(null));
return new StrConstant(Chars.toString(sink));
}
return new Func(args.getQuick(0));
}
use of io.questdb.griffin.engine.functions.constants.StrConstant in project questdb by bluestreak01.
the class CastFloatToStrFunctionFactory method newInstance.
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration, SqlExecutionContext sqlExecutionContext) {
Function intFunc = args.getQuick(0);
if (intFunc.isConstant()) {
final StringSink sink = Misc.getThreadLocalBuilder();
sink.put(intFunc.getFloat(null), configuration.getFloatToStrCastScale());
return new StrConstant(Chars.toString(sink));
}
return new Func(args.getQuick(0), configuration.getFloatToStrCastScale());
}
Aggregations