AMashenkov commented on code in PR #2372: URL: https://github.com/apache/ignite-3/pull/2372#discussion_r1279278045
########## modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestStatistic.java: ########## @@ -0,0 +1,78 @@ +/* + * 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.framework; + +import java.util.Collections; +import java.util.List; +import org.apache.calcite.rel.RelCollation; +import org.apache.calcite.rel.RelDistribution; +import org.apache.calcite.rel.RelReferentialConstraint; +import org.apache.calcite.schema.Statistic; +import org.apache.calcite.util.ImmutableBitSet; + +/** + * A test statistic that implements all the necessary for the optimizer methods to be used to prepare a query. + */ +public class TestStatistic implements Statistic { Review Comment: Because I would like to omit any logic, production implementation either require MinRows supplier in constructor, or will implicitly use MIN_ROW=10_000 hardcoded constant. ``` public final Double getRowCount() { double localRowCnt = rowCountSupplier.getAsDouble(); // Forbid zero result, to prevent zero cost for table and index scans. double minRows = this.minRows.getAsDouble(); return Math.max(minRows, localRowCnt); } ``` So, using prod implementation, I must take it's guarantees into account, but in most of planner tests, I don't want to care of it. ########## modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestStatistic.java: ########## @@ -0,0 +1,78 @@ +/* + * 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.framework; + +import java.util.Collections; +import java.util.List; +import org.apache.calcite.rel.RelCollation; +import org.apache.calcite.rel.RelDistribution; +import org.apache.calcite.rel.RelReferentialConstraint; +import org.apache.calcite.schema.Statistic; +import org.apache.calcite.util.ImmutableBitSet; + +/** + * A test statistic that implements all the necessary for the optimizer methods to be used to prepare a query. + */ +public class TestStatistic implements Statistic { Review Comment: Because I would like to omit any logic, production implementation either require MinRows supplier in constructor, or will implicitly use MIN_ROW=10_000 hardcoded constant. ``` public final Double getRowCount() { double localRowCnt = rowCountSupplier.getAsDouble(); // Forbid zero result, to prevent zero cost for table and index scans. double minRows = this.minRows.getAsDouble(); return Math.max(minRows, localRowCnt); } ``` So, using prod implementation, I must take it's guarantees into account, but in most of planner tests, I don't want to care of it. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
