@Override
public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException {
PDataType dataType = children.get(0).getDataType();
String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string
Format formatter = null;
FunctionArgumentType type;
if (dataType.isCoercibleTo(PDataType.TIMESTAMP)) {
if (formatString == null) {
formatString = context.getDateFormat();
formatter = context.getDateFormatter();