@Test public void testConstVarArgFunction() throws SqlException { functions.add(new InStrFunctionFactory()); final GenericRecordMetadata metadata = new GenericRecordMetadata(); metadata.add(new TableColumnMetadata("a", ColumnType.STRING)); FunctionParser functionParser = createFunctionParser(); Function function = parseFunction("a in ('xu', 'yk')", metadata, functionParser); Assert.assertEquals(ColumnType.BOOLEAN, function.getType()); Assert.assertTrue(function.getBool(new Record() { @Override public CharSequence getStr(int col) { return "yk"; } })); }
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();  }