public BaseType transformUp(PartialFunction<BaseType, BaseType> rule) {
        BaseType afterRuleOnChildren = transformChildren(rule, TreeNode::transformUp);
        if (this.fastEquals(afterRuleOnChildren)) {
            return rule.applyOrElse((BaseType) this, identity());
        } else {
            return rule.applyOrElse(afterRuleOnChildren, identity());
        }
    }
Collect the elements produced by `f` and not null.
indexr-query-opt/src/main/java/io/indexr/query/TreeNode.java