com.hazelcast.org.apache.calcite.rel.mutable.MutableRel Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.org.apache.calcite.rel.mutable;
import com.hazelcast.org.apache.calcite.avatica.util.Spaces;
import com.hazelcast.org.apache.calcite.plan.RelOptCluster;
import com.hazelcast.org.apache.calcite.rel.RelNode;
import com.hazelcast.org.apache.calcite.rel.type.RelDataType;
import com.hazelcast.com.google.common.base.Equivalence;
import com.hazelcast.com.google.common.collect.Lists;
import java.util.List;
import java.util.Objects;
/** Mutable equivalent of {@link RelNode}.
*
* Each node has mutable state, and keeps track of its parent and position
* within parent.
* It doesn't make sense to canonize {@code MutableRels},
* otherwise one node could end up with multiple parents.
* It follows that {@code #hashCode} and {@code #equals} are less efficient
* than their {@code RelNode} counterparts.
* But, you don't need to copy a {@code MutableRel} in order to change it.
* For this reason, you should use {@code MutableRel} for short-lived
* operations, and transcribe back to {@code RelNode} when you are done.
*/
public abstract class MutableRel {
/** Equivalence that compares objects by their {@link Object#toString()}
* method. */
protected static final Equivalence