@Override public ParseTree visitChildInternal(RelNode child, int ordinal) { final Convention convention = child.getConvention(); if (!(child instanceof JavaRel)) { throw Util.newInternal( "Relational expression '" + child + "' has '" + convention + "' calling convention, so must implement interface " + JavaRel.class); } JavaRel javaRel = (JavaRel) child; final ParseTree p = javaRel.implement(this); if ((convention == CallingConvention.JAVA) && (p != null)) { throw Util.newInternal( "Relational expression '" + child + "' returned '" + p + " on implement, but should have " + "returned null, because it has JAVA calling-convention. " + "(Note that similar calling-conventions, such as " + "Iterator, must return a value.)"); } return p; }