Search in sources :

Example 11 with BLangStreamingInput

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput in project ballerina by ballerina-lang.

the class SemanticAnalyzer method visit.

public void visit(BLangStreamingInput streamingInput) {
    BLangExpression streamRef = (BLangExpression) streamingInput.getStreamReference();
    typeChecker.checkExpr(streamRef, env);
    WhereNode beforeWhereNode = streamingInput.getBeforeStreamingCondition();
    if (beforeWhereNode != null) {
        ((BLangWhere) beforeWhereNode).accept(this);
    }
    WindowClauseNode windowClauseNode = streamingInput.getWindowClause();
    if (windowClauseNode != null) {
        ((BLangWindow) windowClauseNode).accept(this);
    }
    WhereNode afterWhereNode = streamingInput.getAfterStreamingCondition();
    if (afterWhereNode != null) {
        ((BLangWhere) afterWhereNode).accept(this);
    }
}
Also used : BLangWindow(org.wso2.ballerinalang.compiler.tree.clauses.BLangWindow) WhereNode(org.ballerinalang.model.tree.clauses.WhereNode) WindowClauseNode(org.ballerinalang.model.tree.clauses.WindowClauseNode) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 12 with BLangStreamingInput

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput in project ballerina by ballerina-lang.

the class TypeChecker method visit.

@Override
public void visit(BLangStreamingInput streamingInput) {
    BLangExpression varRef = (BLangExpression) streamingInput.getStreamReference();
    varRef.accept(this);
}
Also used : BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Example 13 with BLangStreamingInput

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput in project ballerina by ballerina-lang.

the class SqlQueryBuilder method visit.

@Override
public void visit(BLangJoinStreamingInput joinStreamingInput) {
    BLangBinaryExpr expr = (BLangBinaryExpr) joinStreamingInput.getOnExpression();
    BLangStreamingInput streamingInput = (BLangStreamingInput) joinStreamingInput.getStreamingInput();
    joinStreamingInputClause = new StringBuilder();
    streamingInput.accept(this);
    joinStreamingInputClause.append("join ").append(streamingInputClause).append(" on ");
    addParametrizedSQL(expr, joinStreamingInputClause, joinOnExprParams);
}
Also used : BLangBinaryExpr(org.wso2.ballerinalang.compiler.tree.expressions.BLangBinaryExpr) BLangStreamingInput(org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput)

Example 14 with BLangStreamingInput

use of org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput in project ballerina by ballerina-lang.

the class SqlQueryBuilder method visit.

@Override
public void visit(BLangStreamingInput streamingInput) {
    streamingInputClause = new StringBuilder();
    BLangExpression tableReference = (BLangExpression) streamingInput.getStreamReference();
    tableReference.accept(this);
    exprStack.pop();
    streamingInputClause.append("(select * from [[tableName]]");
    WhereNode where = streamingInput.getBeforeStreamingCondition();
    if (where == null) {
        where = streamingInput.getAfterStreamingCondition();
    }
    /* for tables there can only be one whereClause and there is no windowClause.
         So we don't care about the windowClause. */
    if (where != null) {
        ((BLangWhere) where).accept(this);
        streamingInputClause.append(" ").append(whereClause);
    }
    streamingInputClause.append(")");
    if (streamingInput.getAlias() != null) {
        streamingInputClause.append(" as ").append(streamingInput.getAlias());
    }
}
Also used : WhereNode(org.ballerinalang.model.tree.clauses.WhereNode) BLangWhere(org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere) BLangExpression(org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)

Aggregations

BLangStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamingInput)10 BLangJoinStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangJoinStreamingInput)6 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)5 JoinStreamingInput (org.ballerinalang.model.tree.clauses.JoinStreamingInput)4 StreamingInput (org.ballerinalang.model.tree.clauses.StreamingInput)4 BLangPatternStreamingInput (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternStreamingInput)4 WhereNode (org.ballerinalang.model.tree.clauses.WhereNode)3 BLangOrderBy (org.wso2.ballerinalang.compiler.tree.clauses.BLangOrderBy)3 BLangSelectClause (org.wso2.ballerinalang.compiler.tree.clauses.BLangSelectClause)3 BLangWhere (org.wso2.ballerinalang.compiler.tree.clauses.BLangWhere)3 OrderByNode (org.ballerinalang.model.tree.clauses.OrderByNode)2 SelectClauseNode (org.ballerinalang.model.tree.clauses.SelectClauseNode)2 WindowClauseNode (org.ballerinalang.model.tree.clauses.WindowClauseNode)2 BLangPatternClause (org.wso2.ballerinalang.compiler.tree.clauses.BLangPatternClause)2 BLangStreamAction (org.wso2.ballerinalang.compiler.tree.clauses.BLangStreamAction)2 BLangWindow (org.wso2.ballerinalang.compiler.tree.clauses.BLangWindow)2 BLangBinaryExpr (org.wso2.ballerinalang.compiler.tree.expressions.BLangBinaryExpr)2 OutputRateLimitNode (org.ballerinalang.model.tree.clauses.OutputRateLimitNode)1 PatternClause (org.ballerinalang.model.tree.clauses.PatternClause)1 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)1