@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.parseDateTime("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)); }
public Function parseFunction( ExpressionNode node, RecordMetadata metadata, SqlExecutionContext executionContext ) throws SqlException { this.sqlExecutionContext = executionContext; if (this.metadata != null) { metadataStack.push(this.metadata); } try { this.metadata = metadata; traverseAlgo.traverse(node, this); return stack.poll(); } finally { if (metadataStack.size() == 0) { this.metadata = null; } else { this.metadata = metadataStack.poll(); } } }
FunctionParser implements PostOrderTreeTraversalAlgo.Visitor { public Function parseFunction( ExpressionNode node, RecordMetadata metadata, SqlExecutionContext executionContext ) throws SqlException { this.sqlExecutionContext = executionContext; if (this.metadata != null) { metadataStack.push(this.metadata); } try { this.metadata = metadata; traverseAlgo.traverse(node, this); return stack.poll(); } finally { if (metadataStack.size() == 0) { this.metadata = null; } else { this.metadata = metadataStack.poll(); } } } }
FunctionParser implements PostOrderTreeTraversalAlgo.Visitor { public Function parseFunction( ExpressionNode node, RecordMetadata metadata, SqlExecutionContext executionContext ) throws SqlException { this.sqlExecutionContext = executionContext; if (this.metadata != null) { metadataStack.push(this.metadata); } try { this.metadata = metadata; traverseAlgo.traverse(node, this); return stack.poll(); } finally { if (metadataStack.size() == 0) { this.metadata = null; } else { this.metadata = metadataStack.poll(); } } } FunctionParser(CairoConfiguration configuration, FunctionFactoryCache functionFactoryCache); }
FunctionParser implements PostOrderTreeTraversalAlgo.Visitor { public Function parseFunction( ExpressionNode node, RecordMetadata metadata, SqlExecutionContext executionContext ) throws SqlException { this.sqlExecutionContext = executionContext; if (this.metadata != null) { metadataStack.push(this.metadata); } try { this.metadata = metadata; traverseAlgo.traverse(node, this); return stack.poll(); } finally { if (metadataStack.size() == 0) { this.metadata = null; } else { this.metadata = metadataStack.poll(); } } } FunctionParser(CairoConfiguration configuration, FunctionFactoryCache functionFactoryCache); static int getArgType(char c); static int validateSignatureAndGetNameSeparator(String sig); Function createIndexParameter(int variableIndex, ExpressionNode node); Function createNamedParameter(ExpressionNode node); Function parseFunction(
            ExpressionNode node,
            RecordMetadata metadata,
            SqlExecutionContext executionContext
    ); void setSqlCodeGenerator(SqlCodeGenerator sqlCodeGenerator); @Override void visit(ExpressionNode node); boolean isGroupBy(CharSequence token); int getFunctionCount(); }
FunctionParser implements PostOrderTreeTraversalAlgo.Visitor { public Function parseFunction( ExpressionNode node, RecordMetadata metadata, SqlExecutionContext executionContext ) throws SqlException { this.sqlExecutionContext = executionContext; if (this.metadata != null) { metadataStack.push(this.metadata); } try { this.metadata = metadata; traverseAlgo.traverse(node, this); return stack.poll(); } finally { if (metadataStack.size() == 0) { this.metadata = null; } else { this.metadata = metadataStack.poll(); } } } FunctionParser(CairoConfiguration configuration, FunctionFactoryCache functionFactoryCache); static int getArgType(char c); static int validateSignatureAndGetNameSeparator(String sig); Function createIndexParameter(int variableIndex, ExpressionNode node); Function createNamedParameter(ExpressionNode node); Function parseFunction(
            ExpressionNode node,
            RecordMetadata metadata,
            SqlExecutionContext executionContext
    ); void setSqlCodeGenerator(SqlCodeGenerator sqlCodeGenerator); @Override void visit(ExpressionNode node); boolean isGroupBy(CharSequence token); int getFunctionCount();  }