use of io.questdb.griffin.engine.functions.date.ToStrDateFunctionFactory in project questdb by bluestreak01.
the class FunctionParserTest method testNoArgFunction.
@Test
public void testNoArgFunction() throws SqlException {
functions.add(new SysdateFunctionFactory());
functions.add(new ToStrDateFunctionFactory());
FunctionParser functionParser = new FunctionParser(new DefaultCairoConfiguration(root) {
@Override
public MillisecondClock getMillisecondClock() {
return () -> {
try {
return DateFormatUtils.parseUTCDate("2018-03-04T21:40:00.000Z");
} catch (NumericException e) {
Assert.fail();
}
return 0;
};
}
}, new FunctionFactoryCache(configuration, functions));
Function function = parseFunction("to_str(sysdate(), 'EE, dd-MMM-yyyy HH:mm:ss')", new GenericRecordMetadata(), functionParser);
TestUtils.assertEquals("Sunday, 04-Mar-2018 21:40:00", function.getStr(null));
}
Aggregations