@Test public void testByteAndShortToIntCast() throws SqlException { functions.add(new AddIntFunctionFactory()); final GenericRecordMetadata metadata = new GenericRecordMetadata(); metadata.add(new TableColumnMetadata("a", ColumnType.BYTE)); metadata.add(new TableColumnMetadata("b", ColumnType.SHORT)); FunctionParser functionParser = createFunctionParser(); Function function = parseFunction("a+b", metadata, functionParser); Assert.assertEquals(ColumnType.INT, function.getType()); Assert.assertEquals(33, function.getInt(new Record() { @Override public byte getByte(int col) { return 12; } @Override public short getShort(int col) { return 21; } })); }
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();  }