AMashenkov commented on code in PR #5916: URL: https://github.com/apache/ignite-3/pull/5916#discussion_r2113463679
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/explain/RelTreeToTextWriter.java: ########## @@ -0,0 +1,431 @@ +/* + * 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 org.apache.ignite.internal.sql.engine.rel.explain; + +import static org.apache.ignite.internal.sql.engine.rel.explain.ExplainUtils.inputRefRewriter; + +import it.unimi.dsi.fastutil.objects.ObjectIntPair; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Deque; +import java.util.EnumMap; +import java.util.List; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import org.apache.calcite.avatica.util.Spacer; +import org.apache.calcite.linq4j.Ord; +import org.apache.calcite.plan.RelOptTable; +import org.apache.calcite.rel.RelCollation; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.core.AggregateCall; +import org.apache.calcite.rel.core.CorrelationId; +import org.apache.calcite.rel.core.JoinRelType; +import org.apache.calcite.rel.core.SetOp; +import org.apache.calcite.rel.core.TableModify; +import org.apache.calcite.rel.metadata.RelMetadataQuery; +import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.rex.RexLiteral; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.rex.RexShuttle; +import org.apache.calcite.util.ImmutableBitSet; +import org.apache.ignite.internal.sql.engine.prepare.bounds.SearchBounds; +import org.apache.ignite.internal.sql.engine.rel.IgniteRel; +import org.apache.ignite.internal.sql.engine.schema.IgniteIndex; +import org.apache.ignite.internal.sql.engine.trait.IgniteDistribution; +import org.apache.ignite.internal.sql.engine.util.Commons; +import org.apache.ignite.lang.util.IgniteNameUtils; +import org.apache.ignite.table.QualifiedNameHelper; + +class RelTreeToTextWriter { + private static final int NEXT_OPERATOR_INDENT = 2; + private static final int OPERATOR_ATTRIBUTES_INDENT = 2 * NEXT_OPERATOR_INDENT; + + private static boolean needToAddFieldNames(IgniteRel rel) { + List<RelNode> inputs = rel.getInputs(); + + // Current rel is leaf node of the plan, therefore it's data source. + // Every data source introduces their own row type, so let's include field names. + if (inputs.isEmpty()) { + return true; + } + + // Set operations doesn't change the row. + if (rel instanceof SetOp) { + return false; + } + + assert inputs.size() == 1 || inputs.size() == 2; + Review Comment: Does it make sense to do a fast check here, like this: `if (input.size == 1 && rel.getRowType() == inputs.get(0).getRowType()) return false;` (I'm not sure if it would better comparing rowType by equals) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org