in bigquery-antipattern-recognition/src/main/java/com/google/zetasql/toolkit/antipattern/parser/visitors/rownum/SearchRowNumFilterInWhereVisitor.java [32:46]
public void visit(ASTNodes.ASTBinaryExpression filterNode) {
if(foundFilter) {
return;
}
ASTNodes.ASTExpression lhs = filterNode.getLhs();
ASTNodes.ASTExpression rhs = filterNode.getRhs();
if(lhs instanceof ASTNodes.ASTPathExpression && rhs instanceof ASTNodes.ASTIntLiteral) {
ASTNodes.ASTPathExpression lhsPathExp = (ASTNodes.ASTPathExpression) lhs;
ASTNodes.ASTIntLiteral rhsIntLit = (ASTNodes.ASTIntLiteral) rhs;
if(lhsPathExp.getNames().get(0).getIdString().equals(rowNumColAlias) && rhsIntLit.getImage().equals("1")){
foundFilter = true;
filterWithRowNumNode = filterNode;
}
}
}