Using an OR here is going to be a problem. Other expressions besides RowValueConstructorParseNode have children. For example, with built-in functions, the children are the arguments. So this loop will be entered with the rhs being a RVC and the lhs being a function. Then you'd start checking the comparability of the RVC elements with the function arguments which isn't right.

I think you need to go back to the logic you had before:

      if (lhsNode instanceof RowValueConstructorParseNode && rhsNode instanceof RowValueConstructorParseNode) {
      } else if (lhsNode instanceof RowValueConstructorParseNode) {
      } else if (rhsNode instanceof RowValueConstructorParseNode) {
      }