From 019b379460db58046e843a632a1a819577e76ee0 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 20 Apr 2026 15:56:20 +0300 Subject: [PATCH 01/39] WIP. Fix plans for tpch --- .../calcite/integration/tpch/TpchHelper.java | 2 +- .../tpc/AbstractTpcQueryPlannerTest.java | 238 +++++++++++++++++ .../calcite/planner/tpc/TpcScaleFactor.java | 34 +++ .../query/calcite/planner/tpc/TpcTable.java | 63 +++++ .../query/calcite/planner/tpc/TpchHelper.java | 93 +++++++ .../planner/tpc/TpchQueryPlannerTest.java | 48 ++++ .../query/calcite/planner/tpc/TpchTables.java | 251 ++++++++++++++++++ .../test/resources/tpch/ddl/customer_ddl.sql | 19 ++ .../test/resources/tpch/ddl/lineitem_ddl.sql | 32 +++ .../test/resources/tpch/ddl/nation_ddl.sql | 15 ++ .../test/resources/tpch/ddl/orders_ddl.sql | 21 ++ .../src/test/resources/tpch/ddl/part_ddl.sql | 18 ++ .../test/resources/tpch/ddl/partsupp_ddl.sql | 17 ++ .../test/resources/tpch/ddl/region_ddl.sql | 12 + .../test/resources/tpch/ddl/supplier_ddl.sql | 18 ++ .../calcite/src/test/resources/tpch/q1.sql | 24 ++ 16 files changed, 904 insertions(+), 1 deletion(-) create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java create mode 100644 modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql create mode 100644 modules/calcite/src/test/resources/tpch/q1.sql diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java index e381b6d39f24a..07642349ff899 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java @@ -450,7 +450,7 @@ private static boolean allServersHaveStatistics(Ignite ignite, String tableName) * @param sql SQL query. * @param params Query parameters. */ - private static List> sql(Ignite ignite, String sql, Object... params) { + public static List> sql(Ignite ignite, String sql, Object... params) { SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(params); try (FieldsQueryCursor> cur = ((IgniteEx)ignite).context().query().querySqlFields(qry, false)) { diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java new file mode 100644 index 0000000000000..68f432ad9142d --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -0,0 +1,238 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UncheckedIOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; +import java.util.regex.Pattern; +import com.google.common.io.CharStreams; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper; +import org.apache.ignite.internal.processors.query.calcite.planner.AbstractPlannerTest; +import org.junit.Test; + +import static org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper.sql; +import static org.apache.logging.log4j.util.Cast.cast; + +/** + * Abstract test class to ensure a planner generates optimal plan for TPC queries. + */ +public abstract class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { + private static final boolean updatePlan = false; + + private static final Pattern COSTS_PATTERN = Pattern.compile("\\s+est: \\(rows=\\d+\\)"); + + private static IgniteEx srv; + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + super.beforeTestsStarted(); + + srv = startGrid(); + + TpcTable[] tables = cast(tables().getEnumConstants()); + + for (TpcTable table : tables) + scriptToQueries(table.ddlScript()).forEach(q -> sql(srv, q)); + } + + @Test + public void testQueries() throws Exception { + Files.list(Path.of("./src/test/resources", name())) + .filter(p -> p.toString().endsWith(".sql")) + .map(this::queryId) + .forEach(this::validateQueryPlan); + } + + private void validateQueryPlan(String queryId) { + String[] actualPlans = queryPlan(queryString(queryId)); + + if (updatePlan) { + updateQueryPlan(queryId, actualPlans); + return; + } + + String[] expectedPlans = expectedQueryPlan(queryId).split("----(\\r\\n|\\n|\\r)"); + + assert expectedPlans.length == actualPlans.length : "Unexpected number of plans, got: " + actualPlans.length + + ", expected: " + expectedPlans.length; + + int pos = 0; + + for (String actualPlan : actualPlans) { + String expectedPlan = expectedPlans[pos++]; + + // Internally, costs are represented by double values and conversion to exact numeric representation + // may differs from JVM to JVM. + // https://www.oracle.com/java/technologies/javase/19-relnote-issues.html + // Cut-off costs, which may differ between runs, before comparing plans. + expectedPlan = COSTS_PATTERN.matcher(expectedPlan).replaceAll(""); + actualPlan = COSTS_PATTERN.matcher(actualPlan).replaceAll(""); + + assertEquals(expectedPlan, actualPlan); + } + } + + static String loadFromResource(String resource) { + try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) { + if (is == null) { + throw new IllegalArgumentException("Resource does not exist: " + resource); + } + try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { + return CharStreams.toString(reader); + } + } catch (IOException e) { + throw new UncheckedIOException("I/O operation failed: " + resource, e); + } + } + + private static T invoke(Method method, Object... arguments) { + try { + return (T) method.invoke(null, arguments); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + } + + static void updateQueryPlan(String queryId, Path targetDirectory, String... newPlans) { + // A targetDirectory must be specified by hand when expected plans are generated. + if (targetDirectory == null) { + throw new RuntimeException("Please provide target directory to where save generated plans." + + " Usually plans are kept in resource folder of tests within the same module."); + } + + // variant query ends with "v" + boolean variant = queryId.endsWith("v"); + int numericId; + + if (variant) { + String idString = queryId.substring(0, queryId.length() - 1); + numericId = Integer.parseInt(idString); + } else { + numericId = Integer.parseInt(queryId); + } + + Path planLocation; + if (variant) { + planLocation = targetDirectory.resolve(String.format("variant_q%d.plan", numericId)); + } else { + planLocation = targetDirectory.resolve(String.format("q%s.plan", numericId)); + } + + try { + Files.createDirectories(targetDirectory); + + String plans = String.join("----" + System.lineSeparator(), newPlans); + Files.writeString(planLocation, plans); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + String expectedQueryPlan(String queryId) { + // variant query ends with "v" + boolean variant = queryId.endsWith("v"); + int numericId; + + if (variant) { + String idString = queryId.substring(0, queryId.length() - 1); + numericId = Integer.parseInt(idString); + } else { + numericId = Integer.parseInt(queryId); + } + + if (variant) { + var variantQueryFile = String.format("%s/plan/variant_q%d.plan", name(), numericId); + return loadFromResource(variantQueryFile); + } else { + var queryFile = String.format("%s/plan/q%s.plan", name(), numericId); + return loadFromResource(queryFile); + } + } + + private String queryId(Path p) { + String name = p.getFileName().toString(); + + return name.substring(1).replace(".sql", ""); + } + + private String[] queryPlan(String sqlScript) { + List queries = scriptToQueries(sqlScript); + + assertEquals("Query file must contain single query", 1, queries.size()); + + List> plan = sql(srv, "EXPLAIN PLAN FOR " + queries.get(0)); + + String[] res = new String[plan.size()]; + + for (int i = 0; i < plan.size(); i++) { + assertEquals(1, plan.get(i).size()); + + res[i] = plan.get(i).get(0).toString(); + } + + return res; + } + + private static List scriptToQueries(String sqlScript) { + List queries = new ArrayList<>(); + + Scanner sc = new Scanner(sqlScript); + + StringBuilder current = new StringBuilder(); + + while (sc.hasNextLine()) { + String line = sc.nextLine().trim(); + + if (line.startsWith("--") || line.isEmpty()) + continue; + + current.append(line).append(''); + + if (line.endsWith(";")) { + queries.add(current.toString()); + + current = new StringBuilder(); + } + } + + if (current.length() > 0) + queries.add(current.toString()); + + return queries; + } + + abstract String queryString(String queryId); + + abstract void updateQueryPlan(String queryId, String... newPlans); + + /** Returns name of the SQL test. */ + abstract String name(); + + abstract Class> tables(); +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java new file mode 100644 index 0000000000000..3b2162c60751a --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java @@ -0,0 +1,34 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +/** + * Enumerates scale factors supported for TPC tables. + */ +public enum TpcScaleFactor { + SF_1GB, SF_1TB, SF_3TB, SF_10TB, SF_30TB, SF_100TB; + + /** + * Returns size that corresponds for current scale factor. + */ + public long size(long... sizes) { + assert sizes.length == values().length; + + return sizes[ordinal()]; + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java new file mode 100644 index 0000000000000..aa96f98f775e8 --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java @@ -0,0 +1,63 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Iterator; + +/** A table from TPC suite. */ +public interface TpcTable { + /** Returns name of the table. */ + String tableName(); + + /** Returns number of column in the table. */ + int columnsCount(); + + /** Returns name of the column with given 0-based index. */ + String columnName(int idx); + + /** Returns definition of a table including necessary indexes. */ + String ddlScript(); + + /** + * Returns DML string representing single-row INSERT statement with dynamic parameters placeholders. + * + *

The order of columns matches the order provided in table declaration, i.e. it's the same + * order like in output of {@code SELECT * FROM table_name} statement, as well as the same order + * in which column names are returned from {@link #columnName(int)} method. + * + *

The statement returned is tolerant to columns' type mismatch, implying you + * can use any value while there is cast from provided value to required type. + */ + String insertPrepareStatement(); + + /** + * Returns iterator returning rows of the corresponding table. + * + *

May be used to fill the table via KV API or SQL API. + * + * @param pathToDataset A path to a directory with CSV file containing data for the table. + * @return Iterator over data of the table. + * @throws IOException In case of error. + */ + Iterator dataProvider(Path pathToDataset) throws IOException; + + /** Returns estimated size of a table for given scale factor. */ + long estimatedSize(TpcScaleFactor sf); +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java new file mode 100644 index 0000000000000..03bf03d401b0d --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java @@ -0,0 +1,93 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import com.google.common.io.CharStreams; + +/** + * Provides utility methods to work with queries defined by the TPC-H benchmark. + */ +public final class TpchHelper { + public static final String INT32 = "INT32"; + + public static final String DECIMAL = "DECIMAL"; + + public static final String STRING = "VARCHAR"; + + public static final String DATE = "DATE"; + + + private TpchHelper() { + } + + /** + * Loads a TPC-H query given a query identifier. Query identifier can be in the following forms: + *

    + *
  • query id - a number, e.g. {@code 14}. Queries are stored in files named q{id}.sql.
  • + *
  • query variant id, a number and 'v' suffix - {@code 12v}. Query variants are stored in files + * named variant_q{numeric_id}.sql.
  • + *
+ * + * @param queryId The identifier of a query. + * @return An SQL query. + */ + public static String getQuery(String queryId) { + // variant query ends with "v" + boolean variant = queryId.endsWith("v"); + int numericId; + + if (variant) { + String idString = queryId.substring(0, queryId.length() - 1); + numericId = Integer.parseInt(idString); + } else { + numericId = Integer.parseInt(queryId); + } + + if (variant) { + var variantQueryFile = String.format("tpch/variant_q%d.sql", numericId); + return loadFromResource(variantQueryFile); + } else { + var queryFile = String.format("tpch/q%s.sql", numericId); + return loadFromResource(queryFile); + } + } + + /** + * Loads resource with given name as string. + * + * @param resource Name of the resource to load. + * @return Resource as string. + */ + public static String loadFromResource(String resource) { + try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) { + if (is == null) { + throw new IllegalArgumentException("Resource does not exist: " + resource); + } + try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { + return CharStreams.toString(reader); + } + } catch (IOException e) { + throw new UncheckedIOException("I/O operation failed: " + resource, e); + } + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java new file mode 100644 index 0000000000000..ca7e8bd64a58c --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java @@ -0,0 +1,48 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +import java.nio.file.Path; + +/** + * Tests ensures a planner generates optimal plan for TPC-H queries. + * + * @code org.apache.ignite.internal.sql.engine.benchmarks.TpchParseBenchmark + */ +public class TpchQueryPlannerTest extends AbstractTpcQueryPlannerTest { + /** {@inheritDoc} */ + @Override public String queryString(String queryId) { + return TpchHelper.getQuery(queryId); + } + + /** {@inheritDoc} */ + @Override public void updateQueryPlan(String queryId, String... newPlans) { + Path targetDirectory = Path.of("./src/test/resources/tpch/plan"); + updateQueryPlan(queryId, targetDirectory, newPlans); + } + + /** {@inheritDoc} */ + @Override String name() { + return "tpch"; + } + + /** {@inheritDoc} */ + @Override Class> tables() { + return TpchTables.class; + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java new file mode 100644 index 0000000000000..dbfd6cbe548cd --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java @@ -0,0 +1,251 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +import java.io.IOException; +import java.math.BigDecimal; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.LocalDate; +import java.util.Iterator; + +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.DATE; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.DECIMAL; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.INT32; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.STRING; + +/** + * Enumeration of tables from TPC-H specification. + */ +@SuppressWarnings("NonSerializableFieldInSerializableClass") +public enum TpchTables implements TpcTable { + LINEITEM( + new long[] {6_001_215, 5_999_989_709L, 18_000_048_306L, 59_999_994_267L, 179_999_978_268L, 599_999_969_200L}, + new Column("L_ORDERKEY", INT32), + new Column("L_PARTKEY", INT32), + new Column("L_SUPPKEY", INT32), + new Column("L_LINENUMBER", INT32), + new Column("L_QUANTITY", DECIMAL), + new Column("L_EXTENDEDPRICE", DECIMAL), + new Column("L_DISCOUNT", DECIMAL), + new Column("L_TAX", DECIMAL), + new Column("L_RETURNFLAG", STRING), + new Column("L_LINESTATUS", STRING), + new Column("L_SHIPDATE", DATE), + new Column("L_COMMITDATE", DATE), + new Column("L_RECEIPTDATE", DATE), + new Column("L_SHIPINSTRUCT", STRING), + new Column("L_SHIPMODE", STRING), + new Column("L_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::integer, ?::integer, ?::integer," + + "?::decimal(15, 2), ?::decimal(15, 2), ?::decimal(15, 2)," + + "?::decimal(15, 2), ?::char(1), ?::char(1), ?::date," + + "?::date, ?::date, ?::char(25), ?::char(10), ?::varchar(44));"; + } + }, + + PART( + new long[] {200_000, 200_000_000, 600_000_000, 2_000_000_000, 6_000_000_000L, 20_000_000_000L}, + new Column("P_PARTKEY", INT32), + new Column("P_NAME", STRING), + new Column("P_MFGR", STRING), + new Column("P_BRAND", STRING), + new Column("P_TYPE", STRING), + new Column("P_SIZE", INT32), + new Column("P_CONTAINER", STRING), + new Column("P_RETAILPRICE", DECIMAL), + new Column("P_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::varchar(55), ?::char(25)," + + "?::char(10), ?::varchar(25), ?::integer," + + "?::char(10), ?::decimal(15, 2), ?::varchar(23));"; + } + }, + + SUPPLIER( + new long[] {10_000, 10_000_000, 30_000_000, 100_000_000, 300_000_000, 1_000_000_000}, + new Column("S_SUPPKEY", INT32), + new Column("S_NAME", STRING), + new Column("S_ADDRESS", STRING), + new Column("S_NATIONKEY", INT32), + new Column("S_PHONE", STRING), + new Column("S_ACCTBAL", DECIMAL), + new Column("S_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::char(25), ?::varchar(40)," + + "?::integer, ?::char(15), ?::decimal(15, 2), ?::varchar(101));"; + } + }, + + PARTSUPP( + new long[] {800_000, 800_000_000, 2_400_000_000L, 8_000_000_000L, 24_000_000_000L, 80_000_000_000L}, + new Column("PS_PARTKEY", INT32), + new Column("PS_SUPPKEY", INT32), + new Column("PS_AVAILQTY", INT32), + new Column("PS_SUPPLYCOST", DECIMAL), + new Column("PS_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::integer, ?::integer," + + "?::decimal(15, 2), ?::varchar(199));"; + } + }, + + NATION( + new long[] {25, 25, 25, 25, 25, 25}, + new Column("N_NATIONKEY", INT32), + new Column("N_NAME", STRING), + new Column("N_REGIONKEY", INT32), + new Column("N_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::char(25), ?::integer, ?::varchar(152));"; + } + }, + + REGION( + new long[] {5, 5, 5, 5, 5, 5}, + new Column("R_REGIONKEY", INT32), + new Column("R_NAME", STRING), + new Column("R_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::char(25), ?::varchar(152));"; + } + }, + + ORDERS( + new long[] {1_500_000, 1_500_000_000, 4_500_000_000L, 15_000_000_000L, 45_000_000_000L, 150_000_000_000L}, + new Column("O_ORDERKEY", INT32), + new Column("O_CUSTKEY", INT32), + new Column("O_ORDERSTATUS", STRING), + new Column("O_TOTALPRICE", DECIMAL), + new Column("O_ORDERDATE", DATE), + new Column("O_ORDERPRIORITY", STRING), + new Column("O_CLERK", STRING), + new Column("O_SHIPPRIORITY", INT32), + new Column("O_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::integer, ?::char(1)," + + "?::decimal(15, 2), ?::date, ?::char(15)," + + "?::char(15), ?::integer, ?::varchar(79));"; + } + }, + + CUSTOMER( + new long[] {150_000, 150_000_000, 450_000_000L, 1_500_000_000L, 4_500_000_000L, 15_000_000_000L}, + new Column("C_CUSTKEY", INT32), + new Column("C_NAME", STRING), + new Column("C_ADDRESS", STRING), + new Column("C_NATIONKEY", INT32), + new Column("C_PHONE", STRING), + new Column("C_ACCTBAL", DECIMAL), + new Column("C_MKTSEGMENT", STRING), + new Column("C_COMMENT", STRING) + ) { + @Override public String insertPrepareStatement() { + return "INSERT INTO " + tableName() + " VALUES (" + + "?::integer, ?::varchar(25), ?::varchar(40)," + + "?::integer, ?::char(15), ?::decimal(15, 2)," + + "?::char(10), ?::varchar(117));"; + } + }; + + private final Column[] columns; + private final long[] tableSizes; + + TpchTables(long[] tableSizes, Column... columns) { + this.tableSizes = tableSizes; + this.columns = columns; + } + + @Override public String tableName() { + return name().toLowerCase(); + } + + @Override public int columnsCount() { + return columns.length; + } + + @Override public String columnName(int idx) { + return columns[idx].name; + } + + @Override public String ddlScript() { + return TpchHelper.loadFromResource("tpch/ddl/" + tableName() + "_ddl.sql"); + } + + @SuppressWarnings("resource") + @Override public Iterator dataProvider(Path pathToDataset) throws IOException { + return Files.lines(pathToDataset.resolve(tableName() + ".tbl")) + .map(this::csvLineToTableValues) + .iterator(); + } + + @Override public long estimatedSize(TpcScaleFactor sf) { + return sf.size(tableSizes); + } + + private Object[] csvLineToTableValues(String line) { + String[] stringValues = line.split("\\|"); + Object[] values = new Object[columns.length]; + + for (int i = 0; i < columns.length; i++) { + switch (columns[i].type) { + case INT32: + values[i] = Integer.valueOf(stringValues[i]); + break; + case DECIMAL: + values[i] = new BigDecimal(stringValues[i]); + break; + case DATE: + values[i] = LocalDate.parse(stringValues[i]); + break; + case STRING: + values[i] = stringValues[i]; + break; + default: + throw new IllegalStateException(columns[i].type.toString()); + } + } + + return values; + } + + private static class Column { + private final String name; + private final String type; + + private Column(String name, String type) { + this.name = name; + this.type = type; + } + } +} diff --git a/modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql new file mode 100644 index 0000000000000..1bba80dda97ed --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql @@ -0,0 +1,19 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: SF*150,000 + +DROP TABLE IF EXISTS customer; + +CREATE TABLE customer ( + c_custkey integer NOT NULL, + c_name varchar(25) NOT NULL, + c_address varchar(40) NOT NULL, + c_nationkey integer NOT NULL, + c_phone varchar(15) NOT NULL, + c_acctbal decimal(15, 2) NOT NULL, + c_mktsegment varchar(10) NOT NULL, + c_comment varchar(117) NOT NULL, + PRIMARY KEY (c_custkey) +); + +CREATE INDEX c_nk ON customer (c_nationkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql new file mode 100644 index 0000000000000..07d937fa2ce41 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql @@ -0,0 +1,32 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: SF*6,000,000 + +DROP TABLE IF EXISTS lineitem; + +CREATE TABLE lineitem ( + l_orderkey integer NOT NULL, + l_partkey integer NOT NULL, + l_suppkey integer NOT NULL, + l_linenumber integer NOT NULL, + l_quantity decimal(15, 2) NOT NULL, + l_extendedprice decimal(15, 2) NOT NULL, + l_discount decimal(15, 2) NOT NULL, + l_tax decimal(15, 2) NOT NULL, + l_returnflag varchar(1) NOT NULL, + l_linestatus varchar(1) NOT NULL, + l_shipdate date NOT NULL, + l_commitdate date NOT NULL, + l_receiptdate date NOT NULL, + l_shipinstruct varchar(25) NOT NULL, + l_shipmode varchar(10) NOT NULL, + l_comment varchar(44) NOT NULL, + PRIMARY KEY (l_orderkey, l_linenumber) +); + +CREATE INDEX l_sd ON lineitem (l_shipdate ASC); +CREATE INDEX l_cd ON lineitem (l_commitdate ASC); +CREATE INDEX l_rd ON lineitem (l_receiptdate ASC); +CREATE INDEX l_ok ON lineitem (l_orderkey ASC); +CREATE INDEX l_pk_sk ON lineitem (l_partkey ASC, l_suppkey ASC); +CREATE INDEX l_sk_pk ON lineitem (l_suppkey ASC, l_partkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql new file mode 100644 index 0000000000000..c24517333c88b --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql @@ -0,0 +1,15 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: 25 + +DROP TABLE IF EXISTS nation; + +CREATE TABLE nation ( + n_nationkey integer NOT NULL, + n_name varchar(25) NOT NULL, + n_regionkey integer NOT NULL, + n_comment varchar(152), + PRIMARY KEY (n_nationkey) +); + +CREATE INDEX n_rk ON nation (n_regionkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql new file mode 100644 index 0000000000000..c5a855c670ab3 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql @@ -0,0 +1,21 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: SF*1,500,000 + +DROP TABLE IF EXISTS orders; + +CREATE TABLE orders ( + o_orderkey integer NOT NULL, + o_custkey integer NOT NULL, + o_orderstatus varchar(1) NOT NULL, + o_totalprice decimal(15, 2) NOT NULL, + o_orderdate date NOT NULL, + o_orderpriority varchar(15) NOT NULL, + o_clerk varchar(15) NOT NULL, + o_shippriority integer NOT NULL, + o_comment varchar(79) NOT NULL, + PRIMARY KEY (o_orderkey) +); + +CREATE INDEX o_ck ON orders (o_custkey ASC); +CREATE INDEX o_od ON orders (o_orderdate ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql new file mode 100644 index 0000000000000..e0b79be7fb71f --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql @@ -0,0 +1,18 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: SF*200,000 + +DROP TABLE IF EXISTS part; + +CREATE TABLE part ( + p_partkey integer NOT NULL, + p_name varchar(55) NOT NULL, + p_mfgr varchar(25) NOT NULL, + p_brand varchar(10) NOT NULL, + p_type varchar(25) NOT NULL, + p_size integer NOT NULL, + p_container varchar(10) NOT NULL, + p_retailprice decimal(15, 2) NOT NULL, + p_comment varchar(23) NOT NULL, + PRIMARY KEY (p_partkey) +); diff --git a/modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql new file mode 100644 index 0000000000000..b93210e667323 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql @@ -0,0 +1,17 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: SF*800,000 + +DROP TABLE IF EXISTS partsupp; + +CREATE TABLE partsupp ( + ps_partkey integer NOT NULL, + ps_suppkey integer NOT NULL, + ps_availqty integer NOT NULL, + ps_supplycost decimal(15, 2) NOT NULL, + ps_comment varchar(199) NOT NULL, + PRIMARY KEY (ps_partkey, ps_suppkey) +); + +CREATE INDEX ps_pk ON partsupp (ps_partkey ASC); +CREATE INDEX ps_sk_pk ON partsupp (ps_suppkey ASC, ps_partkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql new file mode 100644 index 0000000000000..f224ae412da7c --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql @@ -0,0 +1,12 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: 5 + +DROP TABLE IF EXISTS region; + +CREATE TABLE region ( + r_regionkey integer NOT NULL, + r_name varchar(25) NOT NULL, + r_comment varchar(152), + PRIMARY KEY (r_regionkey) +); diff --git a/modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql new file mode 100644 index 0000000000000..e50ab1fe94a85 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql @@ -0,0 +1,18 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- Size: SF*10,000 + +DROP TABLE IF EXISTS supplier; + +CREATE TABLE supplier ( + s_suppkey integer NOT NULL, + s_name varchar(25) NOT NULL, + s_address varchar(40) NOT NULL, + s_nationkey integer NOT NULL, + s_phone varchar(15) NOT NULL, + s_acctbal decimal(15, 2) NOT NULL, + s_comment varchar(101) NOT NULL, + PRIMARY KEY (s_suppkey) +); + +CREATE INDEX s_nk ON supplier (s_nationkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/q1.sql b/modules/calcite/src/test/resources/tpch/q1.sql new file mode 100644 index 0000000000000..22480738d69f0 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q1.sql @@ -0,0 +1,24 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + l_returnflag, + l_linestatus, + sum(l_quantity) AS sum_qty, + sum(l_extendedprice) AS sum_base_price, + sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price, + sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, + avg(l_quantity) AS avg_qty, + avg(l_extendedprice) AS avg_price, + avg(l_discount) AS avg_disc, + count(*) AS count_order +FROM + lineitem +WHERE + l_shipdate <= DATE '1998-12-01' - INTERVAL '90' DAY +GROUP BY + l_returnflag, + l_linestatus +ORDER BY + l_returnflag, + l_linestatus From 9aa088e15db1404ec7aaf1dba4449a6ed3b9e8db Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Mon, 20 Apr 2026 16:32:46 +0300 Subject: [PATCH 02/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 37 +++--- .../planner/tpc/TpchQueryPlannerTest.java | 3 +- .../calcite/src/test/resources/tpch/q1.plan | 113 ++++++++++++++++++ .../calcite/src/test/resources/tpch/q1.sql | 39 +++--- 4 files changed, 155 insertions(+), 37 deletions(-) create mode 100644 modules/calcite/src/test/resources/tpch/q1.plan diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 68f432ad9142d..36dd2049e0667 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Scanner; import java.util.regex.Pattern; +import java.util.stream.Collectors; import com.google.common.io.CharStreams; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper; @@ -70,7 +71,7 @@ public void testQueries() throws Exception { } private void validateQueryPlan(String queryId) { - String[] actualPlans = queryPlan(queryString(queryId)); + List actualPlans = queryPlan(queryString(queryId)); if (updatePlan) { updateQueryPlan(queryId, actualPlans); @@ -79,7 +80,7 @@ private void validateQueryPlan(String queryId) { String[] expectedPlans = expectedQueryPlan(queryId).split("----(\\r\\n|\\n|\\r)"); - assert expectedPlans.length == actualPlans.length : "Unexpected number of plans, got: " + actualPlans.length + assert expectedPlans.length == actualPlans.size() : "Unexpected number of plans, got: " + actualPlans.size() + ", expected: " + expectedPlans.length; int pos = 0; @@ -119,7 +120,7 @@ private static T invoke(Method method, Object... arguments) { } } - static void updateQueryPlan(String queryId, Path targetDirectory, String... newPlans) { + static void updateQueryPlan(String queryId, Path targetDirectory, List newPlans) { // A targetDirectory must be specified by hand when expected plans are generated. if (targetDirectory == null) { throw new RuntimeException("Please provide target directory to where save generated plans." @@ -167,10 +168,10 @@ String expectedQueryPlan(String queryId) { } if (variant) { - var variantQueryFile = String.format("%s/plan/variant_q%d.plan", name(), numericId); + var variantQueryFile = String.format("%s/variant_q%d.plan", name(), numericId); return loadFromResource(variantQueryFile); } else { - var queryFile = String.format("%s/plan/q%s.plan", name(), numericId); + var queryFile = String.format("%s/q%s.plan", name(), numericId); return loadFromResource(queryFile); } } @@ -181,22 +182,20 @@ private String queryId(Path p) { return name.substring(1).replace(".sql", ""); } - private String[] queryPlan(String sqlScript) { - List queries = scriptToQueries(sqlScript); + private List queryPlan(String sqlScript) { + return scriptToQueries(sqlScript).stream().map(qry -> { + List> explain = sql(srv, "EXPLAIN PLAN FOR " + qry); - assertEquals("Query file must contain single query", 1, queries.size()); + StringBuilder plan = new StringBuilder(); - List> plan = sql(srv, "EXPLAIN PLAN FOR " + queries.get(0)); + for (int i = 0; i < explain.size(); i++) { + assertEquals(1, explain.get(i).size()); - String[] res = new String[plan.size()]; - - for (int i = 0; i < plan.size(); i++) { - assertEquals(1, plan.get(i).size()); - - res[i] = plan.get(i).get(0).toString(); - } + plan.append(explain.get(i).get(0)); + } - return res; + return plan.toString(); + }).collect(Collectors.toList()); } private static List scriptToQueries(String sqlScript) { @@ -212,7 +211,7 @@ private static List scriptToQueries(String sqlScript) { if (line.startsWith("--") || line.isEmpty()) continue; - current.append(line).append(''); + current.append(line).append('\n'); if (line.endsWith(";")) { queries.add(current.toString()); @@ -229,7 +228,7 @@ private static List scriptToQueries(String sqlScript) { abstract String queryString(String queryId); - abstract void updateQueryPlan(String queryId, String... newPlans); + abstract void updateQueryPlan(String queryId, List newPlans); /** Returns name of the SQL test. */ abstract String name(); diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java index ca7e8bd64a58c..d466e5c68e8e1 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.query.calcite.planner.tpc; import java.nio.file.Path; +import java.util.List; /** * Tests ensures a planner generates optimal plan for TPC-H queries. @@ -31,7 +32,7 @@ public class TpchQueryPlannerTest extends AbstractTpcQueryPlannerTest { } /** {@inheritDoc} */ - @Override public void updateQueryPlan(String queryId, String... newPlans) { + @Override public void updateQueryPlan(String queryId, List newPlans) { Path targetDirectory = Path.of("./src/test/resources/tpch/plan"); updateQueryPlan(queryId, targetDirectory, newPlans); } diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan new file mode 100644 index 0000000000000..b7f9579bab6c6 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -0,0 +1,113 @@ +Limit + fetch: 100 + est: (rows=100) + Project + fieldNames: [C_CUSTOMER_ID] + projection: [C_CUSTOMER_ID] + est: (rows=24032667) + HashJoin + predicate: =(CTR_CUSTOMER_SK, C_CUSTOMER_SK) + type: inner + est: (rows=24032667) + Exchange + distribution: single + est: (rows=100000) + Sort + collation: [C_CUSTOMER_ID ASC] + est: (rows=100000) + TableScan + table: PUBLIC.CUSTOMER + fieldNames: [C_CUSTOMER_SK, C_CUSTOMER_ID] + est: (rows=100000) + MergeJoin + predicate: =(S_STORE_SK, CTR_STORE_SK) + type: inner + est: (rows=24032667) + Exchange + distribution: single + est: (rows=4) + Sort + collation: [S_STORE_SK ASC] + est: (rows=4) + TableScan + table: PUBLIC.STORE + predicate: =(S_STATE, _UTF-8'NM') + fieldNames: [S_STORE_SK, S_STATE] + est: (rows=4) + HashJoin + predicate: AND(=(CTR_STORE_SK, CTR_STORE_SK$0), >(CAST(CTR_TOTAL_RETURN):DECIMAL(30, 17), *($f1, 1.2:DECIMAL(2, 1)))) + fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, CTR_TOTAL_RETURN, CTR_STORE_SK$0, $f1] + type: inner + est: (rows=72170173) + Sort + collation: [CTR_STORE_SK ASC] + est: (rows=31020) + Filter + predicate: IS NOT NULL(CTR_STORE_SK) + est: (rows=31020) + ColocatedHashAggregate + fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, CTR_TOTAL_RETURN] + group: [CTR_CUSTOMER_SK, CTR_STORE_SK] + aggregation: [SUM(SR_FEE)] + est: (rows=34467) + Project + fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, SR_FEE] + projection: [SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] + est: (rows=95742) + HashJoin + predicate: =(SR_RETURNED_DATE_SK, D_DATE_SK) + type: inner + est: (rows=95742) + Exchange + distribution: single + est: (rows=287514) + TableScan + table: PUBLIC.STORE_RETURNS + fieldNames: [SR_RETURNED_DATE_SK, SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] + est: (rows=287514) + Exchange + distribution: single + est: (rows=24325) + TableScan + table: PUBLIC.DATE_DIM + predicate: =(D_YEAR, 2000) + fieldNames: [D_DATE_SK, D_YEAR] + est: (rows=24325) + ColocatedHashAggregate + fieldNames: [CTR_STORE_SK, $f1] + group: [CTR_STORE_SK] + aggregation: [AVG(CTR_TOTAL_RETURN)] + est: (rows=31020) + Project + fieldNames: [CTR_STORE_SK, CTR_TOTAL_RETURN] + projection: [CTR_STORE_SK, CTR_TOTAL_RETURN] + est: (rows=31020) + ColocatedHashAggregate + fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, CTR_TOTAL_RETURN] + group: [CTR_CUSTOMER_SK, CTR_STORE_SK] + aggregation: [SUM(SR_FEE)] + est: (rows=31020) + Project + fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, SR_FEE] + projection: [SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] + est: (rows=86168) + HashJoin + predicate: =(SR_RETURNED_DATE_SK, D_DATE_SK) + type: inner + est: (rows=86168) + Exchange + distribution: single + est: (rows=258763) + TableScan + table: PUBLIC.STORE_RETURNS + predicate: IS NOT NULL(SR_STORE_SK) + fieldNames: [SR_RETURNED_DATE_SK, SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] + est: (rows=258763) + Exchange + distribution: single + est: (rows=24325) + TableScan + table: PUBLIC.DATE_DIM + predicate: =(D_YEAR, 2000) + fieldNames: [D_DATE_SK, D_YEAR] + est: (rows=24325) diff --git a/modules/calcite/src/test/resources/tpch/q1.sql b/modules/calcite/src/test/resources/tpch/q1.sql index 22480738d69f0..938f33eddc566 100644 --- a/modules/calcite/src/test/resources/tpch/q1.sql +++ b/modules/calcite/src/test/resources/tpch/q1.sql @@ -1,24 +1,29 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Pricing Summary Report Query (Q1) +-- Functional Query Definition +-- Approved February 1998 +-- TODO: actual SQL query differs from Ignite3 version. Why? -SELECT + +select l_returnflag, l_linestatus, - sum(l_quantity) AS sum_qty, - sum(l_extendedprice) AS sum_base_price, - sum(l_extendedprice * (1 - l_discount)) AS sum_disc_price, - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, - avg(l_quantity) AS avg_qty, - avg(l_extendedprice) AS avg_price, - avg(l_discount) AS avg_disc, - count(*) AS count_order -FROM + sum(l_quantity) as sum_qty, + sum(l_extendedprice) as sum_base_price, + sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, + sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, + avg(l_quantity) as avg_qty, + avg(l_extendedprice) as avg_price, + avg(l_discount) as avg_disc, + count(*) as count_order +from lineitem -WHERE - l_shipdate <= DATE '1998-12-01' - INTERVAL '90' DAY -GROUP BY +where + l_shipdate <= TIMESTAMPADD(DAY, -90, date '1998-12-01') +group by l_returnflag, l_linestatus -ORDER BY +order by l_returnflag, - l_linestatus + l_linestatus; From d113beabae09a27ca5fbe81b286dd60373dc3a49 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Tue, 21 Apr 2026 16:45:01 +0300 Subject: [PATCH 03/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 37 ++++-- .../planner/tpc/TpchQueryPlannerTest.java | 2 +- .../calcite/src/test/resources/tpch/q1.plan | 118 +----------------- 3 files changed, 35 insertions(+), 122 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 36dd2049e0667..5cfdd6ac8421a 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -28,13 +28,22 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Scanner; import java.util.regex.Pattern; import java.util.stream.Collectors; import com.google.common.io.CharStreams; +import org.apache.calcite.plan.RelOptUtil; +import org.apache.calcite.sql.SqlExplainLevel; +import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.processors.query.GridQueryProcessor; +import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor; import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper; import org.apache.ignite.internal.processors.query.calcite.planner.AbstractPlannerTest; +import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema; +import org.apache.ignite.testframework.GridTestUtils; import org.junit.Test; import static org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper.sql; @@ -44,12 +53,21 @@ * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ public abstract class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { - private static final boolean updatePlan = false; + private static final boolean updatePlan = true; private static final Pattern COSTS_PATTERN = Pattern.compile("\\s+est: \\(rows=\\d+\\)"); private static IgniteEx srv; + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + + cfg.getSqlConfiguration().setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration().setDefault(true)); + + return cfg; + } + /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { super.beforeTestsStarted(); @@ -184,17 +202,20 @@ private String queryId(Path p) { private List queryPlan(String sqlScript) { return scriptToQueries(sqlScript).stream().map(qry -> { - List> explain = sql(srv, "EXPLAIN PLAN FOR " + qry); + GridQueryProcessor qryProc = srv.context().query(); - StringBuilder plan = new StringBuilder(); + CalciteQueryProcessor engine = (CalciteQueryProcessor)qryProc.defaultQueryEngine(); - for (int i = 0; i < explain.size(); i++) { - assertEquals(1, explain.get(i).size()); + Map schemas = GridTestUtils.getFieldValue(engine.schemaHolder(), "igniteSchemas"); - plan.append(explain.get(i).get(0)); - } + assertNotNull(schemas); - return plan.toString(); + try { + return RelOptUtil.toString(physicalPlan(plannerCtx(sqlScript, schemas.values(), null)), SqlExplainLevel.ALL_ATTRIBUTES); + } + catch (Exception e) { + throw new RuntimeException(e); + } }).collect(Collectors.toList()); } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java index d466e5c68e8e1..c54bdc180fcec 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java @@ -33,7 +33,7 @@ public class TpchQueryPlannerTest extends AbstractTpcQueryPlannerTest { /** {@inheritDoc} */ @Override public void updateQueryPlan(String queryId, List newPlans) { - Path targetDirectory = Path.of("./src/test/resources/tpch/plan"); + Path targetDirectory = Path.of("./src/test/resources/tpch"); updateQueryPlan(queryId, targetDirectory, newPlans); } diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan index b7f9579bab6c6..a1e8403c0444f 100644 --- a/modules/calcite/src/test/resources/tpch/q1.plan +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -1,113 +1,5 @@ -Limit - fetch: 100 - est: (rows=100) - Project - fieldNames: [C_CUSTOMER_ID] - projection: [C_CUSTOMER_ID] - est: (rows=24032667) - HashJoin - predicate: =(CTR_CUSTOMER_SK, C_CUSTOMER_SK) - type: inner - est: (rows=24032667) - Exchange - distribution: single - est: (rows=100000) - Sort - collation: [C_CUSTOMER_ID ASC] - est: (rows=100000) - TableScan - table: PUBLIC.CUSTOMER - fieldNames: [C_CUSTOMER_SK, C_CUSTOMER_ID] - est: (rows=100000) - MergeJoin - predicate: =(S_STORE_SK, CTR_STORE_SK) - type: inner - est: (rows=24032667) - Exchange - distribution: single - est: (rows=4) - Sort - collation: [S_STORE_SK ASC] - est: (rows=4) - TableScan - table: PUBLIC.STORE - predicate: =(S_STATE, _UTF-8'NM') - fieldNames: [S_STORE_SK, S_STATE] - est: (rows=4) - HashJoin - predicate: AND(=(CTR_STORE_SK, CTR_STORE_SK$0), >(CAST(CTR_TOTAL_RETURN):DECIMAL(30, 17), *($f1, 1.2:DECIMAL(2, 1)))) - fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, CTR_TOTAL_RETURN, CTR_STORE_SK$0, $f1] - type: inner - est: (rows=72170173) - Sort - collation: [CTR_STORE_SK ASC] - est: (rows=31020) - Filter - predicate: IS NOT NULL(CTR_STORE_SK) - est: (rows=31020) - ColocatedHashAggregate - fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, CTR_TOTAL_RETURN] - group: [CTR_CUSTOMER_SK, CTR_STORE_SK] - aggregation: [SUM(SR_FEE)] - est: (rows=34467) - Project - fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, SR_FEE] - projection: [SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] - est: (rows=95742) - HashJoin - predicate: =(SR_RETURNED_DATE_SK, D_DATE_SK) - type: inner - est: (rows=95742) - Exchange - distribution: single - est: (rows=287514) - TableScan - table: PUBLIC.STORE_RETURNS - fieldNames: [SR_RETURNED_DATE_SK, SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] - est: (rows=287514) - Exchange - distribution: single - est: (rows=24325) - TableScan - table: PUBLIC.DATE_DIM - predicate: =(D_YEAR, 2000) - fieldNames: [D_DATE_SK, D_YEAR] - est: (rows=24325) - ColocatedHashAggregate - fieldNames: [CTR_STORE_SK, $f1] - group: [CTR_STORE_SK] - aggregation: [AVG(CTR_TOTAL_RETURN)] - est: (rows=31020) - Project - fieldNames: [CTR_STORE_SK, CTR_TOTAL_RETURN] - projection: [CTR_STORE_SK, CTR_TOTAL_RETURN] - est: (rows=31020) - ColocatedHashAggregate - fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, CTR_TOTAL_RETURN] - group: [CTR_CUSTOMER_SK, CTR_STORE_SK] - aggregation: [SUM(SR_FEE)] - est: (rows=31020) - Project - fieldNames: [CTR_CUSTOMER_SK, CTR_STORE_SK, SR_FEE] - projection: [SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] - est: (rows=86168) - HashJoin - predicate: =(SR_RETURNED_DATE_SK, D_DATE_SK) - type: inner - est: (rows=86168) - Exchange - distribution: single - est: (rows=258763) - TableScan - table: PUBLIC.STORE_RETURNS - predicate: IS NOT NULL(SR_STORE_SK) - fieldNames: [SR_RETURNED_DATE_SK, SR_CUSTOMER_SK, SR_STORE_SK, SR_FEE] - est: (rows=258763) - Exchange - distribution: single - est: (rows=24325) - TableScan - table: PUBLIC.DATE_DIM - predicate: =(D_YEAR, 2000) - fieldNames: [D_DATE_SK, D_YEAR] - est: (rows=24325) +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = 117 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = 116 + IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = 115 + IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = 114 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 73 From 11cbb589a13dca409d4564c1b985ac6112fac9cd Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 09:30:19 +0300 Subject: [PATCH 04/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 115 ++++++---------- .../calcite/planner/tpc/PlanChecker.java | 125 ++++++++++++++++++ .../query/calcite/planner/tpc/TpchHelper.java | 80 ++++++----- .../planner/tpc/TpchQueryPlannerTest.java | 26 +--- .../calcite/src/test/resources/tpch/q1.plan | 2 +- .../calcite/src/test/resources/tpch/q10.sql | 35 +++++ .../calcite/src/test/resources/tpch/q11.sql | 30 +++++ .../calcite/src/test/resources/tpch/q12.sql | 31 +++++ .../calcite/src/test/resources/tpch/q13.sql | 23 ++++ .../calcite/src/test/resources/tpch/q14.sql | 15 +++ .../calcite/src/test/resources/tpch/q15.sql | 34 +++++ .../calcite/src/test/resources/tpch/q16.sql | 32 +++++ .../calcite/src/test/resources/tpch/q17.sql | 18 +++ .../calcite/src/test/resources/tpch/q18.sql | 36 +++++ .../calcite/src/test/resources/tpch/q19.sql | 37 ++++++ .../calcite/src/test/resources/tpch/q2.sql | 44 ++++++ .../calcite/src/test/resources/tpch/q20.sql | 35 +++++ .../calcite/src/test/resources/tpch/q21.sql | 41 ++++++ .../calcite/src/test/resources/tpch/q22.sql | 37 ++++++ .../calcite/src/test/resources/tpch/q3.sql | 26 ++++ .../calcite/src/test/resources/tpch/q4.sql | 21 +++ .../calcite/src/test/resources/tpch/q5.sql | 27 ++++ .../calcite/src/test/resources/tpch/q6.sql | 11 ++ .../calcite/src/test/resources/tpch/q7.sql | 41 ++++++ .../calcite/src/test/resources/tpch/q8.sql | 40 ++++++ .../calcite/src/test/resources/tpch/q9.sql | 34 +++++ .../src/test/resources/tpch/variant_q12.sql | 25 ++++ .../src/test/resources/tpch/variant_q14.sql | 16 +++ .../src/test/resources/tpch/variant_q8.sql | 38 ++++++ 29 files changed, 943 insertions(+), 132 deletions(-) create mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java create mode 100644 modules/calcite/src/test/resources/tpch/q10.sql create mode 100644 modules/calcite/src/test/resources/tpch/q11.sql create mode 100644 modules/calcite/src/test/resources/tpch/q12.sql create mode 100644 modules/calcite/src/test/resources/tpch/q13.sql create mode 100644 modules/calcite/src/test/resources/tpch/q14.sql create mode 100644 modules/calcite/src/test/resources/tpch/q15.sql create mode 100644 modules/calcite/src/test/resources/tpch/q16.sql create mode 100644 modules/calcite/src/test/resources/tpch/q17.sql create mode 100644 modules/calcite/src/test/resources/tpch/q18.sql create mode 100644 modules/calcite/src/test/resources/tpch/q19.sql create mode 100644 modules/calcite/src/test/resources/tpch/q2.sql create mode 100644 modules/calcite/src/test/resources/tpch/q20.sql create mode 100644 modules/calcite/src/test/resources/tpch/q21.sql create mode 100644 modules/calcite/src/test/resources/tpch/q22.sql create mode 100644 modules/calcite/src/test/resources/tpch/q3.sql create mode 100644 modules/calcite/src/test/resources/tpch/q4.sql create mode 100644 modules/calcite/src/test/resources/tpch/q5.sql create mode 100644 modules/calcite/src/test/resources/tpch/q6.sql create mode 100644 modules/calcite/src/test/resources/tpch/q7.sql create mode 100644 modules/calcite/src/test/resources/tpch/q8.sql create mode 100644 modules/calcite/src/test/resources/tpch/q9.sql create mode 100644 modules/calcite/src/test/resources/tpch/variant_q12.sql create mode 100644 modules/calcite/src/test/resources/tpch/variant_q14.sql create mode 100644 modules/calcite/src/test/resources/tpch/variant_q8.sql diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 5cfdd6ac8421a..5ac63dd7ce3c7 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -38,65 +38,72 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.IgnitionEx; import org.apache.ignite.internal.processors.query.GridQueryProcessor; import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor; -import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper; import org.apache.ignite.internal.processors.query.calcite.planner.AbstractPlannerTest; +import org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.AfterPlansTest; +import org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.BeforePlansTest; import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema; import org.apache.ignite.testframework.GridTestUtils; import org.junit.Test; +import org.junit.runners.Parameterized; -import static org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper.sql; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sql; import static org.apache.logging.log4j.util.Cast.cast; /** * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ -public abstract class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { +public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { private static final boolean updatePlan = true; private static final Pattern COSTS_PATTERN = Pattern.compile("\\s+est: \\(rows=\\d+\\)"); private static IgniteEx srv; - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + @Parameterized.Parameter + public String queryId; - cfg.getSqlConfiguration().setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration().setDefault(true)); + @BeforePlansTest + public static void startAll(Class testClass) throws Exception { + AbstractTpcQueryPlannerTest mock = new AbstractTpcQueryPlannerTest(); - return cfg; - } + mock.beforeFirstTest(); - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); + IgniteConfiguration cfg = mock.getConfiguration("server"); + + cfg.getSqlConfiguration() + .setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration().setDefault(true)); - srv = startGrid(); + srv = (IgniteEx)IgnitionEx.start(cfg); - TpcTable[] tables = cast(tables().getEnumConstants()); + TpcTable[] tables = cast(TpchHelper.tables(testClass).getEnumConstants()); for (TpcTable table : tables) scriptToQueries(table.ddlScript()).forEach(q -> sql(srv, q)); } - @Test - public void testQueries() throws Exception { - Files.list(Path.of("./src/test/resources", name())) - .filter(p -> p.toString().endsWith(".sql")) - .map(this::queryId) - .forEach(this::validateQueryPlan); + @AfterPlansTest + public static void stopAll(Class testClass) { + if (srv != null) { + srv.close(); + + srv = null; + } } - private void validateQueryPlan(String queryId) { - List actualPlans = queryPlan(queryString(queryId)); + @Test + public void testQueries() { + List actualPlans = queryPlan(loadFromResource(String.format(TpchHelper.name(getClass()) + "/%s.sql", queryId))); if (updatePlan) { updateQueryPlan(queryId, actualPlans); return; } - String[] expectedPlans = expectedQueryPlan(queryId).split("----(\\r\\n|\\n|\\r)"); + String[] expectedPlans = loadFromResource(String.format("%s/%s.plan", TpchHelper.name(getClass()), queryId)) + .split("----(\\r\\n|\\n|\\r)"); assert expectedPlans.length == actualPlans.size() : "Unexpected number of plans, got: " + actualPlans.size() + ", expected: " + expectedPlans.length; @@ -138,67 +145,25 @@ private static T invoke(Method method, Object... arguments) { } } - static void updateQueryPlan(String queryId, Path targetDirectory, List newPlans) { + private void updateQueryPlan(String queryId, List newPlans) { + Path targetDirectory = Path.of("./src/test/resources/" + TpchHelper.name(getClass())); + // A targetDirectory must be specified by hand when expected plans are generated. if (targetDirectory == null) { throw new RuntimeException("Please provide target directory to where save generated plans." + " Usually plans are kept in resource folder of tests within the same module."); } - // variant query ends with "v" - boolean variant = queryId.endsWith("v"); - int numericId; - - if (variant) { - String idString = queryId.substring(0, queryId.length() - 1); - numericId = Integer.parseInt(idString); - } else { - numericId = Integer.parseInt(queryId); - } - - Path planLocation; - if (variant) { - planLocation = targetDirectory.resolve(String.format("variant_q%d.plan", numericId)); - } else { - planLocation = targetDirectory.resolve(String.format("q%s.plan", numericId)); - } - try { Files.createDirectories(targetDirectory); String plans = String.join("----" + System.lineSeparator(), newPlans); - Files.writeString(planLocation, plans); + Files.writeString(targetDirectory.resolve(String.format("%s.plan", queryId)), plans); } catch (Exception e) { throw new RuntimeException(e); } } - String expectedQueryPlan(String queryId) { - // variant query ends with "v" - boolean variant = queryId.endsWith("v"); - int numericId; - - if (variant) { - String idString = queryId.substring(0, queryId.length() - 1); - numericId = Integer.parseInt(idString); - } else { - numericId = Integer.parseInt(queryId); - } - - if (variant) { - var variantQueryFile = String.format("%s/variant_q%d.plan", name(), numericId); - return loadFromResource(variantQueryFile); - } else { - var queryFile = String.format("%s/q%s.plan", name(), numericId); - return loadFromResource(queryFile); - } - } - - private String queryId(Path p) { - String name = p.getFileName().toString(); - - return name.substring(1).replace(".sql", ""); - } private List queryPlan(String sqlScript) { return scriptToQueries(sqlScript).stream().map(qry -> { @@ -247,12 +212,8 @@ private static List scriptToQueries(String sqlScript) { return queries; } - abstract String queryString(String queryId); - - abstract void updateQueryPlan(String queryId, List newPlans); - - /** Returns name of the SQL test. */ - abstract String name(); - - abstract Class> tables(); + /** {@inheritDoc} */ + @Override protected boolean isSafeTopology() { + return false; + } } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java new file mode 100644 index 0000000000000..301ba107ebfa0 --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -0,0 +1,125 @@ +/* + * 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.processors.query.calcite.planner.tpc; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.junit.runner.Runner; +import org.junit.runner.notification.RunNotifier; +import org.junit.runners.Suite; +import org.junit.runners.model.InitializationError; +import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters; +import org.junit.runners.parameterized.TestWithParameters; + +/** */ +public class PlanChecker extends Suite { + /** */ + private final List runners; + + /** + * Only called reflectively. Do not use programmatically. + */ + public PlanChecker(Class klass) throws Throwable { + super(klass, Collections.emptyList()); + + runners = createRunnersForParameters().collect(Collectors.toList()); + } + + /** {@inheritDoc} */ + @Override protected List getChildren() { + return runners; + } + + /** */ + private Stream createRunnersForParameters() throws IOException { + Stream queries = Files.list(Path.of("./src/test/resources", TpchHelper.name(getTestClass().getJavaClass()))) + .filter(p -> p.toString().endsWith(".sql")) + .sorted() + .map(TpchHelper::queryId); + + return queries + .map(qryId -> new TestWithParameters("[queryId=" + qryId + "]", getTestClass(), Collections.singletonList(qryId))) + .map(test -> { + try { + return new BlockJUnit4ClassRunnerWithParameters(test); + } + catch (InitializationError e) { + throw new RuntimeException(e); + } + }); + } + + /** {@inheritDoc} */ + @Override public void run(RunNotifier notifier) { + runAnnotated(BeforePlansTest.class); + try { + super.run(notifier); + } + finally { + runAnnotated(AfterPlansTest.class); + } + } + + private void runAnnotated(Class annotation) { + getTestClass().getAnnotatedMethods(annotation).forEach(m -> { + List errors = new ArrayList<>(); + + m.validatePublicVoid(true, errors); + + try { + if (!errors.isEmpty()) + throw errors.get(0); + + m.invokeExplosively(getTestClass().getJavaClass(), getTestClass().getJavaClass()); + } + catch (Throwable e) { + throw new RuntimeException(e); + } + }); + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + public @interface PlansTest { + String name() default ""; + + Class> tables(); + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + public @interface BeforePlansTest { + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + public @interface AfterPlansTest { + String name() default ""; + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java index 03bf03d401b0d..94644fce9ab8d 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java @@ -22,7 +22,13 @@ import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.util.List; import com.google.common.io.CharStreams; +import org.apache.ignite.Ignite; +import org.apache.ignite.cache.query.FieldsQueryCursor; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.internal.IgniteEx; /** * Provides utility methods to work with queries defined by the TPC-H benchmark. @@ -40,38 +46,6 @@ public final class TpchHelper { private TpchHelper() { } - /** - * Loads a TPC-H query given a query identifier. Query identifier can be in the following forms: - *
    - *
  • query id - a number, e.g. {@code 14}. Queries are stored in files named q{id}.sql.
  • - *
  • query variant id, a number and 'v' suffix - {@code 12v}. Query variants are stored in files - * named variant_q{numeric_id}.sql.
  • - *
- * - * @param queryId The identifier of a query. - * @return An SQL query. - */ - public static String getQuery(String queryId) { - // variant query ends with "v" - boolean variant = queryId.endsWith("v"); - int numericId; - - if (variant) { - String idString = queryId.substring(0, queryId.length() - 1); - numericId = Integer.parseInt(idString); - } else { - numericId = Integer.parseInt(queryId); - } - - if (variant) { - var variantQueryFile = String.format("tpch/variant_q%d.sql", numericId); - return loadFromResource(variantQueryFile); - } else { - var queryFile = String.format("tpch/q%s.sql", numericId); - return loadFromResource(queryFile); - } - } - /** * Loads resource with given name as string. * @@ -90,4 +64,46 @@ public static String loadFromResource(String resource) { throw new UncheckedIOException("I/O operation failed: " + resource, e); } } + + public static String queryId(Path p) { + return p.getFileName().toString().replace(".sql", ""); + } + + public static String name(Class klass) { + PlanChecker.PlansTest desc = plansTest(klass); + + if (desc.name().isEmpty()) + throw new IllegalStateException("Please, set test name with the @PlanTest(name=\"XXX\")"); + + return desc.name(); + } + + public static Class> tables(Class klass) { + PlanChecker.PlansTest desc = plansTest(klass); + + return desc.tables(); + } + + private static PlanChecker.PlansTest plansTest(Class klass) { + PlanChecker.PlansTest desc = klass.getAnnotation(PlanChecker.PlansTest.class); + + if (desc == null) + throw new IllegalStateException("Test class must be annotated with @" + PlanChecker.PlansTest.class.getSimpleName()); + return desc; + } + + /** + * Execute SQL query. + * + * @param ignite Ignite. + * @param sql SQL query. + * @param params Query parameters. + */ + public static List> sql(Ignite ignite, String sql, Object... params) { + SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(params); + + try (FieldsQueryCursor> cur = ((IgniteEx)ignite).context().query().querySqlFields(qry, false)) { + return cur.getAll(); + } + } } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java index c54bdc180fcec..15c3b6ee9d2c7 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java @@ -17,33 +17,15 @@ package org.apache.ignite.internal.processors.query.calcite.planner.tpc; -import java.nio.file.Path; -import java.util.List; +import org.junit.runner.RunWith; /** * Tests ensures a planner generates optimal plan for TPC-H queries. * * @code org.apache.ignite.internal.sql.engine.benchmarks.TpchParseBenchmark */ +@RunWith(PlanChecker.class) +@PlanChecker.PlansTest(name = "tpch", tables = TpchTables.class) public class TpchQueryPlannerTest extends AbstractTpcQueryPlannerTest { - /** {@inheritDoc} */ - @Override public String queryString(String queryId) { - return TpchHelper.getQuery(queryId); - } - - /** {@inheritDoc} */ - @Override public void updateQueryPlan(String queryId, List newPlans) { - Path targetDirectory = Path.of("./src/test/resources/tpch"); - updateQueryPlan(queryId, targetDirectory, newPlans); - } - - /** {@inheritDoc} */ - @Override String name() { - return "tpch"; - } - - /** {@inheritDoc} */ - @Override Class> tables() { - return TpchTables.class; - } + // No-op } diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan index a1e8403c0444f..75c47cfa5a1da 100644 --- a/modules/calcite/src/test/resources/tpch/q1.plan +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -2,4 +2,4 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LI IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = 116 IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = 115 IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = 114 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 73 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 74 diff --git a/modules/calcite/src/test/resources/tpch/q10.sql b/modules/calcite/src/test/resources/tpch/q10.sql new file mode 100644 index 0000000000000..0ba0bb540a131 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q10.sql @@ -0,0 +1,35 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + c_custkey, + c_name, + sum(l_extendedprice * (1 - l_discount)) AS revenue, + c_acctbal, + n_name, + c_address, + c_phone, + c_comment +FROM + customer, + orders, + lineitem, + nation +WHERE + c_custkey = o_custkey + AND l_orderkey = o_orderkey + AND o_orderdate >= DATE '1993-10-01' + AND o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH + AND l_returnflag = 'R' + AND c_nationkey = n_nationkey +GROUP BY + c_custkey, + c_name, + c_acctbal, + c_phone, + n_name, + c_address, + c_comment +ORDER BY + revenue DESC + LIMIT 20 diff --git a/modules/calcite/src/test/resources/tpch/q11.sql b/modules/calcite/src/test/resources/tpch/q11.sql new file mode 100644 index 0000000000000..d304415b2734b --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q11.sql @@ -0,0 +1,30 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + ps_partkey, + sum(ps_supplycost * ps_availqty) AS val +FROM + partsupp, + supplier, + nation +WHERE + ps_suppkey = s_suppkey + AND s_nationkey = n_nationkey + AND n_name = 'GERMANY' +GROUP BY + ps_partkey +HAVING + sum(ps_supplycost * ps_availqty) > ( + SELECT sum(ps_supplycost * ps_availqty) * 0.0001 + FROM + partsupp, + supplier, + nation + WHERE + ps_suppkey = s_suppkey + AND s_nationkey = n_nationkey + AND n_name = 'GERMANY' + ) +ORDER BY + val DESC diff --git a/modules/calcite/src/test/resources/tpch/q12.sql b/modules/calcite/src/test/resources/tpch/q12.sql new file mode 100644 index 0000000000000..31a40ce58908d --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q12.sql @@ -0,0 +1,31 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + l_shipmode, + sum(CASE + WHEN o_orderpriority = '1-URGENT' + OR o_orderpriority = '2-HIGH' + THEN 1 + ELSE 0 + END) AS high_line_count, + sum(CASE + WHEN o_orderpriority <> '1-URGENT' + AND o_orderpriority <> '2-HIGH' + THEN 1 + ELSE 0 + END) AS low_line_count +FROM + orders, + lineitem +WHERE + o_orderkey = l_orderkey + AND l_shipmode IN ('MAIL', 'SHIP') + AND l_commitdate < l_receiptdate + AND l_shipdate < l_commitdate + AND l_receiptdate >= DATE '1994-01-01' + AND l_receiptdate < DATE '1994-01-01' + INTERVAL '1' YEAR +GROUP BY + l_shipmode +ORDER BY + l_shipmode diff --git a/modules/calcite/src/test/resources/tpch/q13.sql b/modules/calcite/src/test/resources/tpch/q13.sql new file mode 100644 index 0000000000000..c3ab108c66d4d --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q13.sql @@ -0,0 +1,23 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + c_count, + count(*) AS custdist +FROM ( + SELECT + c_custkey, + count(o_orderkey) + FROM + customer + LEFT OUTER JOIN orders ON + c_custkey = o_custkey + AND o_comment NOT LIKE '%special%requests%' + GROUP BY + c_custkey + ) AS c_orders (c_custkey, c_count) +GROUP BY + c_count +ORDER BY + custdist DESC, + c_count DESC diff --git a/modules/calcite/src/test/resources/tpch/q14.sql b/modules/calcite/src/test/resources/tpch/q14.sql new file mode 100644 index 0000000000000..4971ae7c7df02 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q14.sql @@ -0,0 +1,15 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT 100.00 * sum(CASE + WHEN p_type LIKE 'PROMO%' + THEN l_extendedprice * (1 - l_discount) + ELSE 0 + END) / sum(l_extendedprice * (1 - l_discount)) AS promo_revenue +FROM + lineitem, + part +WHERE + l_partkey = p_partkey + AND l_shipdate >= DATE '1995-09-01' + AND l_shipdate < DATE '1995-09-01' + INTERVAL '1' MONTH diff --git a/modules/calcite/src/test/resources/tpch/q15.sql b/modules/calcite/src/test/resources/tpch/q15.sql new file mode 100644 index 0000000000000..0bc233adf7b4d --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q15.sql @@ -0,0 +1,34 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +WITH revenue (supplier_no, total_revenue) as ( + SELECT + l_suppkey, + sum(l_extendedprice * (1-l_discount)) + FROM + lineitem + WHERE + l_shipdate >= DATE '1996-01-01' + AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' MONTH + GROUP BY + l_suppkey +) +SELECT + s_suppkey, + s_name, + s_address, + s_phone, + total_revenue +FROM + supplier, + revenue +WHERE + s_suppkey = supplier_no + AND total_revenue = ( + SELECT + max(total_revenue) + FROM + revenue +) +ORDER BY + s_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q16.sql b/modules/calcite/src/test/resources/tpch/q16.sql new file mode 100644 index 0000000000000..9598a8c683cc6 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q16.sql @@ -0,0 +1,32 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + p_brand, + p_type, + p_size, + count(DISTINCT ps_suppkey) AS supplier_cnt +FROM + partsupp, + part +WHERE + p_partkey = ps_partkey + AND p_brand <> 'Brand#45' + AND p_type NOT LIKE 'MEDIUM POLISHED%' + AND p_size IN (49, 14, 23, 45, 19, 3, 36, 9) + AND ps_suppkey NOT IN ( + SELECT s_suppkey + FROM + supplier + WHERE + s_comment LIKE '%Customer%Complaints%' +) +GROUP BY + p_brand, + p_type, + p_size +ORDER BY + supplier_cnt DESC, + p_brand, + p_type, + p_size diff --git a/modules/calcite/src/test/resources/tpch/q17.sql b/modules/calcite/src/test/resources/tpch/q17.sql new file mode 100644 index 0000000000000..cd594a917843c --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q17.sql @@ -0,0 +1,18 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT sum(l_extendedprice) / 7.0 AS avg_yearly +FROM + lineitem, + part +WHERE + p_partkey = l_partkey + AND p_brand = 'Brand#23' + AND p_container = 'MED BOX' + AND l_quantity < ( + SELECT 0.2 * avg(l_quantity) + FROM + lineitem + WHERE + l_partkey = p_partkey +) diff --git a/modules/calcite/src/test/resources/tpch/q18.sql b/modules/calcite/src/test/resources/tpch/q18.sql new file mode 100644 index 0000000000000..5b0d0d4f44561 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q18.sql @@ -0,0 +1,36 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + c_name, + c_custkey, + o_orderkey, + o_orderdate, + o_totalprice, + sum(l_quantity) +FROM + customer, + orders, + lineitem +WHERE + o_orderkey IN ( + SELECT l_orderkey + FROM + lineitem + GROUP BY + l_orderkey + HAVING + sum(l_quantity) > 300 + ) + AND c_custkey = o_custkey + AND o_orderkey = l_orderkey +GROUP BY + c_name, + c_custkey, + o_orderkey, + o_orderdate, + o_totalprice +ORDER BY + o_totalprice DESC, + o_orderdate + LIMIT 100 diff --git a/modules/calcite/src/test/resources/tpch/q19.sql b/modules/calcite/src/test/resources/tpch/q19.sql new file mode 100644 index 0000000000000..5945c5f7cd7e7 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q19.sql @@ -0,0 +1,37 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT sum(l_extendedprice * (1 - l_discount)) AS revenue +FROM + lineitem, + part +WHERE + ( + p_partkey = l_partkey + AND p_brand = 'Brand#12' + AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') + AND l_quantity >= 1 AND l_quantity <= 1 + 10 + AND p_size BETWEEN 1 AND 5 + AND l_shipmode IN ('AIR', 'AIR REG') + AND l_shipinstruct = 'DELIVER IN PERSON' + ) + OR + ( + p_partkey = l_partkey + AND p_brand = 'Brand#23' + AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') + AND l_quantity >= 10 AND l_quantity <= 10 + 10 + AND p_size BETWEEN 1 AND 10 + AND l_shipmode IN ('AIR', 'AIR REG') + AND l_shipinstruct = 'DELIVER IN PERSON' + ) + OR + ( + p_partkey = l_partkey + AND p_brand = 'Brand#34' + AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') + AND l_quantity >= 20 AND l_quantity <= 20 + 10 + AND p_size BETWEEN 1 AND 15 + AND l_shipmode IN ('AIR', 'AIR REG') + AND l_shipinstruct = 'DELIVER IN PERSON' + ) diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql new file mode 100644 index 0000000000000..b82bd046aa864 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -0,0 +1,44 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + s_acctbal, + s_name, + n_name, + p_partkey, + p_mfgr, + s_address, + s_phone, + s_comment +FROM + part, + supplier, + partsupp, + nation, + region +WHERE + p_partkey = ps_partkey + AND s_suppkey = ps_suppkey + AND p_size = 15 + AND p_type LIKE '%BRASS' + AND s_nationkey = n_nationkey + AND n_regionkey = r_regionkey + AND r_name = 'EUROPE' + AND ps_supplycost = ( + SELECT min(ps_supplycost) + FROM + partsupp, supplier, + nation, region + WHERE + p_partkey = ps_partkey + AND s_suppkey = ps_suppkey + AND s_nationkey = n_nationkey + AND n_regionkey = r_regionkey + AND r_name = 'EUROPE' +) +ORDER BY + s_acctbal DESC, + n_name, + s_name, + p_partkey + LIMIT 100 diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql new file mode 100644 index 0000000000000..41ce83f04d8db --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -0,0 +1,35 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + s_name, + s_address +FROM + supplier, nation +WHERE + s_suppkey IN ( + SELECT ps_suppkey + FROM + partsupp + WHERE + ps_partkey IN ( + SELECT p_partkey + FROM + part + WHERE + p_name LIKE 'forest%' + ) + AND ps_availqty > ( + SELECT 0.5 * sum(l_quantity) + FROM + lineitem + WHERE + l_partkey = ps_partkey + AND l_suppkey = ps_suppkey + AND l_shipdate >= date('1994-01-01') + AND l_shipdate < date('1994-01-01') + interval '1' YEAR + ) + ) + AND s_nationkey = n_nationkey + AND n_name = 'CANADA' +ORDER BY s_name diff --git a/modules/calcite/src/test/resources/tpch/q21.sql b/modules/calcite/src/test/resources/tpch/q21.sql new file mode 100644 index 0000000000000..0373124f1a6e6 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q21.sql @@ -0,0 +1,41 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + s_name, + count(*) AS numwait +FROM + supplier, + lineitem l1, + orders, + nation +WHERE + s_suppkey = l1.l_suppkey + AND o_orderkey = l1.l_orderkey + AND o_orderstatus = 'F' + AND l1.l_receiptdate > l1.l_commitdate + AND exists( + SELECT * + FROM + lineitem l2 + WHERE + l2.l_orderkey = l1.l_orderkey + AND l2.l_suppkey <> l1.l_suppkey + ) + AND NOT exists( + SELECT * + FROM + lineitem l3 + WHERE + l3.l_orderkey = l1.l_orderkey + AND l3.l_suppkey <> l1.l_suppkey + AND l3.l_receiptdate > l3.l_commitdate + ) + AND s_nationkey = n_nationkey + AND n_name = 'SAUDI ARABIA' +GROUP BY + s_name +ORDER BY + numwait DESC, + s_name + LIMIT 100 diff --git a/modules/calcite/src/test/resources/tpch/q22.sql b/modules/calcite/src/test/resources/tpch/q22.sql new file mode 100644 index 0000000000000..d24b936bd4218 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q22.sql @@ -0,0 +1,37 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + cntrycode, + count(*) AS numcust, + sum(c_acctbal) AS totacctbal +FROM ( + SELECT + substr(c_phone, 1, 2) AS cntrycode, + c_acctbal + FROM + customer + WHERE + substr(c_phone, 1, 2) IN + ('13', '31', '23', '29', '30', '18', '17') + AND c_acctbal > ( + SELECT avg(c_acctbal) + FROM + customer + WHERE + c_acctbal > 0.00 + AND substr(c_phone, 1, 2) IN + ('13', '31', '23', '29', '30', '18', '17') + ) + AND NOT exists( + SELECT * + FROM + orders + WHERE + o_custkey = c_custkey + ) + ) AS custsale +GROUP BY + cntrycode +ORDER BY + cntrycode diff --git a/modules/calcite/src/test/resources/tpch/q3.sql b/modules/calcite/src/test/resources/tpch/q3.sql new file mode 100644 index 0000000000000..8a6eab5ce987f --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q3.sql @@ -0,0 +1,26 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + l_orderkey, + sum(l_extendedprice * (1 - l_discount)) AS revenue, + o_orderdate, + o_shippriority +FROM + customer, + orders, + lineitem +WHERE + c_mktsegment = 'BUILDING' + AND c_custkey = o_custkey + AND l_orderkey = o_orderkey + AND o_orderdate < DATE '1995-03-15' + AND l_shipdate > DATE '1995-03-15' +GROUP BY + l_orderkey, + o_orderdate, + o_shippriority +ORDER BY + revenue DESC, + o_orderdate + LIMIT 10 diff --git a/modules/calcite/src/test/resources/tpch/q4.sql b/modules/calcite/src/test/resources/tpch/q4.sql new file mode 100644 index 0000000000000..18ca1817e0bb5 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q4.sql @@ -0,0 +1,21 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + o_orderpriority, + count(*) AS order_count +FROM orders +WHERE + o_orderdate >= DATE '1993-07-01' + AND o_orderdate < DATE '1993-07-01' + INTERVAL '3' MONTH + AND EXISTS ( + SELECT * + FROM lineitem + WHERE + l_orderkey = o_orderkey + AND l_commitdate < l_receiptdate + ) +GROUP BY + o_orderpriority +ORDER BY + o_orderpriority diff --git a/modules/calcite/src/test/resources/tpch/q5.sql b/modules/calcite/src/test/resources/tpch/q5.sql new file mode 100644 index 0000000000000..2a07e3a5de52b --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q5.sql @@ -0,0 +1,27 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + n_name, + sum(l_extendedprice * (1 - l_discount)) AS revenue +FROM + customer, + orders, + lineitem, + supplier, + nation, + region +WHERE + c_custkey = o_custkey + AND l_orderkey = o_orderkey + AND l_suppkey = s_suppkey + AND c_nationkey = s_nationkey + AND s_nationkey = n_nationkey + AND n_regionkey = r_regionkey + AND r_name = 'ASIA' + AND o_orderdate >= DATE '1994-01-01' + AND o_orderdate < DATE '1994-01-01' + INTERVAL '1' YEAR +GROUP BY + n_name +ORDER BY + revenue DESC diff --git a/modules/calcite/src/test/resources/tpch/q6.sql b/modules/calcite/src/test/resources/tpch/q6.sql new file mode 100644 index 0000000000000..075cf6bd1b5f6 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q6.sql @@ -0,0 +1,11 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT sum(l_extendedprice * l_discount) AS revenue +FROM + lineitem +WHERE + l_shipdate >= DATE '1994-01-01' + AND l_shipdate < DATE '1994-01-01' + INTERVAL '1' YEAR + AND l_discount BETWEEN decimal '0.06' - decimal '0.01' AND decimal '0.06' + decimal '0.01' + AND l_quantity < 24 diff --git a/modules/calcite/src/test/resources/tpch/q7.sql b/modules/calcite/src/test/resources/tpch/q7.sql new file mode 100644 index 0000000000000..a98318a1f3654 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q7.sql @@ -0,0 +1,41 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + supp_nation, + cust_nation, + l_year, + sum(volume) AS revenue +FROM ( + SELECT + n1.n_name AS supp_nation, + n2.n_name AS cust_nation, + extract(YEAR FROM l_shipdate) AS l_year, + l_extendedprice * (1 - l_discount) AS volume + FROM + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2 + WHERE + s_suppkey = l_suppkey + AND o_orderkey = l_orderkey + AND c_custkey = o_custkey + AND s_nationkey = n1.n_nationkey + AND c_nationkey = n2.n_nationkey + AND ( + (n1.n_name = 'FRANCE' AND n2.n_name = 'GERMANY') + OR (n1.n_name = 'GERMANY' AND n2.n_name = 'FRANCE') + ) + AND l_shipdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' + ) AS shipping +GROUP BY + supp_nation, + cust_nation, + l_year +ORDER BY + supp_nation, + cust_nation, + l_year diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql new file mode 100644 index 0000000000000..617d098c1ab1b --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -0,0 +1,40 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + o_year, + sum(CASE + WHEN nation = 'BRAZIL' + THEN volume + ELSE 0 + END) / sum(volume) AS mkt_share +FROM ( + SELECT + extract(YEAR FROM o_orderdate) AS o_year, + l_extendedprice * (1 - l_discount) AS volume, + n2.n_name AS nation + FROM + part, + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2, + region + WHERE + p_partkey = l_partkey + AND s_suppkey = l_suppkey + AND l_orderkey = o_orderkey + AND o_custkey = c_custkey + AND c_nationkey = n1.n_nationkey + AND n1.n_regionkey = r_regionkey + AND r_name = 'AMERICA' + AND s_nationkey = n2.n_nationkey + AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' + AND p_type = 'ECONOMY ANODIZED STEEL' + ) AS all_nations +GROUP BY + o_year +ORDER BY + o_year diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql new file mode 100644 index 0000000000000..0fdc07f1bf437 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -0,0 +1,34 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +SELECT + nation, + o_year, + sum(amount) AS sum_profit +FROM ( + SELECT + n_name AS nation, + extract(YEAR FROM o_orderdate) AS o_year, + l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount + FROM + part, + supplier, + lineitem, + partsupp, + orders, + nation + WHERE + s_suppkey = l_suppkey + AND ps_suppkey = l_suppkey + AND ps_partkey = l_partkey + AND p_partkey = l_partkey + AND o_orderkey = l_orderkey + AND s_nationkey = n_nationkey + AND p_name LIKE '%green%' + ) AS profit +GROUP BY + nation, + o_year +ORDER BY + nation, + o_year DESC diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.sql b/modules/calcite/src/test/resources/tpch/variant_q12.sql new file mode 100644 index 0000000000000..02bd28364b5be --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/variant_q12.sql @@ -0,0 +1,25 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +-- This variant replaces the CASE statement from the Functional Query Definition with equivalent DECODE() syntax + +SELECT + l_shipmode, + sum(decode(o_orderpriority, '1-URGENT', 1, '2-HIGH', 1, 0)) as + high_line_count, + sum(decode(o_orderpriority, '1-URGENT', 0, '2-HIGH', 0, 1)) as + low_line_count +FROM + orders, + lineitem +WHERE + o_orderkey = l_orderkey + AND l_shipmode IN ('MAIL', 'SHIP') + AND l_commitdate < l_receiptdate + AND l_shipdate < l_commitdate + AND l_receiptdate >= DATE '1994-01-01' + AND l_receiptdate < DATE '1994-01-01' + INTERVAL '1' YEAR +GROUP BY + l_shipmode +ORDER BY + l_shipmode diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.sql b/modules/calcite/src/test/resources/tpch/variant_q14.sql new file mode 100644 index 0000000000000..4738c3b13b9d3 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/variant_q14.sql @@ -0,0 +1,16 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +-- -- This variant replaces the CASE statement from the Functional Query Definition with equivalent DECODE() syntax + +SELECT + 100.00 * sum(decode(substring(p_type from 1 for 5), 'PROMO', + l_extendedprice * (1-l_discount), 0)) / + sum(l_extendedprice * (1-l_discount)) as promo_revenue +FROM + lineitem, + part +WHERE + l_partkey = p_partkey + AND l_shipdate >= DATE '1995-09-01' + AND l_shipdate < DATE '1995-09-01' + INTERVAL '1' MONTH diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.sql b/modules/calcite/src/test/resources/tpch/variant_q8.sql new file mode 100644 index 0000000000000..a93f0b73d095a --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/variant_q8.sql @@ -0,0 +1,38 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile + +-- This variant replaces the CASE statement from the Functional Query Definition with equivalent DECODE() syntax + +SELECT + o_year, + sum(decode(nation, 'BRAZIL', volume, 0)) / sum(volume) as mkt_share +FROM ( + SELECT + extract(YEAR FROM o_orderdate) AS o_year, + l_extendedprice * (1 - l_discount) AS volume, + n2.n_name AS nation + FROM + part, + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2, + region + WHERE + p_partkey = l_partkey + AND s_suppkey = l_suppkey + AND l_orderkey = o_orderkey + AND o_custkey = c_custkey + AND c_nationkey = n1.n_nationkey + AND n1.n_regionkey = r_regionkey + AND r_name = 'AMERICA' + AND s_nationkey = n2.n_nationkey + AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' + AND p_type = 'ECONOMY ANODIZED STEEL' + ) AS all_nations +GROUP BY + o_year +ORDER BY + o_year From 68f4b23756b026a433cf930e31cb5ec0de0bd2bc Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 09:32:00 +0300 Subject: [PATCH 05/39] WIP. Fix plans for tpch --- .../calcite/src/test/resources/tpch/q10.plan | 18 +++++++++ .../calcite/src/test/resources/tpch/q11.plan | 24 +++++++++++ .../calcite/src/test/resources/tpch/q12.plan | 9 +++++ .../calcite/src/test/resources/tpch/q13.plan | 10 +++++ .../calcite/src/test/resources/tpch/q14.plan | 8 ++++ .../calcite/src/test/resources/tpch/q15.plan | 14 +++++++ .../calcite/src/test/resources/tpch/q16.plan | 20 ++++++++++ .../calcite/src/test/resources/tpch/q17.plan | 16 ++++++++ .../calcite/src/test/resources/tpch/q18.plan | 20 ++++++++++ .../calcite/src/test/resources/tpch/q19.plan | 7 ++++ .../calcite/src/test/resources/tpch/q2.plan | 40 +++++++++++++++++++ .../calcite/src/test/resources/tpch/q20.plan | 25 ++++++++++++ .../calcite/src/test/resources/tpch/q21.plan | 31 ++++++++++++++ .../calcite/src/test/resources/tpch/q3.plan | 14 +++++++ .../calcite/src/test/resources/tpch/q4.plan | 11 +++++ .../calcite/src/test/resources/tpch/q5.plan | 26 ++++++++++++ .../calcite/src/test/resources/tpch/q6.plan | 3 ++ .../calcite/src/test/resources/tpch/q7.plan | 25 ++++++++++++ .../calcite/src/test/resources/tpch/q8.plan | 35 ++++++++++++++++ .../calcite/src/test/resources/tpch/q9.plan | 26 ++++++++++++ .../src/test/resources/tpch/variant_q12.plan | 9 +++++ .../src/test/resources/tpch/variant_q14.plan | 8 ++++ .../src/test/resources/tpch/variant_q8.plan | 35 ++++++++++++++++ 23 files changed, 434 insertions(+) create mode 100644 modules/calcite/src/test/resources/tpch/q10.plan create mode 100644 modules/calcite/src/test/resources/tpch/q11.plan create mode 100644 modules/calcite/src/test/resources/tpch/q12.plan create mode 100644 modules/calcite/src/test/resources/tpch/q13.plan create mode 100644 modules/calcite/src/test/resources/tpch/q14.plan create mode 100644 modules/calcite/src/test/resources/tpch/q15.plan create mode 100644 modules/calcite/src/test/resources/tpch/q16.plan create mode 100644 modules/calcite/src/test/resources/tpch/q17.plan create mode 100644 modules/calcite/src/test/resources/tpch/q18.plan create mode 100644 modules/calcite/src/test/resources/tpch/q19.plan create mode 100644 modules/calcite/src/test/resources/tpch/q2.plan create mode 100644 modules/calcite/src/test/resources/tpch/q20.plan create mode 100644 modules/calcite/src/test/resources/tpch/q21.plan create mode 100644 modules/calcite/src/test/resources/tpch/q3.plan create mode 100644 modules/calcite/src/test/resources/tpch/q4.plan create mode 100644 modules/calcite/src/test/resources/tpch/q5.plan create mode 100644 modules/calcite/src/test/resources/tpch/q6.plan create mode 100644 modules/calcite/src/test/resources/tpch/q7.plan create mode 100644 modules/calcite/src/test/resources/tpch/q8.plan create mode 100644 modules/calcite/src/test/resources/tpch/q9.plan create mode 100644 modules/calcite/src/test/resources/tpch/variant_q12.plan create mode 100644 modules/calcite/src/test/resources/tpch/variant_q14.plan create mode 100644 modules/calcite/src/test/resources/tpch/variant_q8.plan diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan new file mode 100644 index 0000000000000..0e67fb7748000 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -0,0 +1,18 @@ +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25642 + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25641 + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25640 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25639 + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25638 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25637 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25629 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25636 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25630 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 439 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25635 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25632 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25631 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25634 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25633 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512 diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan new file mode 100644 index 0000000000000..626cdbc6bb7b0 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -0,0 +1,24 @@ +IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = 47280 + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = 47279 + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = 47273 + IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = 47272 + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = 47271 + IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = 47270 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 47266 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26025 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47269 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47267 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26076 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47268 + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26120 + IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47278 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = 47277 + IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = 47276 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = 47275 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 47274 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38542 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47269 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47267 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26076 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47268 + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26120 diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan new file mode 100644 index 0000000000000..98b54c4d4bf1e --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -0,0 +1,9 @@ +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 54776 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 54775 + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 54774 + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 54773 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 54772 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54771 + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54770 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47449 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49226 diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan new file mode 100644 index 0000000000000..88fa51a4d1e9d --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -0,0 +1,10 @@ +IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = 58968 + IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = 58967 + IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = 58966 + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = 58965 + IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = 58964 + IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 58963 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58961 + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54973 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58962 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54926 diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan new file mode 100644 index 0000000000000..f97c80751b254 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -0,0 +1,8 @@ +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 62749 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 62748 + IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62747 + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62746 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62744 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59124 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62745 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59100 diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan new file mode 100644 index 0000000000000..66bdcd99131c6 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -0,0 +1,14 @@ +IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332404 + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332403 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332394 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64353 + IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332402 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332401 + IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332396 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 332395 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 63106 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = 332400 + IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = 332399 + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = 332398 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 332397 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 63104 diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan new file mode 100644 index 0000000000000..fe3736551e1f4 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -0,0 +1,20 @@ +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = 381846 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = 381845 + IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = 381844 + IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = 381843 + IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381842 + IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381832 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381831 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332801 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381841 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381835 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381834 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381833 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332960 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340668 + IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381840 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381839 + IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381838 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = 381837 + IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = 381836 + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 341021 diff --git a/modules/calcite/src/test/resources/tpch/q17.plan b/modules/calcite/src/test/resources/tpch/q17.plan new file mode 100644 index 0000000000000..a83751b92642b --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q17.plan @@ -0,0 +1,16 @@ +IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = 385181 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = 385180 + IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = 385179 + IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = 385178 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = 385177 + IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = 385171 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 385169 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382118 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 385170 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382094 + IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = 385176 + IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = 385175 + IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 385174 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 385173 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 385172 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 384088 diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan new file mode 100644 index 0000000000000..42830d8947b51 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -0,0 +1,20 @@ +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = 433608 + IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = 433607 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = 433606 + IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433605 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433604 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433594 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385469 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433603 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433596 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433595 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385499 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433602 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433598 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433597 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385547 + IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433601 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433600 + IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433599 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433595 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385499 diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan new file mode 100644 index 0000000000000..58170ca4fab79 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -0,0 +1,7 @@ +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = 436475 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = 436474 + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436473 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436472 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436471 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433740 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433804 diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan new file mode 100644 index 0000000000000..ffa18557e372e --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -0,0 +1,40 @@ +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511973 + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511972 + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511971 + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511970 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511969 + IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 511957 + IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 511956 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 511945 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437003 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511955 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511946 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437044 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511954 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511948 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511947 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437086 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 511953 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511950 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511949 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437127 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511952 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511951 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437160 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 511968 + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 511967 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511966 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511958 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511946 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437044 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511965 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511960 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511959 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482336 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 511964 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511962 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511961 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482435 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511963 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511951 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437160 diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan new file mode 100644 index 0000000000000..1c9608e3faf00 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -0,0 +1,25 @@ +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = 524362 + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524361 + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524360 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524343 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512376 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524359 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524344 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512411 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524358 + IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524357 + IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524356 + IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = 524355 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = 524354 + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = 524348 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 524345 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512462 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = 524347 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 524346 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512509 + IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = 524353 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = 524352 + IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = 524351 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 524350 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 524349 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 513129 diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan new file mode 100644 index 0000000000000..d069ec9a09f67 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -0,0 +1,31 @@ +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = 551869 + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = 551868 + IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = 551867 + IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = 551866 + IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = 551865 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = 551864 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = 551860 + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551855 + IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551854 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551846 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524826 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551853 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551847 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524859 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551852 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551849 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551848 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524928 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551851 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551850 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524951 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551859 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551858 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551857 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551856 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548615 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551863 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551862 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551861 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551847 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524859 diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan new file mode 100644 index 0000000000000..076623e1c807c --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -0,0 +1,14 @@ +IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888323 + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888322 + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888321 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888320 + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888319 + IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888318 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888313 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 552148 + IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888317 + IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888316 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888314 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 552186 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888315 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 557032 diff --git a/modules/calcite/src/test/resources/tpch/q4.plan b/modules/calcite/src/test/resources/tpch/q4.plan new file mode 100644 index 0000000000000..8bb8b6f230b69 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q4.plan @@ -0,0 +1,11 @@ +IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = 889166 + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = 889165 + IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = 889164 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = 889163 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 889158 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 888476 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = 889162 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889161 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889160 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889159 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 888550 diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan new file mode 100644 index 0000000000000..790e3db08f2ab --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -0,0 +1,26 @@ +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = 995894 + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = 995893 + IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = 995892 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = 995891 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 995875 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889546 + IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = 995890 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = 995889 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 995877 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 995876 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889608 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 995888 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 995879 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 995878 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889662 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 995887 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 995881 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 995880 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889724 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 995886 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 995883 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 995882 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889779 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 995885 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 995884 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 889798 diff --git a/modules/calcite/src/test/resources/tpch/q6.plan b/modules/calcite/src/test/resources/tpch/q6.plan new file mode 100644 index 0000000000000..a402acbaf90c6 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q6.plan @@ -0,0 +1,3 @@ +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 995965 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 995964 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 995950 diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan new file mode 100644 index 0000000000000..0b014528178bb --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -0,0 +1,25 @@ +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = 1732535 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1732534 + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1732533 + IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1732532 + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1732531 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732518 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996407 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1732530 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732519 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996441 + IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1732529 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1732521 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1732520 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 996501 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1732528 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1732523 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732522 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996556 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1732527 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1732525 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732524 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996595 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1732526 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732518 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996407 diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan new file mode 100644 index 0000000000000..ec57961ea9278 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -0,0 +1,35 @@ +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 1932220 + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1932219 + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1932218 + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1932217 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1932216 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 1932194 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733110 + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1932215 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1932214 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1932196 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932195 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733139 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1932213 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1932198 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932197 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733173 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1932212 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1932200 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1932199 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733242 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1932211 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1932202 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1932201 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1733286 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1932210 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1932204 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932203 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733348 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1932209 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1932206 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932205 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733396 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1932208 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1932207 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1733422 diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan new file mode 100644 index 0000000000000..903b0a58a6878 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -0,0 +1,26 @@ +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = 2105777 + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = 2105776 + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2105775 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2105774 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2105758 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932609 + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2105773 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2105772 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2105760 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2105759 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932624 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2105771 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2105762 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2105761 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932703 + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2105770 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2105764 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2105763 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932733 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2105769 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2105766 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2105765 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932808 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2105768 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2105767 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932831 diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan new file mode 100644 index 0000000000000..0557eb8c6a2dd --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -0,0 +1,9 @@ +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 2113273 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 2113272 + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 2113271 + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 2113270 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 2113269 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2113268 + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2113267 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2105947 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2107723 diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan new file mode 100644 index 0000000000000..ac7fe04176cf4 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -0,0 +1,8 @@ +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 2117054 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 2117053 + IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2117052 + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2117051 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2117049 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2113429 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2117050 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2113409 diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan new file mode 100644 index 0000000000000..afdeed0d00174 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -0,0 +1,35 @@ +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 2316739 + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2316738 + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2316737 + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2316736 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2316735 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2316713 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117629 + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2316734 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2316733 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2316715 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316714 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117657 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2316732 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2316717 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316716 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117692 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2316731 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2316719 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2316718 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117754 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2316730 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2316721 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2316720 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2117805 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2316729 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2316723 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316722 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117860 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2316728 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2316725 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316724 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117922 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2316727 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2316726 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2117941 From 1fef5b1f144cb439a8ccda36d56d4c3d75c34bee Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 09:33:03 +0300 Subject: [PATCH 06/39] WIP. Fix plans for tpch --- .../query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 5ac63dd7ce3c7..02991df70b621 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -56,7 +56,7 @@ * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { - private static final boolean updatePlan = true; + private static final boolean updatePlan = false; private static final Pattern COSTS_PATTERN = Pattern.compile("\\s+est: \\(rows=\\d+\\)"); From a955be17c1dc8e709087b3c84d1722cbbae47c3f Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 09:55:18 +0300 Subject: [PATCH 07/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 17 +++- .../calcite/src/test/resources/tpch/q1.plan | 2 +- .../calcite/src/test/resources/tpch/q10.plan | 32 ++++---- .../calcite/src/test/resources/tpch/q11.plan | 48 +++++------ .../calcite/src/test/resources/tpch/q12.plan | 18 ++--- .../calcite/src/test/resources/tpch/q13.plan | 20 ++--- .../calcite/src/test/resources/tpch/q14.plan | 16 ++-- .../calcite/src/test/resources/tpch/q15.plan | 28 +++---- .../calcite/src/test/resources/tpch/q16.plan | 40 +++++----- .../calcite/src/test/resources/tpch/q17.plan | 32 ++++---- .../calcite/src/test/resources/tpch/q18.plan | 40 +++++----- .../calcite/src/test/resources/tpch/q19.plan | 14 ++-- .../calcite/src/test/resources/tpch/q2.plan | 80 +++++++++---------- .../calcite/src/test/resources/tpch/q20.plan | 50 ++++++------ .../calcite/src/test/resources/tpch/q21.plan | 62 +++++++------- .../calcite/src/test/resources/tpch/q22.plan | 16 ++++ .../calcite/src/test/resources/tpch/q3.plan | 28 +++---- .../calcite/src/test/resources/tpch/q4.plan | 22 ++--- .../calcite/src/test/resources/tpch/q5.plan | 52 ++++++------ .../calcite/src/test/resources/tpch/q6.plan | 6 +- .../calcite/src/test/resources/tpch/q7.plan | 50 ++++++------ .../calcite/src/test/resources/tpch/q8.plan | 70 ++++++++-------- .../calcite/src/test/resources/tpch/q9.plan | 52 ++++++------ .../src/test/resources/tpch/variant_q12.plan | 18 ++--- .../src/test/resources/tpch/variant_q14.plan | 16 ++-- .../src/test/resources/tpch/variant_q8.plan | 70 ++++++++-------- 26 files changed, 465 insertions(+), 434 deletions(-) create mode 100644 modules/calcite/src/test/resources/tpch/q22.plan diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 02991df70b621..1a2e09359671c 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -35,7 +35,9 @@ import com.google.common.io.CharStreams; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.sql.SqlExplainLevel; +import org.apache.ignite.cache.query.annotations.QuerySqlFunction; import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; +import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgnitionEx; @@ -56,7 +58,7 @@ * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { - private static final boolean updatePlan = false; + private static final boolean updatePlan = true; private static final Pattern COSTS_PATTERN = Pattern.compile("\\s+est: \\(rows=\\d+\\)"); @@ -78,6 +80,10 @@ public static void startAll(Class testClass) throws Exception { srv = (IgniteEx)IgnitionEx.start(cfg); + srv.createCache(new CacheConfiguration<>("mock") + .setSqlFunctionClasses(AbstractTpcQueryPlannerTest.TpchUDF.class) + .setSqlSchema("PUBLIC")); + TpcTable[] tables = cast(TpchHelper.tables(testClass).getEnumConstants()); for (TpcTable table : tables) @@ -216,4 +222,13 @@ private static List scriptToQueries(String sqlScript) { @Override protected boolean isSafeTopology() { return false; } + + /** */ + public static class TpchUDF { + /** */ + @QuerySqlFunction(alias = "SUBSTR") + public static String substr(String str, int from, int cnt) { + return str.substring(from, from + cnt); + } + } } diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan index 75c47cfa5a1da..7d944a245b685 100644 --- a/modules/calcite/src/test/resources/tpch/q1.plan +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -2,4 +2,4 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LI IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = 116 IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = 115 IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = 114 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 74 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 69 diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index 0e67fb7748000..9c81c8cb4114b 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,18 +1,18 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25642 - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25641 - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25640 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25639 - IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25638 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25637 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25629 +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25639 + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25638 + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25637 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25636 + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25635 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25634 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25626 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25636 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25630 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 439 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25635 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25632 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25631 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25633 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25627 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25632 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25629 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25628 IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25634 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25633 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25631 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25630 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 511 diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index 626cdbc6bb7b0..36ea0e8bb1f1c 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,24 +1,24 @@ -IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = 47280 - IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = 47279 - IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = 47273 - IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = 47272 - IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = 47271 - IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = 47270 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 47266 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26025 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47269 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47267 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26076 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47268 - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26120 - IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47278 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = 47277 - IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = 47276 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = 47275 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 47274 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38542 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47269 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47267 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26076 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47268 - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26120 +IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = 47269 + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = 47268 + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = 47262 + IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = 47261 + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = 47260 + IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = 47259 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 47255 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26022 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47258 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47256 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26080 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47257 + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26117 + IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47267 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = 47266 + IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = 47265 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = 47264 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 47263 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38535 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47258 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47256 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26080 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47257 + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26117 diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 98b54c4d4bf1e..7d1c597f395cb 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 54776 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 54775 - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 54774 - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 54773 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 54772 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54771 - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54770 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47449 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49226 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 54765 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 54764 + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 54763 + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 54762 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 54761 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54760 + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54759 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47440 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49216 diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index 88fa51a4d1e9d..8410e5be9ddf3 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -1,10 +1,10 @@ -IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = 58968 - IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = 58967 - IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = 58966 - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = 58965 - IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = 58964 - IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 58963 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58961 - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54973 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58962 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54926 +IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = 58958 + IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = 58957 + IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = 58956 + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = 58955 + IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = 58954 + IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 58953 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58951 + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54962 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58952 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54916 diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index f97c80751b254..c8c77bb6749b3 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 62749 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 62748 - IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62747 - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62746 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62744 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59124 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62745 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59100 +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 62739 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 62738 + IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62737 + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62736 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62734 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59114 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62735 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59092 diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 66bdcd99131c6..18c04e03f621c 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,14 +1,14 @@ -IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332404 - IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332403 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332394 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64353 - IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332402 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332401 - IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332396 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 332395 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 63106 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = 332400 - IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = 332399 - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = 332398 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 332397 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 63104 +IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332391 + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332390 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332381 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64345 + IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332389 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332388 + IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332383 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 332382 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 63093 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = 332387 + IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = 332386 + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = 332385 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 332384 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 63091 diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index fe3736551e1f4..bb1b380392803 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,20 +1,20 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = 381846 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = 381845 - IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = 381844 - IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = 381843 - IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381842 - IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381832 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381831 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332801 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381841 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381835 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381834 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381833 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332960 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340668 - IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381840 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381839 - IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381838 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = 381837 - IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = 381836 - IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 341021 +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = 381832 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = 381831 + IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = 381830 + IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = 381829 + IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381828 + IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381818 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381817 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332787 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381827 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381821 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381820 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381819 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332947 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340655 + IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381826 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381825 + IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381824 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = 381823 + IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = 381822 + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 341008 diff --git a/modules/calcite/src/test/resources/tpch/q17.plan b/modules/calcite/src/test/resources/tpch/q17.plan index a83751b92642b..19a4a79274882 100644 --- a/modules/calcite/src/test/resources/tpch/q17.plan +++ b/modules/calcite/src/test/resources/tpch/q17.plan @@ -1,16 +1,16 @@ -IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = 385181 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = 385180 - IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = 385179 - IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = 385178 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = 385177 - IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = 385171 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 385169 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382118 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 385170 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382094 - IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = 385176 - IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = 385175 - IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 385174 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 385173 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 385172 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 384088 +IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = 385167 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = 385166 + IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = 385165 + IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = 385164 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = 385163 + IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = 385157 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 385155 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382098 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 385156 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382080 + IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = 385162 + IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = 385161 + IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 385160 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 385159 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 385158 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 384075 diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 42830d8947b51..9d5137f533014 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -1,20 +1,20 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = 433608 - IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = 433607 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = 433606 - IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433605 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433604 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433594 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385469 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433603 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433596 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433595 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385499 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433602 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433598 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433597 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385547 - IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433601 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433600 - IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433599 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433595 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385499 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = 433658 + IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = 433657 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = 433656 + IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433655 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433654 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433644 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385454 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433653 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433646 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433645 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385485 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433652 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433648 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433647 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385533 + IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433651 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433650 + IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433649 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433645 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385485 diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 58170ca4fab79..8d736af2f4719 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -1,7 +1,7 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = 436475 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = 436474 - IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436473 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436472 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436471 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433740 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433804 +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = 436525 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = 436524 + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436523 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436522 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436521 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433790 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433854 diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index ffa18557e372e..83b4ba100f03d 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,40 +1,40 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511973 - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511972 - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511971 - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511970 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511969 - IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 511957 - IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 511956 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 511945 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437003 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511955 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511946 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437044 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511954 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511948 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511947 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437086 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 511953 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511950 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511949 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437127 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511952 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511951 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437160 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 511968 - IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 511967 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511966 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511958 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511946 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437044 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511965 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511960 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511959 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482336 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 511964 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511962 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511961 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482435 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511963 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511951 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437160 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 512040 + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 512039 + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 512038 + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 512037 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 512036 + IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 512024 + IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 512023 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 512012 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437053 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 512022 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 512013 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437087 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 512021 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 512015 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 512014 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437143 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 512020 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 512017 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 512016 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437191 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 512019 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 512018 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437210 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 512035 + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 512034 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 512033 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 512025 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 512013 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437087 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 512032 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 512027 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 512026 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482373 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 512031 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 512029 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 512028 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482485 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 512030 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 512018 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437210 diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 1c9608e3faf00..19495e8abe42e 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -1,25 +1,25 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = 524362 - IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524361 - IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524360 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524343 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512376 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524359 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524344 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512411 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524358 - IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524357 - IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524356 - IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = 524355 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = 524354 - IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = 524348 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 524345 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512462 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = 524347 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 524346 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512509 - IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = 524353 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = 524352 - IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = 524351 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 524350 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 524349 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 513129 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = 524445 + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524444 + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524443 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524426 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512444 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524442 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524427 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512478 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524441 + IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524440 + IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524439 + IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = 524438 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = 524437 + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = 524431 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 524428 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512529 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = 524430 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 524429 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512576 + IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = 524436 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = 524435 + IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = 524434 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 524433 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 524432 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 513195 diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index d069ec9a09f67..7a809bea71d01 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -1,31 +1,31 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = 551869 - IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = 551868 - IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = 551867 - IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = 551866 - IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = 551865 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = 551864 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = 551860 - IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551855 - IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551854 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551846 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524826 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551853 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551847 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524859 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551852 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551849 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551848 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524928 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551851 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551850 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524951 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551859 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551858 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551857 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551856 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548615 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551863 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551862 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551861 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551847 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524859 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = 551942 + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = 551941 + IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = 551940 + IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = 551939 + IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = 551938 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = 551937 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = 551933 + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551928 + IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551927 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551919 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524912 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551926 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551920 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524942 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551925 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551922 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551921 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524997 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551924 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551923 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 525033 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551932 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551931 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551930 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551929 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548688 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551936 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551935 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551934 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551920 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524942 diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan new file mode 100644 index 0000000000000..69f890f849853 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -0,0 +1,16 @@ +IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = 553424 + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = 553423 + IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = 553422 + IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = 553421 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = 553420 + IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = 553415 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 553412 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552268 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 553414 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553413 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552204 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = 553419 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = 553418 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = 553417 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553416 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552474 diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 076623e1c807c..11ad9fecd9985 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,14 +1,14 @@ -IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888323 - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888322 - IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888321 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888320 - IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888319 - IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888318 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888313 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 552148 - IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888317 - IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888316 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888314 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 552186 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888315 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 557032 +IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888653 + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888652 + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888651 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888650 + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888649 + IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888648 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888643 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553703 + IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888647 + IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888646 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888644 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553762 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888645 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 558587 diff --git a/modules/calcite/src/test/resources/tpch/q4.plan b/modules/calcite/src/test/resources/tpch/q4.plan index 8bb8b6f230b69..57302232a1cbc 100644 --- a/modules/calcite/src/test/resources/tpch/q4.plan +++ b/modules/calcite/src/test/resources/tpch/q4.plan @@ -1,11 +1,11 @@ -IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = 889166 - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = 889165 - IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = 889164 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = 889163 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 889158 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 888476 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = 889162 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889161 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889160 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889159 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 888550 +IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = 889496 + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = 889495 + IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = 889494 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = 889493 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 889488 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 888806 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = 889492 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889491 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889490 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889489 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 888880 diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index 790e3db08f2ab..63508e2b9241a 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -1,26 +1,26 @@ -IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = 995894 - IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = 995893 - IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = 995892 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = 995891 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 995875 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889546 - IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = 995890 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = 995889 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 995877 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 995876 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889608 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 995888 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 995879 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 995878 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889662 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 995887 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 995881 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 995880 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889724 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 995886 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 995883 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 995882 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889779 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 995885 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 995884 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 889798 +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = 996212 + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = 996211 + IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996210 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996209 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996193 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889876 + IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = 996208 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = 996207 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 996195 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996194 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889938 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 996206 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 996197 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 996196 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889992 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 996205 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 996199 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996198 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890047 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 996204 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 996201 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 996200 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890102 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 996203 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 996202 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 890128 diff --git a/modules/calcite/src/test/resources/tpch/q6.plan b/modules/calcite/src/test/resources/tpch/q6.plan index a402acbaf90c6..38db21cac7d82 100644 --- a/modules/calcite/src/test/resources/tpch/q6.plan +++ b/modules/calcite/src/test/resources/tpch/q6.plan @@ -1,3 +1,3 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 995965 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 995964 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 995950 +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 996283 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 996282 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996270 diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 0b014528178bb..1bbc3058c02ad 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,25 +1,25 @@ -IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = 1732535 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1732534 - IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1732533 - IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1732532 - IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1732531 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732518 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996407 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1732530 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732519 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996441 - IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1732529 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1732521 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1732520 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 996501 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1732528 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1732523 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732522 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996556 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1732527 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1732525 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732524 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996595 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1732526 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1732518 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996407 +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = 1738523 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1738522 + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1738521 + IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1738520 + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1738519 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738506 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996725 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1738518 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738507 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996759 + IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1738517 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1738509 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1738508 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 996826 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1738516 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1738511 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738510 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996865 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1738515 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1738513 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738512 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996920 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1738514 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738506 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996725 diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index ec57961ea9278..e277792ea7a6c 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -1,35 +1,35 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 1932220 - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1932219 - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1932218 - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1932217 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1932216 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 1932194 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733110 - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1932215 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1932214 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1932196 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932195 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733139 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1932213 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1932198 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932197 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733173 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1932212 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1932200 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1932199 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733242 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1932211 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1932202 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1932201 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1733286 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1932210 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1932204 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932203 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733348 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1932209 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1932206 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1932205 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1733396 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1932208 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1932207 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1733422 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 1938189 + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1938188 + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1938187 + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1938186 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1938185 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 1938163 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739098 + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1938184 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1938183 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1938165 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938164 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739126 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1938182 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1938167 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938166 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739161 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1938181 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1938169 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1938168 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739229 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1938180 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1938171 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1938170 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1739267 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1938179 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1938173 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938172 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739343 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1938178 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1938175 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938174 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739384 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1938177 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1938176 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1739410 diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index 903b0a58a6878..981c7d84429f7 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,26 +1,26 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = 2105777 - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = 2105776 - IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2105775 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2105774 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2105758 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932609 - IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2105773 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2105772 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2105760 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2105759 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932624 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2105771 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2105762 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2105761 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932703 - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2105770 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2105764 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2105763 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932733 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2105769 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2105766 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2105765 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932808 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2105768 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2105767 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1932831 +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = 2111715 + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = 2111714 + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2111713 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2111712 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2111696 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938578 + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2111711 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2111710 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2111698 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2111697 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938593 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2111709 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2111700 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2111699 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938673 + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2111708 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2111702 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2111701 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938702 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2111707 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2111704 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2111703 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938763 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2111706 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2111705 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938800 diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 0557eb8c6a2dd..3f123e3fea67f 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 2113273 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 2113272 - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 2113271 - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 2113270 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 2113269 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2113268 - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2113267 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2105947 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2107723 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 2119211 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 2119210 + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 2119209 + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 2119208 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 2119207 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2119206 + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2119205 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2111887 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2113658 diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index ac7fe04176cf4..3e7c87bdcf36b 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 2117054 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 2117053 - IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2117052 - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2117051 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2117049 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2113429 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2117050 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2113409 +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 2122992 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 2122991 + IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2122990 + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2122989 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2122987 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2119367 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2122988 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2119346 diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index afdeed0d00174..bbadd9c9e4d4a 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -1,35 +1,35 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 2316739 - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2316738 - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2316737 - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2316736 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2316735 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2316713 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117629 - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2316734 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2316733 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2316715 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316714 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117657 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2316732 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2316717 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316716 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117692 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2316731 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2316719 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2316718 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117754 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2316730 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2316721 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2316720 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2117805 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2316729 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2316723 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316722 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117860 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2316728 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2316725 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2316724 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117922 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2316727 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2316726 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2117941 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 2322683 + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2322682 + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2322681 + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2322680 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2322679 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2322657 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123567 + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2322678 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2322677 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2322659 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322658 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123594 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2322676 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2322661 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322660 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123637 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2322675 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2322663 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2322662 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123682 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2322674 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2322665 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2322664 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2123757 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2322673 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2322667 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322666 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123812 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2322672 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2322669 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322668 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123860 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2322671 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2322670 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2123879 From c741c690afd44fa1c411149a1cbd5ae7b48147f9 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 10:08:57 +0300 Subject: [PATCH 08/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 27 +++---- .../calcite/src/test/resources/tpch/q1.plan | 10 +-- .../calcite/src/test/resources/tpch/q10.plan | 36 ++++----- .../calcite/src/test/resources/tpch/q11.plan | 48 +++++------ .../calcite/src/test/resources/tpch/q12.plan | 18 ++--- .../calcite/src/test/resources/tpch/q13.plan | 20 ++--- .../calcite/src/test/resources/tpch/q14.plan | 16 ++-- .../calcite/src/test/resources/tpch/q15.plan | 28 +++---- .../calcite/src/test/resources/tpch/q16.plan | 40 +++++----- .../calcite/src/test/resources/tpch/q17.plan | 32 ++++---- .../calcite/src/test/resources/tpch/q18.plan | 40 +++++----- .../calcite/src/test/resources/tpch/q19.plan | 14 ++-- .../calcite/src/test/resources/tpch/q2.plan | 80 +++++++++---------- .../calcite/src/test/resources/tpch/q20.plan | 50 ++++++------ .../calcite/src/test/resources/tpch/q21.plan | 62 +++++++------- .../calcite/src/test/resources/tpch/q22.plan | 32 ++++---- .../calcite/src/test/resources/tpch/q3.plan | 28 +++---- .../calcite/src/test/resources/tpch/q4.plan | 22 ++--- .../calcite/src/test/resources/tpch/q5.plan | 52 ++++++------ .../calcite/src/test/resources/tpch/q6.plan | 6 +- .../calcite/src/test/resources/tpch/q7.plan | 50 ++++++------ .../calcite/src/test/resources/tpch/q8.plan | 70 ++++++++-------- .../calcite/src/test/resources/tpch/q9.plan | 52 ++++++------ .../src/test/resources/tpch/variant_q12.plan | 18 ++--- .../src/test/resources/tpch/variant_q14.plan | 16 ++-- .../src/test/resources/tpch/variant_q8.plan | 70 ++++++++-------- 26 files changed, 466 insertions(+), 471 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 1a2e09359671c..dc4446588151f 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -58,9 +58,9 @@ * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { - private static final boolean updatePlan = true; + private static final boolean UPDATE_PLAN = false; - private static final Pattern COSTS_PATTERN = Pattern.compile("\\s+est: \\(rows=\\d+\\)"); + private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); private static IgniteEx srv; @@ -103,7 +103,7 @@ public static void stopAll(Class testClass) { public void testQueries() { List actualPlans = queryPlan(loadFromResource(String.format(TpchHelper.name(getClass()) + "/%s.sql", queryId))); - if (updatePlan) { + if (UPDATE_PLAN) { updateQueryPlan(queryId, actualPlans); return; } @@ -116,18 +116,8 @@ public void testQueries() { int pos = 0; - for (String actualPlan : actualPlans) { - String expectedPlan = expectedPlans[pos++]; - - // Internally, costs are represented by double values and conversion to exact numeric representation - // may differs from JVM to JVM. - // https://www.oracle.com/java/technologies/javase/19-relnote-issues.html - // Cut-off costs, which may differ between runs, before comparing plans. - expectedPlan = COSTS_PATTERN.matcher(expectedPlan).replaceAll(""); - actualPlan = COSTS_PATTERN.matcher(actualPlan).replaceAll(""); - - assertEquals(expectedPlan, actualPlan); - } + for (String actualPlan : actualPlans) + assertEquals(preparePlan(expectedPlans[pos++]), actualPlan); } static String loadFromResource(String resource) { @@ -187,7 +177,7 @@ private List queryPlan(String sqlScript) { catch (Exception e) { throw new RuntimeException(e); } - }).collect(Collectors.toList()); + }).map(AbstractTpcQueryPlannerTest::preparePlan).collect(Collectors.toList()); } private static List scriptToQueries(String sqlScript) { @@ -218,6 +208,11 @@ private static List scriptToQueries(String sqlScript) { return queries; } + private static String preparePlan(String expectedPlan) { + expectedPlan = ID_PATTERN.matcher(expectedPlan).replaceAll(", id = {id}"); + return expectedPlan; + } + /** {@inheritDoc} */ @Override protected boolean isSafeTopology() { return false; diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan index 7d944a245b685..7096aeb1e4eb3 100644 --- a/modules/calcite/src/test/resources/tpch/q1.plan +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -1,5 +1,5 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = 117 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = 116 - IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = 115 - IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = 114 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 69 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = {id} + IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = {id} + IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index 9c81c8cb4114b..17f840d626701 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,18 +1,18 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25639 - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25638 - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25637 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25636 - IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25635 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25634 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25626 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25633 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25627 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25632 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25629 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25628 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25631 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25630 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 511 +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = {id} + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = {id} + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = {id} + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index 36ea0e8bb1f1c..9d48f6718569f 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,24 +1,24 @@ -IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = 47269 - IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = 47268 - IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = 47262 - IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = 47261 - IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = 47260 - IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = 47259 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 47255 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26022 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47258 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47256 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26080 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47257 - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26117 - IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47267 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = 47266 - IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = 47265 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = 47264 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 47263 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38535 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47258 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47256 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26080 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47257 - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26117 +IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = {id} + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = {id} + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = {id} + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = {id} + IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = {id} + IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 7d1c597f395cb..e63bb712be0eb 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 54765 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 54764 - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 54763 - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 54762 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 54761 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54760 - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54759 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47440 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49216 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index 8410e5be9ddf3..fa37789dd1311 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -1,10 +1,10 @@ -IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = 58958 - IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = 58957 - IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = 58956 - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = 58955 - IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = 58954 - IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 58953 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58951 - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54962 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58952 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54916 +IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = {id} + IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = {id} + IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index c8c77bb6749b3..84dfd83b0d452 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 62739 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 62738 - IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62737 - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62736 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62734 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59114 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62735 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59092 +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 18c04e03f621c..26e30d9a6c566 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,14 +1,14 @@ -IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332391 - IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332390 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332381 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64345 - IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332389 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332388 - IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332383 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 332382 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 63093 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = 332387 - IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = 332386 - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = 332385 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 332384 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 63091 +IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = {id} + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = {id} + IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index bb1b380392803..30e2bbdd1efdf 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,20 +1,20 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = 381832 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = 381831 - IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = 381830 - IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = 381829 - IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381828 - IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381818 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381817 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332787 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381827 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381821 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381820 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381819 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332947 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340655 - IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381826 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381825 - IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381824 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = 381823 - IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = 381822 - IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 341008 +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = {id} + IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = {id} + IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = {id} + IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = {id} + IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q17.plan b/modules/calcite/src/test/resources/tpch/q17.plan index 19a4a79274882..14f65d5193825 100644 --- a/modules/calcite/src/test/resources/tpch/q17.plan +++ b/modules/calcite/src/test/resources/tpch/q17.plan @@ -1,16 +1,16 @@ -IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = 385167 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = 385166 - IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = 385165 - IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = 385164 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = 385163 - IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = 385157 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 385155 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382098 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 385156 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 382080 - IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = 385162 - IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = 385161 - IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 385160 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 385159 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 385158 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 384075 +IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = {id} + IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = {id} + IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = {id} + IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = {id} + IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 9d5137f533014..d939224acd488 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -1,20 +1,20 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = 433658 - IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = 433657 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = 433656 - IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433655 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433654 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433644 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385454 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433653 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433646 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433645 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385485 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433652 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433648 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433647 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385533 - IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433651 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433650 - IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433649 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433645 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385485 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = {id} + IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = {id} + IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 8d736af2f4719..cd075f0b6c636 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -1,7 +1,7 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = 436525 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = 436524 - IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436523 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436522 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436521 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433790 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433854 +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index 83b4ba100f03d..6bf3510727401 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,40 +1,40 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 512040 - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 512039 - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 512038 - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 512037 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 512036 - IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 512024 - IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 512023 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 512012 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437053 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 512022 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 512013 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437087 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 512021 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 512015 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 512014 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437143 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 512020 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 512017 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 512016 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437191 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 512019 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 512018 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437210 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 512035 - IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 512034 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 512033 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 512025 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 512013 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 437087 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 512032 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 512027 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 512026 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482373 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 512031 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 512029 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 512028 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482485 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 512030 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 512018 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 437210 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = {id} + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = {id} + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} + IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = {id} + IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = {id} + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 19495e8abe42e..311dd28fbc098 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -1,25 +1,25 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = 524445 - IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524444 - IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524443 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524426 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512444 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524442 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524427 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512478 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524441 - IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524440 - IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524439 - IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = 524438 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = 524437 - IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = 524431 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 524428 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512529 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = 524430 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 524429 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512576 - IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = 524436 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = 524435 - IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = 524434 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 524433 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 524432 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 513195 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = {id} + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = {id} + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} + IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = {id} + IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = {id} + IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = {id} + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = {id} + IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index 7a809bea71d01..28214d9012f7e 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -1,31 +1,31 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = 551942 - IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = 551941 - IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = 551940 - IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = 551939 - IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = 551938 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = 551937 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = 551933 - IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551928 - IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551927 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551919 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524912 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551926 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551920 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524942 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551925 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551922 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551921 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524997 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551924 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551923 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 525033 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551932 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551931 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551930 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551929 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548688 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551936 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551935 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551934 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551920 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524942 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = {id} + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = {id} + IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = {id} + IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = {id} + IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = {id} + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = {id} + IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 69f890f849853..1799e867f1217 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -1,16 +1,16 @@ -IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = 553424 - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = 553423 - IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = 553422 - IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = 553421 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = 553420 - IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = 553415 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 553412 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552268 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 553414 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553413 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552204 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = 553419 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = 553418 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = 553417 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553416 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552474 +IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = {id} + IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 11ad9fecd9985..4f486ea86b78e 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,14 +1,14 @@ -IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888653 - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888652 - IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888651 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888650 - IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888649 - IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888648 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888643 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553703 - IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888647 - IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888646 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888644 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553762 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888645 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 558587 +IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = {id} + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = {id} + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = {id} + IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = {id} + IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q4.plan b/modules/calcite/src/test/resources/tpch/q4.plan index 57302232a1cbc..0db40602d80b7 100644 --- a/modules/calcite/src/test/resources/tpch/q4.plan +++ b/modules/calcite/src/test/resources/tpch/q4.plan @@ -1,11 +1,11 @@ -IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = 889496 - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = 889495 - IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = 889494 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = 889493 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 889488 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 888806 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = 889492 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889491 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889490 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889489 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 888880 +IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = {id} + IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index 63508e2b9241a..1c109ad9fae6d 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -1,26 +1,26 @@ -IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = 996212 - IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = 996211 - IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996210 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996209 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996193 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889876 - IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = 996208 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = 996207 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 996195 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996194 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889938 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 996206 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 996197 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 996196 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889992 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 996205 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 996199 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996198 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890047 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 996204 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 996201 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 996200 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890102 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 996203 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 996202 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 890128 +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = {id} + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = {id} + IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q6.plan b/modules/calcite/src/test/resources/tpch/q6.plan index 38db21cac7d82..68b06ae548564 100644 --- a/modules/calcite/src/test/resources/tpch/q6.plan +++ b/modules/calcite/src/test/resources/tpch/q6.plan @@ -1,3 +1,3 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 996283 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 996282 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996270 +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 1bbc3058c02ad..58ac15461a0b5 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,25 +1,25 @@ -IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = 1738523 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1738522 - IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1738521 - IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1738520 - IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1738519 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738506 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996725 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1738518 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738507 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996759 - IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1738517 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1738509 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1738508 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 996826 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1738516 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1738511 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738510 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996865 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1738515 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1738513 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738512 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996920 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1738514 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1738506 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996725 +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = {id} + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} + IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index e277792ea7a6c..a3d715e231ffb 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -1,35 +1,35 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 1938189 - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1938188 - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1938187 - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1938186 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1938185 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 1938163 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739098 - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1938184 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1938183 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1938165 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938164 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739126 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1938182 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1938167 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938166 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739161 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1938181 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1938169 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1938168 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739229 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1938180 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1938171 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1938170 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1739267 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1938179 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1938173 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938172 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739343 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1938178 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1938175 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1938174 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1739384 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1938177 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1938176 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1739410 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index 981c7d84429f7..c39ebff93a996 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,26 +1,26 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = 2111715 - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = 2111714 - IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2111713 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2111712 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2111696 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938578 - IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2111711 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2111710 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2111698 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2111697 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938593 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2111709 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2111700 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2111699 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938673 - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2111708 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2111702 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2111701 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938702 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2111707 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2111704 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2111703 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938763 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2111706 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2111705 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1938800 +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 3f123e3fea67f..9340bea39c888 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 2119211 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 2119210 - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 2119209 - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 2119208 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 2119207 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2119206 - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2119205 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2111887 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2113658 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index 3e7c87bdcf36b..bf12d9ee2755f 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 2122992 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 2122991 - IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2122990 - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2122989 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2122987 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2119367 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2122988 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2119346 +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index bbadd9c9e4d4a..a3d715e231ffb 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -1,35 +1,35 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 2322683 - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2322682 - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2322681 - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2322680 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2322679 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2322657 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123567 - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2322678 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2322677 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2322659 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322658 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123594 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2322676 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2322661 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322660 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123637 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2322675 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2322663 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2322662 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123682 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2322674 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2322665 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2322664 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2123757 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2322673 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2322667 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322666 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123812 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2322672 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2322669 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2322668 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2123860 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2322671 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2322670 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2123879 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} From 15d0932ff7f6ba248054461e9999a98bc65d5424 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 10:12:49 +0300 Subject: [PATCH 09/39] WIP. Fix plans for tpch --- .../calcite/planner/tpc/AbstractTpcQueryPlannerTest.java | 2 +- modules/calcite/src/test/resources/tpch/q12.plan | 2 +- modules/calcite/src/test/resources/tpch/q16.plan | 2 +- modules/calcite/src/test/resources/tpch/q19.plan | 2 +- modules/calcite/src/test/resources/tpch/q2.plan | 4 ++-- modules/calcite/src/test/resources/tpch/q22.plan | 2 +- modules/calcite/src/test/resources/tpch/q3.plan | 2 +- modules/calcite/src/test/resources/tpch/q8.plan | 2 +- modules/calcite/src/test/resources/tpch/variant_q12.plan | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index dc4446588151f..d65cb6a81feff 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -100,7 +100,7 @@ public static void stopAll(Class testClass) { } @Test - public void testQueries() { + public void testQuery() { List actualPlans = queryPlan(loadFromResource(String.format(TpchHelper.name(getClass()) + "/%s.sql", queryId))); if (UPDATE_PLAN) { diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index e63bb712be0eb..804da9c9f7154 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -3,7 +3,7 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 30e2bbdd1efdf..1684f34854229 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -9,7 +9,7 @@ IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index cd075f0b6c636..07acfd1b1626f 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -2,6 +2,6 @@ IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cum IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = {id} IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index 6bf3510727401..0e4690f713270 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -9,7 +9,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} @@ -26,7 +26,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 1799e867f1217..f1a5e5608bb1e 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -13,4 +13,4 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1) IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 4f486ea86b78e..517db9e97b899 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,5 +1,5 @@ IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = {id} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = {id} IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = {id} IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index a3d715e231ffb..46a570ec29898 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -13,7 +13,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 9340bea39c888..203aea0ee07d5 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -3,7 +3,7 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=1568331809], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} From 60ac5a0f2c3c26afd5a3c9136409bcea58908e22 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 10:17:57 +0300 Subject: [PATCH 10/39] WIP. Fix plans for tpch --- .../calcite/planner/tpc/AbstractTpcQueryPlannerTest.java | 2 ++ modules/calcite/src/test/resources/tpch/q12.plan | 2 +- modules/calcite/src/test/resources/tpch/q16.plan | 2 +- modules/calcite/src/test/resources/tpch/q18.plan | 4 ++-- modules/calcite/src/test/resources/tpch/q19.plan | 2 +- modules/calcite/src/test/resources/tpch/q20.plan | 2 +- modules/calcite/src/test/resources/tpch/q22.plan | 2 +- modules/calcite/src/test/resources/tpch/q3.plan | 2 +- modules/calcite/src/test/resources/tpch/q7.plan | 2 +- modules/calcite/src/test/resources/tpch/q9.plan | 2 +- modules/calcite/src/test/resources/tpch/variant_q12.plan | 2 +- modules/calcite/src/test/resources/tpch/variant_q8.plan | 2 +- 12 files changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index d65cb6a81feff..e187a030a59e1 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -61,6 +61,7 @@ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { private static final boolean UPDATE_PLAN = false; private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); + private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); private static IgniteEx srv; @@ -210,6 +211,7 @@ private static List scriptToQueries(String sqlScript) { private static String preparePlan(String expectedPlan) { expectedPlan = ID_PATTERN.matcher(expectedPlan).replaceAll(", id = {id}"); + expectedPlan = HASH_PATTERN.matcher(expectedPlan).replaceAll(", hash={hash}"); return expectedPlan; } diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 804da9c9f7154..6ce8f1656092c 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -3,7 +3,7 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 1684f34854229..446e32d8529b5 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -9,7 +9,7 @@ IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index d939224acd488..efa3f06c2dbb0 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -10,9 +10,9 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = {id} IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 07acfd1b1626f..e0e3edfb09d06 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -2,6 +2,6 @@ IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cum IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = {id} IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 311dd28fbc098..de8a3cae632e9 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -5,7 +5,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = {id} IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index f1a5e5608bb1e..1799e867f1217 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -13,4 +13,4 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1) IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 517db9e97b899..4f486ea86b78e 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,5 +1,5 @@ IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = {id} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = {id} IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = {id} IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 58ac15461a0b5..91bf7308c50a6 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -7,7 +7,7 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index c39ebff93a996..3f13fcf7f2ad0 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -8,7 +8,7 @@ IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 203aea0ee07d5..ddb293b3583f1 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -3,7 +3,7 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index a3d715e231ffb..46a570ec29898 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -13,7 +13,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} From 27aee27381adcb6f0112a207ecc649357cdd308a Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 15:04:46 +0300 Subject: [PATCH 11/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 17 +++++++++-------- modules/calcite/src/test/resources/tpch/q2.sql | 7 ++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index e187a030a59e1..706dac4c1f41b 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Scanner; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -41,7 +42,6 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgnitionEx; -import org.apache.ignite.internal.processors.query.GridQueryProcessor; import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor; import org.apache.ignite.internal.processors.query.calcite.planner.AbstractPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.AfterPlansTest; @@ -89,6 +89,11 @@ public static void startAll(Class testClass) throws Exception { for (TpcTable table : tables) scriptToQueries(table.ddlScript()).forEach(q -> sql(srv, q)); + + List> idxs = sql(srv, "SELECT * FROM SYS.INDEXES"); + for (List idx : idxs) { + System.out.println(idx.stream().map(Objects::toString).collect(Collectors.joining(" "))); + } } @AfterPlansTest @@ -163,15 +168,11 @@ private void updateQueryPlan(String queryId, List newPlans) { private List queryPlan(String sqlScript) { - return scriptToQueries(sqlScript).stream().map(qry -> { - GridQueryProcessor qryProc = srv.context().query(); + CalciteQueryProcessor engine = (CalciteQueryProcessor)srv.context().query().defaultQueryEngine(); - CalciteQueryProcessor engine = (CalciteQueryProcessor)qryProc.defaultQueryEngine(); - - Map schemas = GridTestUtils.getFieldValue(engine.schemaHolder(), "igniteSchemas"); - - assertNotNull(schemas); + Map schemas = GridTestUtils.getFieldValue(engine.schemaHolder(), "igniteSchemas"); + return scriptToQueries(sqlScript).stream().map(qry -> { try { return RelOptUtil.toString(physicalPlan(plannerCtx(sqlScript, schemas.values(), null)), SqlExplainLevel.ALL_ATTRIBUTES); } diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index b82bd046aa864..f2a06060f0341 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -1,5 +1,6 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- TODO: WHY NO_INDEX hint doesn't guarantee that index will not be used. SELECT s_acctbal, @@ -13,11 +14,11 @@ SELECT FROM part, supplier, - partsupp, + partsupp /*+ NO_INDEX(_key_PK) */ ps1, nation, region WHERE - p_partkey = ps_partkey + p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 15 AND p_type LIKE '%BRASS' @@ -27,7 +28,7 @@ WHERE AND ps_supplycost = ( SELECT min(ps_supplycost) FROM - partsupp, supplier, + partsupp /*+ NO_INDEX(_key_PK) */ ps2, supplier, nation, region WHERE p_partkey = ps_partkey From 5f99d843b10165f969646f2cc21186b149f2e20e Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 18:28:18 +0300 Subject: [PATCH 12/39] WIP. Fix plans for tpch --- .../calcite/rule/logical/ExposeIndexRule.java | 14 +++++++++----- modules/calcite/src/test/resources/tpch/q18.plan | 4 ++-- modules/calcite/src/test/resources/tpch/q2.sql | 4 ++-- modules/calcite/src/test/resources/tpch/q20.plan | 2 +- modules/calcite/src/test/resources/tpch/q20.sql | 2 +- modules/calcite/src/test/resources/tpch/q22.plan | 2 +- modules/calcite/src/test/resources/tpch/q22.sql | 2 +- modules/calcite/src/test/resources/tpch/q7.plan | 2 +- modules/calcite/src/test/resources/tpch/q7.sql | 2 +- modules/calcite/src/test/resources/tpch/q9.plan | 2 +- .../src/test/resources/tpch/variant_q8.plan | 2 +- 11 files changed, 21 insertions(+), 17 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java index 4b9144db13a50..58395591413c5 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -37,7 +38,6 @@ import org.apache.calcite.util.ImmutableBitSet; import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition; import org.apache.ignite.internal.processors.query.calcite.hint.HintUtils; -import org.apache.ignite.internal.processors.query.calcite.rel.AbstractIndexScan; import org.apache.ignite.internal.processors.query.calcite.rel.logical.IgniteLogicalIndexScan; import org.apache.ignite.internal.processors.query.calcite.rel.logical.IgniteLogicalTableScan; import org.apache.ignite.internal.processors.query.calcite.schema.IgniteTable; @@ -116,7 +116,7 @@ private IgniteBiTuple, Boolean> processHints( ) { assert !F.isEmpty(indexes); - Set tblIdxNames = indexes.stream().map(AbstractIndexScan::indexName).collect(Collectors.toSet()); + Set tblIdxNames = indexes.stream().map(idxScan -> idxScan.indexName().toUpperCase(Locale.ROOT)).collect(Collectors.toSet()); Set idxToSkip = new HashSet<>(); Set idxToUse = new HashSet<>(); @@ -144,9 +144,13 @@ private IgniteBiTuple, Boolean> processHints( } } - return new IgniteBiTuple<>(indexes.stream().filter(idx -> !idxToSkip.contains(idx.indexName()) - && (idxToUse.isEmpty() || idxToUse.contains(idx.indexName()))).collect(Collectors.toList()), - !idxToUse.isEmpty()); + List idxs = indexes.stream().filter(idx -> { + String idxUpperName = idx.indexName().toUpperCase(Locale.ROOT); + + return !idxToSkip.contains(idxUpperName) && (idxToUse.isEmpty() || idxToUse.contains(idxUpperName)); + }).collect(Collectors.toList()); + + return new IgniteBiTuple<>(idxs, !idxToUse.isEmpty()); } /** */ diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index efa3f06c2dbb0..09c8f7d20c28c 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -10,9 +10,9 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = {id} IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index f2a06060f0341..0f0ad7e69df11 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -14,7 +14,7 @@ SELECT FROM part, supplier, - partsupp /*+ NO_INDEX(_key_PK) */ ps1, + partsupp /*+ NO_INDEX(_key_PK) */, nation, region WHERE @@ -28,7 +28,7 @@ WHERE AND ps_supplycost = ( SELECT min(ps_supplycost) FROM - partsupp /*+ NO_INDEX(_key_PK) */ ps2, supplier, + partsupp /*+ NO_INDEX(_key_PK) */, supplier, nation, region WHERE p_partkey = ps_partkey diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index de8a3cae632e9..311dd28fbc098 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -5,7 +5,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = {id} IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql index 41ce83f04d8db..9b5593e96e8e9 100644 --- a/modules/calcite/src/test/resources/tpch/q20.sql +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -5,7 +5,7 @@ SELECT s_name, s_address FROM - supplier, nation + supplier /*+ NO_INDEX(S_NK_proxy) */, nation WHERE s_suppkey IN ( SELECT ps_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 1799e867f1217..207e1c6aff466 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -13,4 +13,4 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1) IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.sql b/modules/calcite/src/test/resources/tpch/q22.sql index d24b936bd4218..78e38252b1e7a 100644 --- a/modules/calcite/src/test/resources/tpch/q22.sql +++ b/modules/calcite/src/test/resources/tpch/q22.sql @@ -26,7 +26,7 @@ FROM ( AND NOT exists( SELECT * FROM - orders + orders /*+ NO_INDEX(O_CK_proxy) */ WHERE o_custkey = c_custkey ) diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 91bf7308c50a6..58ac15461a0b5 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -7,7 +7,7 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.sql b/modules/calcite/src/test/resources/tpch/q7.sql index a98318a1f3654..760445800874d 100644 --- a/modules/calcite/src/test/resources/tpch/q7.sql +++ b/modules/calcite/src/test/resources/tpch/q7.sql @@ -13,7 +13,7 @@ FROM ( extract(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM - supplier, + supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, orders, customer, diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index 3f13fcf7f2ad0..c39ebff93a996 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -8,7 +8,7 @@ IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 46a570ec29898..a3d715e231ffb 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -13,7 +13,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} From 0526a2ca44fe6840f36e8054007375657a6d48f4 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 18:33:56 +0300 Subject: [PATCH 13/39] WIP. Fix plans for tpch --- modules/calcite/src/test/resources/tpch/q22.plan | 2 +- modules/calcite/src/test/resources/tpch/q8.plan | 2 +- modules/calcite/src/test/resources/tpch/q8.sql | 2 +- modules/calcite/src/test/resources/tpch/q9.sql | 2 +- modules/calcite/src/test/resources/tpch/variant_q8.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 207e1c6aff466..1799e867f1217 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -13,4 +13,4 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1) IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index 46a570ec29898..a3d715e231ffb 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -13,7 +13,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql index 617d098c1ab1b..fa84b45ad2274 100644 --- a/modules/calcite/src/test/resources/tpch/q8.sql +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -15,7 +15,7 @@ FROM ( n2.n_name AS nation FROM part, - supplier, + supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, orders, customer, diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql index 0fdc07f1bf437..2acdaa3ec2f61 100644 --- a/modules/calcite/src/test/resources/tpch/q9.sql +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -14,7 +14,7 @@ FROM ( part, supplier, lineitem, - partsupp, + partsupp /*+ NO_INDEX(_key_PK) */, orders, nation WHERE diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.sql b/modules/calcite/src/test/resources/tpch/variant_q8.sql index a93f0b73d095a..71f3b43b5671e 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q8.sql @@ -13,7 +13,7 @@ FROM ( n2.n_name AS nation FROM part, - supplier, + supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, orders, customer, From e0e37b38c000a8be7fb4bab9f899601d8508f055 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Wed, 22 Apr 2026 19:25:59 +0300 Subject: [PATCH 14/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 2 +- .../calcite/src/test/resources/tpch/q10.plan | 38 ++++++----- .../calcite/src/test/resources/tpch/q10.sql | 6 +- .../calcite/src/test/resources/tpch/q11.plan | 29 +++++---- .../calcite/src/test/resources/tpch/q11.sql | 4 +- .../calcite/src/test/resources/tpch/q12.plan | 2 +- .../calcite/src/test/resources/tpch/q12.sql | 2 +- .../calcite/src/test/resources/tpch/q13.plan | 2 +- .../calcite/src/test/resources/tpch/q13.sql | 2 +- .../calcite/src/test/resources/tpch/q14.plan | 14 ++-- .../calcite/src/test/resources/tpch/q14.sql | 2 +- .../calcite/src/test/resources/tpch/q15.plan | 9 +-- .../calcite/src/test/resources/tpch/q15.sql | 2 +- .../calcite/src/test/resources/tpch/q16.plan | 18 ++--- .../calcite/src/test/resources/tpch/q16.sql | 4 +- .../calcite/src/test/resources/tpch/q18.plan | 6 +- .../calcite/src/test/resources/tpch/q18.sql | 4 +- .../calcite/src/test/resources/tpch/q19.plan | 14 ++-- .../calcite/src/test/resources/tpch/q19.sql | 2 +- .../calcite/src/test/resources/tpch/q2.plan | 65 ++++++++++--------- .../calcite/src/test/resources/tpch/q2.sql | 10 +-- .../calcite/src/test/resources/tpch/q20.plan | 19 +++--- .../calcite/src/test/resources/tpch/q20.sql | 2 +- .../calcite/src/test/resources/tpch/q21.plan | 43 ++++++------ .../calcite/src/test/resources/tpch/q21.sql | 6 +- .../calcite/src/test/resources/tpch/q3.plan | 25 +++---- .../calcite/src/test/resources/tpch/q3.sql | 2 +- .../calcite/src/test/resources/tpch/q5.plan | 39 +++++------ .../calcite/src/test/resources/tpch/q5.sql | 8 +-- .../calcite/src/test/resources/tpch/q7.plan | 43 ++++++------ .../calcite/src/test/resources/tpch/q7.sql | 8 +-- .../calcite/src/test/resources/tpch/q8.plan | 50 +++++++------- .../calcite/src/test/resources/tpch/q8.sql | 10 +-- .../calcite/src/test/resources/tpch/q9.plan | 25 +++---- .../calcite/src/test/resources/tpch/q9.sql | 4 +- .../src/test/resources/tpch/variant_q12.plan | 2 +- .../src/test/resources/tpch/variant_q12.sql | 2 +- .../src/test/resources/tpch/variant_q14.plan | 14 ++-- .../src/test/resources/tpch/variant_q14.sql | 2 +- .../src/test/resources/tpch/variant_q8.plan | 50 +++++++------- .../src/test/resources/tpch/variant_q8.sql | 10 +-- 41 files changed, 310 insertions(+), 291 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 706dac4c1f41b..67621c525f59e 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -58,7 +58,7 @@ * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { - private static final boolean UPDATE_PLAN = false; + private static final boolean UPDATE_PLAN = true; private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index 17f840d626701..f823aa85dbb37 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,18 +1,22 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = {id} - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = {id} - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = {id} - IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = {id} - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.84, cpu=26.8075, memory=79.29468750000001, io=2.1725, network=26.552500000000002], id = {id} + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last], fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.84, cpu=25.8075, memory=79.29468750000001, io=2.1725, network=26.552500000000002], id = {id} + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.84, cpu=21.8075, memory=47.2946875, io=2.1725, network=26.552500000000002], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.84, cpu=20.8075, memory=47.2946875, io=2.1725, network=26.552500000000002], id = {id} + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.84, cpu=19.8075, memory=14.5525, io=2.1725, network=26.552500000000002], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.84, cpu=18.8075, memory=14.5525, io=2.1725, network=26.552500000000002], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.84, cpu=12.807500000000001, memory=13.5525, io=1.1724999999999999, network=13.5525], id = {id} + IgniteFilter(condition=[=($cor3.L_ORDERKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-10-01, upperBound=1994-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=30.35, io=1.15, network=30.35], id = {id} + IgniteFilter(condition=[=($0, $cor4.O_CUSTKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor5.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q10.sql b/modules/calcite/src/test/resources/tpch/q10.sql index 0ba0bb540a131..9b452fc561f3e 100644 --- a/modules/calcite/src/test/resources/tpch/q10.sql +++ b/modules/calcite/src/test/resources/tpch/q10.sql @@ -11,10 +11,10 @@ SELECT c_phone, c_comment FROM - customer, - orders, + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, + orders /*+ NO_INDEX(_key_PK_proxy) */, lineitem, - nation + nation /*+ NO_INDEX(_key_PK_proxy) */ WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index 9d48f6718569f..d46ce7deb8479 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,24 +1,25 @@ -IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = {id} - IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = {id} - IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = {id} - IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = {id} - IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = {id} +IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=55.5, io=6.0, network=58.0], id = {id} + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=55.5, io=6.0, network=58.0], id = {id} + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=31.5, io=3.0, network=31.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=23.5, io=3.0, network=31.0], id = {id} + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=19.0, io=3.0, network=31.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=19.0, io=3.0, network=31.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = {id} - IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = {id} - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = {id} + IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=25.0, memory=20.0, io=3.0, network=27.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=20.0, io=3.0, network=27.0], id = {id} + IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=23.0, memory=15.0, io=3.0, network=27.0], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=22.0, memory=15.0, io=3.0, network=27.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=14.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q11.sql b/modules/calcite/src/test/resources/tpch/q11.sql index d304415b2734b..1e6fb7db151ae 100644 --- a/modules/calcite/src/test/resources/tpch/q11.sql +++ b/modules/calcite/src/test/resources/tpch/q11.sql @@ -6,7 +6,7 @@ SELECT sum(ps_supplycost * ps_availqty) AS val FROM partsupp, - supplier, + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, nation WHERE ps_suppkey = s_suppkey @@ -19,7 +19,7 @@ HAVING SELECT sum(ps_supplycost * ps_availqty) * 0.0001 FROM partsupp, - supplier, + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, nation WHERE ps_suppkey = s_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 6ce8f1656092c..df8380d1bdb66 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -6,4 +6,4 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q12.sql b/modules/calcite/src/test/resources/tpch/q12.sql index 31a40ce58908d..49aba52031a78 100644 --- a/modules/calcite/src/test/resources/tpch/q12.sql +++ b/modules/calcite/src/test/resources/tpch/q12.sql @@ -16,7 +16,7 @@ SELECT ELSE 0 END) AS low_line_count FROM - orders, + orders /*+ NO_INDEX(_key_PK_proxy) */, lineitem WHERE o_orderkey = l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index fa37789dd1311..b3eeb5d1afd05 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -7,4 +7,4 @@ IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK], requiredColumns=[{2}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q13.sql b/modules/calcite/src/test/resources/tpch/q13.sql index c3ab108c66d4d..e5bdf82ece1af 100644 --- a/modules/calcite/src/test/resources/tpch/q13.sql +++ b/modules/calcite/src/test/resources/tpch/q13.sql @@ -9,7 +9,7 @@ FROM ( c_custkey, count(o_orderkey) FROM - customer + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */ LEFT OUTER JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE '%special%requests%' diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index 84dfd83b0d452..d921f8bc37044 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = {id} - IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = {id} - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = {id} +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=11.0, memory=20.0, io=2.0, network=22.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=10.0, memory=20.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[CASE(LIKE($4, _UTF-8'PROMO%'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=10.0, io=2.0, network=22.0], id = {id} + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=10.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-09-01, upperBound=1995-10-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q14.sql b/modules/calcite/src/test/resources/tpch/q14.sql index 4971ae7c7df02..cf674f395d3a3 100644 --- a/modules/calcite/src/test/resources/tpch/q14.sql +++ b/modules/calcite/src/test/resources/tpch/q14.sql @@ -8,7 +8,7 @@ SELECT 100.00 * sum(CASE END) / sum(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem, - part + part /*+ NO_INDEX(_key_PK_proxy) */ WHERE l_partkey = p_partkey AND l_shipdate >= DATE '1995-09-01' diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 26e30d9a6c566..91f67306d8686 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,7 +1,8 @@ -IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = {id} - IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=32.0, memory=41.5, io=3.0, network=35.0], id = {id} + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=31.0, memory=41.5, io=3.0, network=35.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=17.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = {id} IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = {id} IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q15.sql b/modules/calcite/src/test/resources/tpch/q15.sql index 0bc233adf7b4d..af7594df8bac2 100644 --- a/modules/calcite/src/test/resources/tpch/q15.sql +++ b/modules/calcite/src/test/resources/tpch/q15.sql @@ -20,7 +20,7 @@ SELECT s_phone, total_revenue FROM - supplier, + supplier /*+ NO_INDEX(_key_PK_proxy) */, revenue WHERE s_suppkey = supplier_no diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 446e32d8529b5..01104dc85d0ad 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,20 +1,20 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = {id} - IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = {id} - IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = {id} - IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = {id} - IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=35.6, memory=62.0, io=4.0, network=52.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=31.6, memory=46.0, io=4.0, network=52.0], id = {id} + IgniteProject(P_BRAND=[$3], P_TYPE=[$4], P_SIZE=[$5], PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.15, cpu=30.6, memory=30.5, io=4.0, network=52.0], id = {id} + IgniteFilter(condition=[OR(=($6, 0), AND(IS NULL($9), >=($7, $6)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.15, cpu=29.6, memory=30.5, io=4.0, network=52.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $8)], joinType=[left], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=16.0, cpu=25.0, memory=30.5, io=4.0, network=52.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = {id} IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = {id} IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = {id} IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], i=[LITERAL_AGG(true)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q16.sql b/modules/calcite/src/test/resources/tpch/q16.sql index 9598a8c683cc6..fccf8160c0b95 100644 --- a/modules/calcite/src/test/resources/tpch/q16.sql +++ b/modules/calcite/src/test/resources/tpch/q16.sql @@ -8,7 +8,7 @@ SELECT count(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, - part + part /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = ps_partkey AND p_brand <> 'Brand#45' @@ -17,7 +17,7 @@ WHERE AND ps_suppkey NOT IN ( SELECT s_suppkey FROM - supplier + supplier /*+ NO_INDEX(_key_PK_proxy) */ WHERE s_comment LIKE '%Customer%Complaints%' ) diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 09c8f7d20c28c..e24dfc02044f6 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -4,15 +4,15 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = {id} IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q18.sql b/modules/calcite/src/test/resources/tpch/q18.sql index 5b0d0d4f44561..290884298126a 100644 --- a/modules/calcite/src/test/resources/tpch/q18.sql +++ b/modules/calcite/src/test/resources/tpch/q18.sql @@ -9,8 +9,8 @@ SELECT o_totalprice, sum(l_quantity) FROM - customer, - orders, + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, + orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_CK_proxy) */, lineitem WHERE o_orderkey IN ( diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index e0e3edfb09d06..9dbd0df80cb73 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -1,7 +1,7 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = {id} - IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=10.0, memory=7.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=18.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.sql b/modules/calcite/src/test/resources/tpch/q19.sql index 5945c5f7cd7e7..00acdaf019bca 100644 --- a/modules/calcite/src/test/resources/tpch/q19.sql +++ b/modules/calcite/src/test/resources/tpch/q19.sql @@ -4,7 +4,7 @@ SELECT sum(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem, - part + part /*+ NO_INDEX(_key_PK_proxy) */ WHERE ( p_partkey = l_partkey diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index 0e4690f713270..f0d7e4d8a182a 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,40 +1,41 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = {id} - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = {id} - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} - IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = {id} - IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = {id} - IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6425, cpu=38.0225, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.6425, cpu=37.0225, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.6425, cpu=33.0225, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.6425, cpu=32.0225, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.6425, cpu=28.0225, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} + IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.907499999999999, cpu=14.942499999999999, memory=18.845, io=2.1950000000000003, network=26.755], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9075, cpu=13.942499999999999, memory=18.845, io=2.1950000000000003, network=26.755], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=17.845, io=1.195, network=17.755], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=32.3, io=1.3, network=31.7], id = {id} + IgniteFilter(condition=[=($0, $cor8.PS_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor9.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=22.0, io=2.0, network=18.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=22.0, io=2.0, network=18.0], id = {id} + IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.735, cpu=9.08, memory=19.755, io=1.195, network=14.665], id = {id} + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.735, cpu=8.08, memory=14.754999999999999, io=1.195, network=14.665], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.735, cpu=7.08, memory=14.754999999999999, io=1.195, network=14.665], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9, cpu=7.2, memory=11.7, io=1.3, network=11.1], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index 0f0ad7e69df11..7c4f48ca401de 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -12,11 +12,11 @@ SELECT s_phone, s_comment FROM - part, - supplier, + part /*+ NO_INDEX(_key_PK_proxy) */, + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, partsupp /*+ NO_INDEX(_key_PK) */, - nation, - region + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, + region /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey @@ -29,7 +29,7 @@ WHERE SELECT min(ps_supplycost) FROM partsupp /*+ NO_INDEX(_key_PK) */, supplier, - nation, region + nation, region /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 311dd28fbc098..e6a422c798b75 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -1,12 +1,13 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = {id} - IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = {id} - IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.807500000000001, cpu=20.052500000000002, memory=28.805, io=2.3225, network=24.9925], id = {id} + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.807500000000001, cpu=16.052500000000002, memory=20.805, io=2.3225, network=24.9925], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.807500000000001, cpu=15.0525, memory=20.805, io=2.3225, network=24.9925], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.8075, cpu=9.0525, memory=19.805, io=1.3225, network=19.9925], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($3, $cor4.N_NATIONKEY)], collation=[[3 ASC-nulls-first]], searchBounds=[[null, null, null, ExactBounds [bound=$cor4.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = {id} IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = {id} IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql index 9b5593e96e8e9..ba8bd4dad4594 100644 --- a/modules/calcite/src/test/resources/tpch/q20.sql +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -5,7 +5,7 @@ SELECT s_name, s_address FROM - supplier /*+ NO_INDEX(S_NK_proxy) */, nation + supplier /*+ NO_INDEX(S_NK_proxy) */, nation /*+ NO_INDEX(_key_PK_proxy) */ WHERE s_suppkey IN ( SELECT ps_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index 28214d9012f7e..6b60f53774fe2 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -1,24 +1,25 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = {id} - IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = {id} - IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = {id} - IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = {id} - IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = {id} - IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = {id} - IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.05, cpu=49.95, memory=51.8, io=4.3, network=34.7], id = {id} + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.05, cpu=48.95, memory=51.8, io=4.3, network=34.7], id = {id} + IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.05, cpu=44.95, memory=43.8, io=4.3, network=34.7], id = {id} + IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.05, cpu=43.95, memory=39.3, io=4.3, network=34.7], id = {id} + IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.05, cpu=42.95, memory=39.3, io=4.3, network=34.7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.05, cpu=38.95, memory=39.3, io=4.3, network=34.7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.05, cpu=26.95, memory=26.3, io=3.3, network=25.7], id = {id} + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=18.95, memory=13.3, io=2.3, network=16.7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=17.95, memory=13.3, io=2.3, network=16.7], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=11.95, memory=12.3, io=1.3, network=11.7], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.O_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($0, $cor9.L_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=22.0, io=2.0, network=18.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=22.0, io=2.0, network=18.0], id = {id} + IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = {id} IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q21.sql b/modules/calcite/src/test/resources/tpch/q21.sql index 0373124f1a6e6..b9594e6a747c2 100644 --- a/modules/calcite/src/test/resources/tpch/q21.sql +++ b/modules/calcite/src/test/resources/tpch/q21.sql @@ -5,10 +5,10 @@ SELECT s_name, count(*) AS numwait FROM - supplier, + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, lineitem l1, - orders, - nation + orders /*+ NO_INDEX(_key_PK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ WHERE s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 4f486ea86b78e..72eb071d24780 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,14 +1,15 @@ -IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = {id} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} - IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = {id} - IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = {id} - IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = {id} - IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=27.0, memory=53.875, io=3.0, network=35.0], id = {id} + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=26.0, memory=53.875, io=3.0, network=35.0], id = {id} + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=22.0, memory=37.875, io=3.0, network=35.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=21.0, memory=37.875, io=3.0, network=35.0], id = {id} + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=3.0, network=35.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=23.0, io=3.0, network=35.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-03-15, upperBound=null, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=13.0, memory=22.0, io=2.0, network=22.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor4.L_ORDERKEY, $0), =($cor6.C_CUSTKEY, $1))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], ExactBounds [bound=$cor6.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q3.sql b/modules/calcite/src/test/resources/tpch/q3.sql index 8a6eab5ce987f..8c46a010d1f57 100644 --- a/modules/calcite/src/test/resources/tpch/q3.sql +++ b/modules/calcite/src/test/resources/tpch/q3.sql @@ -8,7 +8,7 @@ SELECT o_shippriority FROM customer, - orders, + orders /*+ NO_INDEX(_key_PK_proxy) */, lineitem WHERE c_mktsegment = 'BUILDING' diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index 1c109ad9fae6d..a8b588f70de9e 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -1,26 +1,27 @@ -IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = {id} - IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = {id} - IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = {id} +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.907499999999999, cpu=30.9425, memory=41.345, io=3.1950000000000003, network=36.754999999999995], id = {id} + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.907499999999999, cpu=26.9425, memory=33.345, io=3.1950000000000003, network=36.754999999999995], id = {id} + IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.907499999999999, cpu=25.9425, memory=28.845, io=3.1950000000000003, network=36.754999999999995], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.907499999999999, cpu=24.9425, memory=28.845, io=3.1950000000000003, network=36.754999999999995], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.907499999999999, cpu=18.9425, memory=27.845, io=2.1950000000000003, network=27.755], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.907499999999999, cpu=14.942499999999999, memory=27.845, io=2.1950000000000003, network=27.755], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=18.845, io=1.195, network=18.755], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=12.3, io=1.3, network=11.7], id = {id} + IgniteFilter(condition=[=($cor7.L_SUPPKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor8.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=22.0, io=2.0, network=18.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=22.0, io=2.0, network=18.0], id = {id} + IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q5.sql b/modules/calcite/src/test/resources/tpch/q5.sql index 2a07e3a5de52b..a6c6ffdad8018 100644 --- a/modules/calcite/src/test/resources/tpch/q5.sql +++ b/modules/calcite/src/test/resources/tpch/q5.sql @@ -5,12 +5,12 @@ SELECT n_name, sum(l_extendedprice * (1 - l_discount)) AS revenue FROM - customer, + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, orders, lineitem, - supplier, - nation, - region + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, + region /*+ NO_INDEX(_key_PK_proxy) */ WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 58ac15461a0b5..79a470db2b75e 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,25 +1,28 @@ -IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = {id} - IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} - IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} - IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = {id} +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.8814, cpu=19.78816875, memory=44.26243125, io=2.17638125, network=21.38743125], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.8814, cpu=15.78816875, memory=28.26243125, io=2.17638125, network=21.38743125], id = {id} + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.8814, cpu=14.78816875, memory=13.38743125, io=2.17638125, network=21.38743125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($3, $0), OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))))], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.8814, cpu=13.78816875, memory=13.38743125, io=2.17638125, network=21.38743125], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[OR(=($t1, _UTF-8'FRANCE'), =($t1, _UTF-8'GERMANY'))], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.8814, cpu=7.78816875, memory=12.38743125, io=1.17638125, network=12.38743125], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor17.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor17.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor31]], variablesSet=[[31]], correlationVariables=[[$cor31]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.876, cpu=11.921125, memory=22.582875, io=1.175875, network=22.582875], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor21.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor21.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor32]], variablesSet=[[32]], correlationVariables=[[$cor32]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.84, cpu=12.807500000000001, memory=10.5525, io=1.1724999999999999, network=10.5525], id = {id} + IgniteFilter(condition=[=($0, $cor31.L_ORDERKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor33]], variablesSet=[[33]], correlationVariables=[[$cor33]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteFilter(condition=[=($0, $cor32.O_CUSTKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[AND(SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(AND(=($cor17.N_NAME, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), AND(=($cor17.N_NAME, _UTF-8'GERMANY'), =($1, _UTF-8'FRANCE'))), =($cor33.C_NATIONKEY, $0))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.sql b/modules/calcite/src/test/resources/tpch/q7.sql index 760445800874d..f79fade72f78f 100644 --- a/modules/calcite/src/test/resources/tpch/q7.sql +++ b/modules/calcite/src/test/resources/tpch/q7.sql @@ -15,10 +15,10 @@ FROM ( FROM supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, - orders, - customer, - nation n1, - nation n2 + orders /*+ NO_INDEX(_key_PK_proxy) */, + customer /*+ NO_INDEX(_key_PK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy) */ n1, + nation /*+ NO_INDEX(_key_PK_proxy) */ n2 WHERE s_suppkey = l_suppkey AND o_orderkey = l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index a3d715e231ffb..62a1cdeb700c1 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -1,35 +1,37 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.73291875, cpu=31.19120625, memory=44.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.73291875, cpu=27.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.73291875, cpu=26.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.73291875, cpu=25.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.73291875, cpu=24.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.73291875, cpu=18.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.73291875, cpu=14.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.73291875, cpu=7.1912062500000005, memory=12.481987499999999, io=1.1768874999999999, network=12.4799625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.886125, cpu=7.941375, memory=23.21325, io=1.17925, network=23.19975], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.9075, cpu=12.942499999999999, memory=14.754999999999999, io=1.195, network=14.665], id = {id} + IgniteFilter(condition=[=($cor17.L_ORDERKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} + IgniteFilter(condition=[=($cor18.O_CUSTKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor19.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql index fa84b45ad2274..769d2fe1760ae 100644 --- a/modules/calcite/src/test/resources/tpch/q8.sql +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -17,11 +17,11 @@ FROM ( part, supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, - orders, - customer, - nation n1, - nation n2, - region + orders /*+ NO_INDEX(_key_PK_proxy) */, + customer /*+ NO_INDEX(_key_PK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy) */ n1, + nation /*+ NO_INDEX(_key_PK_proxy) */ n2, + region /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = l_partkey AND s_suppkey = l_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index c39ebff93a996..a9ad300b70e21 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,26 +1,27 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} - IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.015525, cpu=36.023793749999996, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.015525, cpu=32.023793749999996, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.015525, cpu=31.02379375, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.015525, cpu=30.02379375, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.015525, cpu=24.02379375, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.015525, cpu=20.02379375, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.015525, cpu=13.02379375, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.015525, cpu=6.02379375, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=7.05, memory=10.35, io=1.15, network=10.35], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor11.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql index 2acdaa3ec2f61..b5bdf38b1d556 100644 --- a/modules/calcite/src/test/resources/tpch/q9.sql +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -15,8 +15,8 @@ FROM ( supplier, lineitem, partsupp /*+ NO_INDEX(_key_PK) */, - orders, - nation + orders /*+ NO_INDEX(_key_PK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy) */ WHERE s_suppkey = l_suppkey AND ps_suppkey = l_suppkey diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index ddb293b3583f1..76ef8172a3886 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -6,4 +6,4 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.sql b/modules/calcite/src/test/resources/tpch/variant_q12.sql index 02bd28364b5be..84a85e52889db 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q12.sql @@ -10,7 +10,7 @@ SELECT sum(decode(o_orderpriority, '1-URGENT', 0, '2-HIGH', 0, 1)) as low_line_count FROM - orders, + orders /*+ NO_INDEX(_key_PK_proxy) */, lineitem WHERE o_orderkey = l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index bf12d9ee2755f..42cd11180cfea 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = {id} - IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = {id} - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = {id} +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=11.0, memory=20.0, io=2.0, network=22.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=10.0, memory=20.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[CASE(=(SUBSTRING($4, 1, 5), _UTF-8'PROMO'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=10.0, io=2.0, network=22.0], id = {id} + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=10.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-09-01, upperBound=1995-10-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.sql b/modules/calcite/src/test/resources/tpch/variant_q14.sql index 4738c3b13b9d3..03945c6e69604 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q14.sql @@ -9,7 +9,7 @@ SELECT sum(l_extendedprice * (1-l_discount)) as promo_revenue FROM lineitem, - part + part /*+ NO_INDEX(_key_PK_proxy) */ WHERE l_partkey = p_partkey AND l_shipdate >= DATE '1995-09-01' diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index a3d715e231ffb..62a1cdeb700c1 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -1,35 +1,37 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.73291875, cpu=31.19120625, memory=44.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.73291875, cpu=27.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.73291875, cpu=26.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.73291875, cpu=25.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.73291875, cpu=24.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.73291875, cpu=18.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.73291875, cpu=14.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.73291875, cpu=7.1912062500000005, memory=12.481987499999999, io=1.1768874999999999, network=12.4799625], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.886125, cpu=7.941375, memory=23.21325, io=1.17925, network=23.19975], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.9075, cpu=12.942499999999999, memory=14.754999999999999, io=1.195, network=14.665], id = {id} + IgniteFilter(condition=[=($cor17.L_ORDERKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} + IgniteFilter(condition=[=($cor18.O_CUSTKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor19.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.sql b/modules/calcite/src/test/resources/tpch/variant_q8.sql index 71f3b43b5671e..320cc6ef5ac5b 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q8.sql @@ -15,11 +15,11 @@ FROM ( part, supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, - orders, - customer, - nation n1, - nation n2, - region + orders /*+ NO_INDEX(_key_PK_proxy) */, + customer /*+ NO_INDEX(_key_PK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy) */ n1, + nation /*+ NO_INDEX(_key_PK_proxy) */ n2, + region /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = l_partkey AND s_suppkey = l_suppkey From 99b8e56f3c5372b9ea826e72278741d47e31efdb Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 10:21:30 +0300 Subject: [PATCH 15/39] WIP. Fix plans for tpch --- .../calcite/src/test/resources/tpch/q2.plan | 36 ++++++++++--------- .../calcite/src/test/resources/tpch/q2.sql | 8 +++-- .../calcite/src/test/resources/tpch/q3.plan | 4 +-- .../calcite/src/test/resources/tpch/q3.sql | 2 +- .../calcite/src/test/resources/tpch/q7.plan | 4 +-- .../calcite/src/test/resources/tpch/q7.sql | 4 +-- .../calcite/src/test/resources/tpch/q8.plan | 4 +-- .../calcite/src/test/resources/tpch/q8.sql | 4 +-- .../calcite/src/test/resources/tpch/q9.plan | 27 +++++++------- .../calcite/src/test/resources/tpch/q9.sql | 6 ++-- .../src/test/resources/tpch/variant_q8.plan | 4 +-- .../src/test/resources/tpch/variant_q8.sql | 6 ++-- 12 files changed, 57 insertions(+), 52 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index f0d7e4d8a182a..d3c4f064465ee 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,8 +1,8 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6425, cpu=38.0225, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.6425, cpu=37.0225, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.6425, cpu=33.0225, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.6425, cpu=32.0225, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.6425, cpu=28.0225, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.814999999999998, cpu=38.885, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.814999999999998, cpu=37.885, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.814999999999998, cpu=33.885, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.814999999999998, cpu=32.885, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.814999999999998, cpu=28.884999999999998, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.907499999999999, cpu=14.942499999999999, memory=18.845, io=2.1950000000000003, network=26.755], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9075, cpu=13.942499999999999, memory=18.845, io=2.1950000000000003, network=26.755], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} @@ -23,19 +23,21 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.735, cpu=9.08, memory=19.755, io=1.195, network=14.665], id = {id} - IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.735, cpu=8.08, memory=14.754999999999999, io=1.195, network=14.665], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.735, cpu=7.08, memory=14.754999999999999, io=1.195, network=14.665], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9075, cpu=9.942499999999999, memory=19.755, io=1.195, network=14.665], id = {id} + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.9075, cpu=8.942499999999999, memory=14.754999999999999, io=1.195, network=14.665], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=14.754999999999999, io=1.195, network=14.665], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9, cpu=7.2, memory=11.7, io=1.3, network=11.1], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} + IgniteFilter(condition=[=($0, $cor14.PS_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor15.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index 7c4f48ca401de..ce2e0f4bfd91e 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -14,7 +14,7 @@ SELECT FROM part /*+ NO_INDEX(_key_PK_proxy) */, supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, - partsupp /*+ NO_INDEX(_key_PK) */, + partsupp, nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, region /*+ NO_INDEX(_key_PK_proxy) */ WHERE @@ -28,8 +28,10 @@ WHERE AND ps_supplycost = ( SELECT min(ps_supplycost) FROM - partsupp /*+ NO_INDEX(_key_PK) */, supplier, - nation, region /*+ NO_INDEX(_key_PK_proxy) */ + partsupp, + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, + region /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 72eb071d24780..074c6eac97f17 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -10,6 +10,6 @@ IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount= IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor4.L_ORDERKEY, $0), =($cor6.C_CUSTKEY, $1))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], ExactBounds [bound=$cor6.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor4.L_ORDERKEY, $0), =($cor6.C_CUSTKEY, $1))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q3.sql b/modules/calcite/src/test/resources/tpch/q3.sql index 8c46a010d1f57..5176e99d0beb2 100644 --- a/modules/calcite/src/test/resources/tpch/q3.sql +++ b/modules/calcite/src/test/resources/tpch/q3.sql @@ -8,7 +8,7 @@ SELECT o_shippriority FROM customer, - orders /*+ NO_INDEX(_key_PK_proxy) */, + orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_CK_proxy) */, lineitem WHERE c_mktsegment = 'BUILDING' diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 79a470db2b75e..ad9cbbc5ef07d 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -16,12 +16,12 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC IgniteFilter(condition=[=($0, $cor31.L_ORDERKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor33]], variablesSet=[[33]], correlationVariables=[[$cor33]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=10.35, io=1.15, network=10.35], id = {id} IgniteFilter(condition=[=($0, $cor32.O_CUSTKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteFilter(condition=[AND(SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(AND(=($cor17.N_NAME, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), AND(=($cor17.N_NAME, _UTF-8'GERMANY'), =($1, _UTF-8'FRANCE'))), =($cor33.C_NATIONKEY, $0))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.sql b/modules/calcite/src/test/resources/tpch/q7.sql index f79fade72f78f..c8b8fe2bf2833 100644 --- a/modules/calcite/src/test/resources/tpch/q7.sql +++ b/modules/calcite/src/test/resources/tpch/q7.sql @@ -15,8 +15,8 @@ FROM ( FROM supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, - orders /*+ NO_INDEX(_key_PK_proxy) */, - customer /*+ NO_INDEX(_key_PK_proxy) */, + orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_CK_proxy) */, + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, nation /*+ NO_INDEX(_key_PK_proxy) */ n1, nation /*+ NO_INDEX(_key_PK_proxy) */ n2 WHERE diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index 62a1cdeb700c1..866b8219b5a8f 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -27,11 +27,11 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteFilter(condition=[=($cor18.O_CUSTKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteFilter(condition=[=($cor19.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql index 769d2fe1760ae..538f570ff3f17 100644 --- a/modules/calcite/src/test/resources/tpch/q8.sql +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -18,8 +18,8 @@ FROM ( supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, orders /*+ NO_INDEX(_key_PK_proxy) */, - customer /*+ NO_INDEX(_key_PK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy) */ n1, + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ n1, nation /*+ NO_INDEX(_key_PK_proxy) */ n2, region /*+ NO_INDEX(_key_PK_proxy) */ WHERE diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index a9ad300b70e21..c33358a92167d 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,26 +1,27 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.015525, cpu=36.023793749999996, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.015525, cpu=32.023793749999996, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} - IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.015525, cpu=31.02379375, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.015525, cpu=30.02379375, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.018900000000002, cpu=36.04066875, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.018900000000002, cpu=32.04066875, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.018900000000002, cpu=31.040668750000002, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.018900000000002, cpu=30.040668750000002, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.015525, cpu=24.02379375, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.015525, cpu=20.02379375, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0189, cpu=24.040668750000002, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0189, cpu=20.040668750000002, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.015525, cpu=13.02379375, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0189, cpu=13.04066875, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.015525, cpu=6.02379375, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0189, cpu=6.04066875, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=7.05, memory=10.35, io=1.15, network=10.35], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteFilter(condition=[=($0, $cor10.L_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteFilter(condition=[=($cor11.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql index b5bdf38b1d556..f02e3f044f074 100644 --- a/modules/calcite/src/test/resources/tpch/q9.sql +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -12,10 +12,10 @@ FROM ( l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, - supplier, + supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, lineitem, - partsupp /*+ NO_INDEX(_key_PK) */, - orders /*+ NO_INDEX(_key_PK_proxy) */, + partsupp, + orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_OD_proxy) */, nation /*+ NO_INDEX(_key_PK_proxy) */ WHERE s_suppkey = l_suppkey diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 62a1cdeb700c1..866b8219b5a8f 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -27,11 +27,11 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteFilter(condition=[=($cor18.O_CUSTKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteFilter(condition=[=($cor19.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.sql b/modules/calcite/src/test/resources/tpch/variant_q8.sql index 320cc6ef5ac5b..8a9fa926b3b41 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q8.sql @@ -16,9 +16,9 @@ FROM ( supplier /*+ NO_INDEX(S_NK_proxy) */, lineitem, orders /*+ NO_INDEX(_key_PK_proxy) */, - customer /*+ NO_INDEX(_key_PK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy) */ n1, - nation /*+ NO_INDEX(_key_PK_proxy) */ n2, + customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ n1, + nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ n2, region /*+ NO_INDEX(_key_PK_proxy) */ WHERE p_partkey = l_partkey From 4f2b0ca51a2436b020a9cf1575417260c5c4b952 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 12:25:05 +0300 Subject: [PATCH 16/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 70 +++++++++++++++---- .../calcite/src/test/resources/tpch/q10.plan | 40 +++++------ .../calcite/src/test/resources/tpch/q10.sql | 6 +- .../calcite/src/test/resources/tpch/q11.sql | 4 +- .../calcite/src/test/resources/tpch/q12.sql | 2 +- .../calcite/src/test/resources/tpch/q13.sql | 2 +- .../calcite/src/test/resources/tpch/q14.sql | 2 +- .../calcite/src/test/resources/tpch/q15.sql | 2 +- .../calcite/src/test/resources/tpch/q16.sql | 4 +- .../calcite/src/test/resources/tpch/q18.sql | 4 +- .../calcite/src/test/resources/tpch/q19.plan | 2 +- .../calcite/src/test/resources/tpch/q19.sql | 2 +- .../calcite/src/test/resources/tpch/q2.plan | 4 +- .../calcite/src/test/resources/tpch/q2.sql | 15 ++-- .../calcite/src/test/resources/tpch/q20.sql | 2 +- .../calcite/src/test/resources/tpch/q21.sql | 6 +- .../calcite/src/test/resources/tpch/q22.sql | 2 +- .../calcite/src/test/resources/tpch/q3.sql | 2 +- .../calcite/src/test/resources/tpch/q5.sql | 8 +-- .../calcite/src/test/resources/tpch/q7.sql | 10 +-- .../calcite/src/test/resources/tpch/q8.sql | 12 ++-- .../calcite/src/test/resources/tpch/q9.plan | 2 +- .../calcite/src/test/resources/tpch/q9.sql | 6 +- .../src/test/resources/tpch/variant_q12.sql | 2 +- .../src/test/resources/tpch/variant_q14.sql | 2 +- .../src/test/resources/tpch/variant_q8.sql | 12 ++-- 26 files changed, 130 insertions(+), 95 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 67621c525f59e..540c616507dbe 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -27,9 +27,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Scanner; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -58,7 +58,7 @@ * Abstract test class to ensure a planner generates optimal plan for TPC queries. */ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { - private static final boolean UPDATE_PLAN = true; + private static final boolean UPDATE_PLAN = false; private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); @@ -81,7 +81,7 @@ public static void startAll(Class testClass) throws Exception { srv = (IgniteEx)IgnitionEx.start(cfg); - srv.createCache(new CacheConfiguration<>("mock") + srv.getOrCreateCache(new CacheConfiguration<>("mock") .setSqlFunctionClasses(AbstractTpcQueryPlannerTest.TpchUDF.class) .setSqlSchema("PUBLIC")); @@ -89,11 +89,6 @@ public static void startAll(Class testClass) throws Exception { for (TpcTable table : tables) scriptToQueries(table.ddlScript()).forEach(q -> sql(srv, q)); - - List> idxs = sql(srv, "SELECT * FROM SYS.INDEXES"); - for (List idx : idxs) { - System.out.println(idx.stream().map(Objects::toString).collect(Collectors.joining(" "))); - } } @AfterPlansTest @@ -122,8 +117,29 @@ public void testQuery() { int pos = 0; - for (String actualPlan : actualPlans) - assertEquals(preparePlan(expectedPlans[pos++]), actualPlan); + for (String actualPlan : actualPlans) { + List preparedPlans = preparePlan(actualPlan); + + assertEquals(1, preparedPlans.size()); + + boolean match = false; + + for (String possiblePlan : preparePlan(expectedPlans[pos++])) { + if (possiblePlan.equals(preparedPlans.get(0))) { + match = true; + + break; + } + } + + if (!match) { + // This assertion will print nice diff in IDE that will help to investigate. + // Test will fail anyway. + assertEquals(expectedPlans[pos-1], preparedPlans.get(0)); + + assert false : "Should not happen"; + } + } } static String loadFromResource(String resource) { @@ -179,7 +195,7 @@ private List queryPlan(String sqlScript) { catch (Exception e) { throw new RuntimeException(e); } - }).map(AbstractTpcQueryPlannerTest::preparePlan).collect(Collectors.toList()); + }).collect(Collectors.toList()); } private static List scriptToQueries(String sqlScript) { @@ -210,10 +226,34 @@ private static List scriptToQueries(String sqlScript) { return queries; } - private static String preparePlan(String expectedPlan) { - expectedPlan = ID_PATTERN.matcher(expectedPlan).replaceAll(", id = {id}"); - expectedPlan = HASH_PATTERN.matcher(expectedPlan).replaceAll(", hash={hash}"); - return expectedPlan; + private static List preparePlan(String plan) { + plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); + plan = HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); + + List res = new ArrayList<>(); + + res.add(plan); + + while (true) { + String idxCaseStart = "{INDEX_CASE:"; + + if (res.get(0).contains(idxCaseStart)) { + res = res.stream().flatMap(p -> { + int start = p.indexOf(idxCaseStart); + int end = p.indexOf('}', start); + + assert start != -1 && end != -1; + + String[] idxs = p.substring(start + idxCaseStart.length(), end).split(","); + + return Arrays.stream(idxs).map(idx -> p.substring(0, start) + idx + p.substring(end + 1)); + }).collect(Collectors.toList()); + } + else + break; + } + + return res; } /** {@inheritDoc} */ diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index f823aa85dbb37..720aa897f1e6c 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,22 +1,18 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.84, cpu=26.8075, memory=79.29468750000001, io=2.1725, network=26.552500000000002], id = {id} - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last], fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.84, cpu=25.8075, memory=79.29468750000001, io=2.1725, network=26.552500000000002], id = {id} - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.84, cpu=21.8075, memory=47.2946875, io=2.1725, network=26.552500000000002], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.84, cpu=20.8075, memory=47.2946875, io=2.1725, network=26.552500000000002], id = {id} - IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.84, cpu=19.8075, memory=14.5525, io=2.1725, network=26.552500000000002], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.84, cpu=18.8075, memory=14.5525, io=2.1725, network=26.552500000000002], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.84, cpu=12.807500000000001, memory=13.5525, io=1.1724999999999999, network=13.5525], id = {id} - IgniteFilter(condition=[=($cor3.L_ORDERKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-10-01, upperBound=1994-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=30.35, io=1.15, network=30.35], id = {id} - IgniteFilter(condition=[=($0, $cor4.O_CUSTKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=29.0, io=1.0, network=29.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=29.0, io=1.0, network=29.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor5.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25514 + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25513 + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25512 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25511 + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25510 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25509 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25501 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 256 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25508 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25502 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 315 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25507 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25504 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25503 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 371 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25506 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25505 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 392 diff --git a/modules/calcite/src/test/resources/tpch/q10.sql b/modules/calcite/src/test/resources/tpch/q10.sql index 9b452fc561f3e..0ba0bb540a131 100644 --- a/modules/calcite/src/test/resources/tpch/q10.sql +++ b/modules/calcite/src/test/resources/tpch/q10.sql @@ -11,10 +11,10 @@ SELECT c_phone, c_comment FROM - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, - orders /*+ NO_INDEX(_key_PK_proxy) */, + customer, + orders, lineitem, - nation /*+ NO_INDEX(_key_PK_proxy) */ + nation WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q11.sql b/modules/calcite/src/test/resources/tpch/q11.sql index 1e6fb7db151ae..d304415b2734b 100644 --- a/modules/calcite/src/test/resources/tpch/q11.sql +++ b/modules/calcite/src/test/resources/tpch/q11.sql @@ -6,7 +6,7 @@ SELECT sum(ps_supplycost * ps_availqty) AS val FROM partsupp, - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + supplier, nation WHERE ps_suppkey = s_suppkey @@ -19,7 +19,7 @@ HAVING SELECT sum(ps_supplycost * ps_availqty) * 0.0001 FROM partsupp, - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + supplier, nation WHERE ps_suppkey = s_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q12.sql b/modules/calcite/src/test/resources/tpch/q12.sql index 49aba52031a78..31a40ce58908d 100644 --- a/modules/calcite/src/test/resources/tpch/q12.sql +++ b/modules/calcite/src/test/resources/tpch/q12.sql @@ -16,7 +16,7 @@ SELECT ELSE 0 END) AS low_line_count FROM - orders /*+ NO_INDEX(_key_PK_proxy) */, + orders, lineitem WHERE o_orderkey = l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q13.sql b/modules/calcite/src/test/resources/tpch/q13.sql index e5bdf82ece1af..c3ab108c66d4d 100644 --- a/modules/calcite/src/test/resources/tpch/q13.sql +++ b/modules/calcite/src/test/resources/tpch/q13.sql @@ -9,7 +9,7 @@ FROM ( c_custkey, count(o_orderkey) FROM - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */ + customer LEFT OUTER JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE '%special%requests%' diff --git a/modules/calcite/src/test/resources/tpch/q14.sql b/modules/calcite/src/test/resources/tpch/q14.sql index cf674f395d3a3..4971ae7c7df02 100644 --- a/modules/calcite/src/test/resources/tpch/q14.sql +++ b/modules/calcite/src/test/resources/tpch/q14.sql @@ -8,7 +8,7 @@ SELECT 100.00 * sum(CASE END) / sum(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem, - part /*+ NO_INDEX(_key_PK_proxy) */ + part WHERE l_partkey = p_partkey AND l_shipdate >= DATE '1995-09-01' diff --git a/modules/calcite/src/test/resources/tpch/q15.sql b/modules/calcite/src/test/resources/tpch/q15.sql index af7594df8bac2..0bc233adf7b4d 100644 --- a/modules/calcite/src/test/resources/tpch/q15.sql +++ b/modules/calcite/src/test/resources/tpch/q15.sql @@ -20,7 +20,7 @@ SELECT s_phone, total_revenue FROM - supplier /*+ NO_INDEX(_key_PK_proxy) */, + supplier, revenue WHERE s_suppkey = supplier_no diff --git a/modules/calcite/src/test/resources/tpch/q16.sql b/modules/calcite/src/test/resources/tpch/q16.sql index fccf8160c0b95..9598a8c683cc6 100644 --- a/modules/calcite/src/test/resources/tpch/q16.sql +++ b/modules/calcite/src/test/resources/tpch/q16.sql @@ -8,7 +8,7 @@ SELECT count(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp, - part /*+ NO_INDEX(_key_PK_proxy) */ + part WHERE p_partkey = ps_partkey AND p_brand <> 'Brand#45' @@ -17,7 +17,7 @@ WHERE AND ps_suppkey NOT IN ( SELECT s_suppkey FROM - supplier /*+ NO_INDEX(_key_PK_proxy) */ + supplier WHERE s_comment LIKE '%Customer%Complaints%' ) diff --git a/modules/calcite/src/test/resources/tpch/q18.sql b/modules/calcite/src/test/resources/tpch/q18.sql index 290884298126a..5b0d0d4f44561 100644 --- a/modules/calcite/src/test/resources/tpch/q18.sql +++ b/modules/calcite/src/test/resources/tpch/q18.sql @@ -9,8 +9,8 @@ SELECT o_totalprice, sum(l_quantity) FROM - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, - orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_CK_proxy) */, + customer, + orders, lineitem WHERE o_orderkey IN ( diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 9dbd0df80cb73..63b80f4747165 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -3,5 +3,5 @@ IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cum IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=18.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=18.0], id = {id} IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.sql b/modules/calcite/src/test/resources/tpch/q19.sql index 00acdaf019bca..5945c5f7cd7e7 100644 --- a/modules/calcite/src/test/resources/tpch/q19.sql +++ b/modules/calcite/src/test/resources/tpch/q19.sql @@ -4,7 +4,7 @@ SELECT sum(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem, - part /*+ NO_INDEX(_key_PK_proxy) */ + part WHERE ( p_partkey = l_partkey diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index d3c4f064465ee..d8d504257bf5c 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -10,7 +10,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=17.845, io=1.195, network=17.755], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=32.3, io=1.3, network=31.7], id = {id} IgniteFilter(condition=[=($0, $cor8.PS_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=29.0, io=1.0, network=29.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=29.0, io=1.0, network=29.0], id = {id} @@ -28,7 +28,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=14.754999999999999, io=1.195, network=14.665], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} IgniteFilter(condition=[=($0, $cor14.PS_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index ce2e0f4bfd91e..c6981c62636ca 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -1,6 +1,5 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile --- TODO: WHY NO_INDEX hint doesn't guarantee that index will not be used. SELECT s_acctbal, @@ -12,11 +11,11 @@ SELECT s_phone, s_comment FROM - part /*+ NO_INDEX(_key_PK_proxy) */, - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + part, + supplier, partsupp, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, - region /*+ NO_INDEX(_key_PK_proxy) */ + nation, + region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey @@ -29,9 +28,9 @@ WHERE SELECT min(ps_supplycost) FROM partsupp, - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, - region /*+ NO_INDEX(_key_PK_proxy) */ + supplier, + nation, + region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql index ba8bd4dad4594..41ce83f04d8db 100644 --- a/modules/calcite/src/test/resources/tpch/q20.sql +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -5,7 +5,7 @@ SELECT s_name, s_address FROM - supplier /*+ NO_INDEX(S_NK_proxy) */, nation /*+ NO_INDEX(_key_PK_proxy) */ + supplier, nation WHERE s_suppkey IN ( SELECT ps_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q21.sql b/modules/calcite/src/test/resources/tpch/q21.sql index b9594e6a747c2..0373124f1a6e6 100644 --- a/modules/calcite/src/test/resources/tpch/q21.sql +++ b/modules/calcite/src/test/resources/tpch/q21.sql @@ -5,10 +5,10 @@ SELECT s_name, count(*) AS numwait FROM - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + supplier, lineitem l1, - orders /*+ NO_INDEX(_key_PK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ + orders, + nation WHERE s_suppkey = l1.l_suppkey AND o_orderkey = l1.l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q22.sql b/modules/calcite/src/test/resources/tpch/q22.sql index 78e38252b1e7a..d24b936bd4218 100644 --- a/modules/calcite/src/test/resources/tpch/q22.sql +++ b/modules/calcite/src/test/resources/tpch/q22.sql @@ -26,7 +26,7 @@ FROM ( AND NOT exists( SELECT * FROM - orders /*+ NO_INDEX(O_CK_proxy) */ + orders WHERE o_custkey = c_custkey ) diff --git a/modules/calcite/src/test/resources/tpch/q3.sql b/modules/calcite/src/test/resources/tpch/q3.sql index 5176e99d0beb2..8a6eab5ce987f 100644 --- a/modules/calcite/src/test/resources/tpch/q3.sql +++ b/modules/calcite/src/test/resources/tpch/q3.sql @@ -8,7 +8,7 @@ SELECT o_shippriority FROM customer, - orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_CK_proxy) */, + orders, lineitem WHERE c_mktsegment = 'BUILDING' diff --git a/modules/calcite/src/test/resources/tpch/q5.sql b/modules/calcite/src/test/resources/tpch/q5.sql index a6c6ffdad8018..2a07e3a5de52b 100644 --- a/modules/calcite/src/test/resources/tpch/q5.sql +++ b/modules/calcite/src/test/resources/tpch/q5.sql @@ -5,12 +5,12 @@ SELECT n_name, sum(l_extendedprice * (1 - l_discount)) AS revenue FROM - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, + customer, orders, lineitem, - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */, - region /*+ NO_INDEX(_key_PK_proxy) */ + supplier, + nation, + region WHERE c_custkey = o_custkey AND l_orderkey = o_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q7.sql b/modules/calcite/src/test/resources/tpch/q7.sql index c8b8fe2bf2833..a98318a1f3654 100644 --- a/modules/calcite/src/test/resources/tpch/q7.sql +++ b/modules/calcite/src/test/resources/tpch/q7.sql @@ -13,12 +13,12 @@ FROM ( extract(YEAR FROM l_shipdate) AS l_year, l_extendedprice * (1 - l_discount) AS volume FROM - supplier /*+ NO_INDEX(S_NK_proxy) */, + supplier, lineitem, - orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_CK_proxy) */, - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy) */ n1, - nation /*+ NO_INDEX(_key_PK_proxy) */ n2 + orders, + customer, + nation n1, + nation n2 WHERE s_suppkey = l_suppkey AND o_orderkey = l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql index 538f570ff3f17..617d098c1ab1b 100644 --- a/modules/calcite/src/test/resources/tpch/q8.sql +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -15,13 +15,13 @@ FROM ( n2.n_name AS nation FROM part, - supplier /*+ NO_INDEX(S_NK_proxy) */, + supplier, lineitem, - orders /*+ NO_INDEX(_key_PK_proxy) */, - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ n1, - nation /*+ NO_INDEX(_key_PK_proxy) */ n2, - region /*+ NO_INDEX(_key_PK_proxy) */ + orders, + customer, + nation n1, + nation n2, + region WHERE p_partkey = l_partkey AND s_suppkey = l_suppkey diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index c33358a92167d..b0e181e4bdb24 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -8,7 +8,7 @@ IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0189, cpu=20.040668750000002, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_SK_PK,PS_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0189, cpu=13.04066875, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql index f02e3f044f074..0fdc07f1bf437 100644 --- a/modules/calcite/src/test/resources/tpch/q9.sql +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -12,11 +12,11 @@ FROM ( l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount FROM part, - supplier /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(S_NK_proxy) */, + supplier, lineitem, partsupp, - orders /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(O_OD_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy) */ + orders, + nation WHERE s_suppkey = l_suppkey AND ps_suppkey = l_suppkey diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.sql b/modules/calcite/src/test/resources/tpch/variant_q12.sql index 84a85e52889db..02bd28364b5be 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q12.sql @@ -10,7 +10,7 @@ SELECT sum(decode(o_orderpriority, '1-URGENT', 0, '2-HIGH', 0, 1)) as low_line_count FROM - orders /*+ NO_INDEX(_key_PK_proxy) */, + orders, lineitem WHERE o_orderkey = l_orderkey diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.sql b/modules/calcite/src/test/resources/tpch/variant_q14.sql index 03945c6e69604..4738c3b13b9d3 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q14.sql @@ -9,7 +9,7 @@ SELECT sum(l_extendedprice * (1-l_discount)) as promo_revenue FROM lineitem, - part /*+ NO_INDEX(_key_PK_proxy) */ + part WHERE l_partkey = p_partkey AND l_shipdate >= DATE '1995-09-01' diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.sql b/modules/calcite/src/test/resources/tpch/variant_q8.sql index 8a9fa926b3b41..a93f0b73d095a 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.sql +++ b/modules/calcite/src/test/resources/tpch/variant_q8.sql @@ -13,13 +13,13 @@ FROM ( n2.n_name AS nation FROM part, - supplier /*+ NO_INDEX(S_NK_proxy) */, + supplier, lineitem, - orders /*+ NO_INDEX(_key_PK_proxy) */, - customer /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(C_NK_proxy) */, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ n1, - nation /*+ NO_INDEX(_key_PK_proxy), NO_INDEX(N_RK_proxy) */ n2, - region /*+ NO_INDEX(_key_PK_proxy) */ + orders, + customer, + nation n1, + nation n2, + region WHERE p_partkey = l_partkey AND s_suppkey = l_suppkey From 5a4577d4bdfcc67561965330a8e06f3aea9a0e26 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 12:26:15 +0300 Subject: [PATCH 17/39] WIP. Fix plans for tpch --- .../calcite/src/test/resources/tpch/q1.plan | 10 +-- .../calcite/src/test/resources/tpch/q10.plan | 36 ++++---- .../calcite/src/test/resources/tpch/q11.plan | 49 ++++++----- .../calcite/src/test/resources/tpch/q12.plan | 18 ++-- .../calcite/src/test/resources/tpch/q13.plan | 20 ++--- .../calcite/src/test/resources/tpch/q14.plan | 16 ++-- .../calcite/src/test/resources/tpch/q15.plan | 29 ++++--- .../calcite/src/test/resources/tpch/q16.plan | 40 ++++----- .../calcite/src/test/resources/tpch/q17.plan | 32 +++---- .../calcite/src/test/resources/tpch/q18.plan | 40 ++++----- .../calcite/src/test/resources/tpch/q19.plan | 14 ++-- .../calcite/src/test/resources/tpch/q2.plan | 83 +++++++++---------- .../calcite/src/test/resources/tpch/q20.plan | 51 ++++++------ .../calcite/src/test/resources/tpch/q21.plan | 63 +++++++------- .../calcite/src/test/resources/tpch/q22.plan | 32 +++---- .../calcite/src/test/resources/tpch/q3.plan | 29 ++++--- .../calcite/src/test/resources/tpch/q4.plan | 22 ++--- .../calcite/src/test/resources/tpch/q5.plan | 53 ++++++------ .../calcite/src/test/resources/tpch/q6.plan | 6 +- .../calcite/src/test/resources/tpch/q7.plan | 53 ++++++------ .../calcite/src/test/resources/tpch/q8.plan | 72 ++++++++-------- .../calcite/src/test/resources/tpch/q9.plan | 54 ++++++------ .../src/test/resources/tpch/variant_q12.plan | 18 ++-- .../src/test/resources/tpch/variant_q14.plan | 16 ++-- .../src/test/resources/tpch/variant_q8.plan | 72 ++++++++-------- 25 files changed, 455 insertions(+), 473 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan index 7096aeb1e4eb3..4cfcd7a50a43f 100644 --- a/modules/calcite/src/test/resources/tpch/q1.plan +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -1,5 +1,5 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = {id} - IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = 117 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = 116 + IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = 115 + IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = 114 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 75 diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index 720aa897f1e6c..a0ead0b7a3a8e 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,18 +1,18 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25514 - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25513 - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25512 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25511 - IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25510 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25509 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25501 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 256 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25508 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25502 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 315 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25507 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25504 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25503 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 371 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25506 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25505 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 392 +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25643 + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25642 + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25641 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25640 + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25639 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25638 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25630 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25637 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25631 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 425 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25636 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25633 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25632 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25635 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25634 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512 diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index d46ce7deb8479..d916288bb823d 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,25 +1,24 @@ -IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=55.5, io=6.0, network=58.0], id = {id} - IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=55.5, io=6.0, network=58.0], id = {id} - IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=31.5, io=3.0, network=31.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=23.5, io=3.0, network=31.0], id = {id} - IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=19.0, io=3.0, network=31.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=19.0, io=3.0, network=31.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=25.0, memory=20.0, io=3.0, network=27.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=20.0, io=3.0, network=27.0], id = {id} - IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=23.0, memory=15.0, io=3.0, network=27.0], id = {id} - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=22.0, memory=15.0, io=3.0, network=27.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=14.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = 47281 + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = 47280 + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = 47274 + IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = 47273 + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = 47272 + IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = 47271 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 47267 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26026 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47270 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47268 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47269 + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26121 + IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47279 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = 47278 + IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = 47277 + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = 47276 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 47275 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38543 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47270 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47268 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47269 + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26121 diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index df8380d1bdb66..ff8c415072908 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = {id} - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 54777 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 54776 + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 54775 + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 54774 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 54773 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54772 + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54771 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47453 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49224 diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index b3eeb5d1afd05..1ab80203e54e5 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -1,10 +1,10 @@ -IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = {id} - IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = {id} - IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK], requiredColumns=[{2}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = 58969 + IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = 58968 + IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = 58967 + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = 58966 + IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = 58965 + IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 58964 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58962 + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54974 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58963 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54927 diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index d921f8bc37044..5793d394d399a 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=11.0, memory=20.0, io=2.0, network=22.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=10.0, memory=20.0, io=2.0, network=22.0], id = {id} - IgniteProject($f0=[CASE(LIKE($4, _UTF-8'PROMO%'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=10.0, io=2.0, network=22.0], id = {id} - IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=10.0, io=2.0, network=22.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-09-01, upperBound=1995-10-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 62750 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 62749 + IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62748 + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62747 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62745 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59125 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62746 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59106 diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 91f67306d8686..49e9f803248e0 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,15 +1,14 @@ -IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=32.0, memory=41.5, io=3.0, network=35.0], id = {id} - IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=31.0, memory=41.5, io=3.0, network=35.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=17.0, io=1.0, network=17.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=17.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = {id} - IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = {id} - IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332086 + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332085 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332076 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64355 + IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332084 + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332083 + IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332078 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 332077 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 63108 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = 332082 + IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = 332081 + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = 332080 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 332079 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 63103 diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 01104dc85d0ad..8bdf6df51996d 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,20 +1,20 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=35.6, memory=62.0, io=4.0, network=52.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=31.6, memory=46.0, io=4.0, network=52.0], id = {id} - IgniteProject(P_BRAND=[$3], P_TYPE=[$4], P_SIZE=[$5], PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.15, cpu=30.6, memory=30.5, io=4.0, network=52.0], id = {id} - IgniteFilter(condition=[OR(=($6, 0), AND(IS NULL($9), >=($7, $6)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.15, cpu=29.6, memory=30.5, io=4.0, network=52.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $8)], joinType=[left], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=16.0, cpu=25.0, memory=30.5, io=4.0, network=52.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = {id} - IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = {id} - IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], i=[LITERAL_AGG(true)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = 381528 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = 381527 + IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = 381526 + IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = 381525 + IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381524 + IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381514 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381513 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332484 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381523 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381517 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381516 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381515 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332642 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340350 + IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381522 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381521 + IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381520 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = 381519 + IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = 381518 + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340703 diff --git a/modules/calcite/src/test/resources/tpch/q17.plan b/modules/calcite/src/test/resources/tpch/q17.plan index 14f65d5193825..d30501dfe4636 100644 --- a/modules/calcite/src/test/resources/tpch/q17.plan +++ b/modules/calcite/src/test/resources/tpch/q17.plan @@ -1,16 +1,16 @@ -IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = {id} - IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = {id} - IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = {id} - IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = {id} - IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = 384863 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = 384862 + IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = 384861 + IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = 384860 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = 384859 + IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = 384853 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 384851 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 381798 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 384852 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 381776 + IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = 384858 + IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = 384857 + IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 384856 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 384855 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 384854 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 383774 diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index e24dfc02044f6..000bf2e366fc5 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -1,20 +1,20 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = {id} - IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = {id} - IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = {id} - IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = 433330 + IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = 433329 + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = 433328 + IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433327 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433326 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433316 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385150 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433325 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433318 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433324 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 + IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433323 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433322 + IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433321 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 63b80f4747165..820155cba465d 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -1,7 +1,7 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=10.0, memory=7.0, io=2.0, network=22.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=2.0, io=2.0, network=22.0], id = {id} - IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = 436195 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = 436194 + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436193 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436192 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436191 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433461 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433526 diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index d8d504257bf5c..dec6971ad6317 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,43 +1,40 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.814999999999998, cpu=38.885, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.814999999999998, cpu=37.885, memory=70.6, io=3.3900000000000006, network=41.42], id = {id} - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.814999999999998, cpu=33.885, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.814999999999998, cpu=32.885, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.814999999999998, cpu=28.884999999999998, memory=38.599999999999994, io=3.3900000000000006, network=41.42], id = {id} - IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.907499999999999, cpu=14.942499999999999, memory=18.845, io=2.1950000000000003, network=26.755], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9075, cpu=13.942499999999999, memory=18.845, io=2.1950000000000003, network=26.755], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=17.845, io=1.195, network=17.755], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=32.3, io=1.3, network=31.7], id = {id} - IgniteFilter(condition=[=($0, $cor8.PS_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=29.0, io=1.0, network=29.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=29.0, io=1.0, network=29.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor9.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=22.0, io=2.0, network=18.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=22.0, io=2.0, network=18.0], id = {id} - IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9075, cpu=9.942499999999999, memory=19.755, io=1.195, network=14.665], id = {id} - IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.9075, cpu=8.942499999999999, memory=14.754999999999999, io=1.195, network=14.665], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=14.754999999999999, io=1.195, network=14.665], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} - IgniteFilter(condition=[=($0, $cor14.PS_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor15.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511731 + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511730 + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511729 + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511728 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511727 + IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 511715 + IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 511714 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 511703 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436723 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511713 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511712 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511706 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511705 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436799 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 511711 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511708 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511707 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436854 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511710 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511709 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 511726 + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 511725 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511724 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511716 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511723 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511718 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511717 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482091 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 511722 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511720 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511719 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482177 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511721 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511709 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index e6a422c798b75..9971a1fb83a0f 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -1,26 +1,25 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.807500000000001, cpu=20.052500000000002, memory=28.805, io=2.3225, network=24.9925], id = {id} - IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.807500000000001, cpu=16.052500000000002, memory=20.805, io=2.3225, network=24.9925], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.807500000000001, cpu=15.0525, memory=20.805, io=2.3225, network=24.9925], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.8075, cpu=9.0525, memory=19.805, io=1.3225, network=19.9925], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($3, $cor4.N_NATIONKEY)], collation=[[3 ASC-nulls-first]], searchBounds=[[null, null, null, ExactBounds [bound=$cor4.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} - IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = {id} - IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = {id} - IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = {id} - IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = {id} - IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = 524120 + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524119 + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524118 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524101 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512135 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524117 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524102 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524116 + IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524115 + IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524114 + IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = 524113 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = 524112 + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = 524106 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 524103 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512220 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = 524105 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 524104 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512267 + IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = 524111 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = 524110 + IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = 524109 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 524108 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 524107 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512908 diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index 6b60f53774fe2..8a8d80d140f81 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -1,32 +1,31 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.05, cpu=49.95, memory=51.8, io=4.3, network=34.7], id = {id} - IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.05, cpu=48.95, memory=51.8, io=4.3, network=34.7], id = {id} - IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.05, cpu=44.95, memory=43.8, io=4.3, network=34.7], id = {id} - IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.05, cpu=43.95, memory=39.3, io=4.3, network=34.7], id = {id} - IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.05, cpu=42.95, memory=39.3, io=4.3, network=34.7], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.05, cpu=38.95, memory=39.3, io=4.3, network=34.7], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.05, cpu=26.95, memory=26.3, io=3.3, network=25.7], id = {id} - IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=18.95, memory=13.3, io=2.3, network=16.7], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=17.95, memory=13.3, io=2.3, network=16.7], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=11.95, memory=12.3, io=1.3, network=11.7], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.O_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($0, $cor9.L_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=22.0, io=2.0, network=18.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=22.0, io=2.0, network=18.0], id = {id} - IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = {id} - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = {id} - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = 551624 + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = 551623 + IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = 551622 + IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = 551621 + IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = 551620 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = 551619 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = 551615 + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551610 + IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551609 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551601 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524585 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551608 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551602 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551607 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551604 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551603 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524672 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551606 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551605 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524709 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551614 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551613 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551612 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551611 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548371 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551618 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551617 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551616 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551602 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 1799e867f1217..f38bb40cb0b5a 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -1,16 +1,16 @@ -IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = {id} - IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = {id} - IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = {id} - IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = {id} - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = 553106 + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = 553105 + IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = 553104 + IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = 553103 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = 553102 + IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = 553097 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 553094 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 551950 + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 553096 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553095 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 551886 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = 553101 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = 553100 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = 553099 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553098 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552155 diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 074c6eac97f17..6e641652d1aca 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,15 +1,14 @@ -IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=27.0, memory=53.875, io=3.0, network=35.0], id = {id} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=26.0, memory=53.875, io=3.0, network=35.0], id = {id} - IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=22.0, memory=37.875, io=3.0, network=35.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=21.0, memory=37.875, io=3.0, network=35.0], id = {id} - IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=3.0, network=35.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=23.0, io=3.0, network=35.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-03-15, upperBound=null, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=13.0, memory=22.0, io=2.0, network=22.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor4.L_ORDERKEY, $0), =($cor6.C_CUSTKEY, $1))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=17.0, io=1.0, network=17.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888880 + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888879 + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888878 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888877 + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888876 + IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888875 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888870 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553385 + IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888874 + IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888873 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888871 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553444 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888872 + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 558269 diff --git a/modules/calcite/src/test/resources/tpch/q4.plan b/modules/calcite/src/test/resources/tpch/q4.plan index 0db40602d80b7..d165958b7ff90 100644 --- a/modules/calcite/src/test/resources/tpch/q4.plan +++ b/modules/calcite/src/test/resources/tpch/q4.plan @@ -1,11 +1,11 @@ -IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = {id} - IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = {id} - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = 889723 + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = 889722 + IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = 889721 + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = 889720 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 889715 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889033 + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = 889719 + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889718 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889717 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889716 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 889107 diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index a8b588f70de9e..70244ffa50347 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -1,27 +1,26 @@ -IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.907499999999999, cpu=30.9425, memory=41.345, io=3.1950000000000003, network=36.754999999999995], id = {id} - IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.907499999999999, cpu=26.9425, memory=33.345, io=3.1950000000000003, network=36.754999999999995], id = {id} - IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.907499999999999, cpu=25.9425, memory=28.845, io=3.1950000000000003, network=36.754999999999995], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.907499999999999, cpu=24.9425, memory=28.845, io=3.1950000000000003, network=36.754999999999995], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.907499999999999, cpu=18.9425, memory=27.845, io=2.1950000000000003, network=27.755], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.907499999999999, cpu=14.942499999999999, memory=27.845, io=2.1950000000000003, network=27.755], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.9075, cpu=7.9425, memory=18.845, io=1.195, network=18.755], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=12.3, io=1.3, network=11.7], id = {id} - IgniteFilter(condition=[=($cor7.L_SUPPKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor8.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=22.0, io=2.0, network=18.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=22.0, io=2.0, network=18.0], id = {id} - IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = 996455 + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = 996454 + IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996453 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996452 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996436 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890103 + IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = 996451 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = 996450 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 996438 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996437 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890165 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 996449 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 996440 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 996439 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890219 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 996448 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 996442 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996441 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890288 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 996447 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 996444 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 996443 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890336 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 996446 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 996445 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 890355 diff --git a/modules/calcite/src/test/resources/tpch/q6.plan b/modules/calcite/src/test/resources/tpch/q6.plan index 68b06ae548564..2af79c4eeb8bb 100644 --- a/modules/calcite/src/test/resources/tpch/q6.plan +++ b/modules/calcite/src/test/resources/tpch/q6.plan @@ -1,3 +1,3 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 996526 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 996525 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996515 diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index ad9cbbc5ef07d..77433853d2220 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,28 +1,25 @@ -IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.8814, cpu=19.78816875, memory=44.26243125, io=2.17638125, network=21.38743125], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.8814, cpu=15.78816875, memory=28.26243125, io=2.17638125, network=21.38743125], id = {id} - IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.8814, cpu=14.78816875, memory=13.38743125, io=2.17638125, network=21.38743125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($3, $0), OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))))], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.8814, cpu=13.78816875, memory=13.38743125, io=2.17638125, network=21.38743125], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[OR(=($t1, _UTF-8'FRANCE'), =($t1, _UTF-8'GERMANY'))], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.8814, cpu=7.78816875, memory=12.38743125, io=1.17638125, network=12.38743125], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor17.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor17.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor31]], variablesSet=[[31]], correlationVariables=[[$cor31]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.876, cpu=11.921125, memory=22.582875, io=1.175875, network=22.582875], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor21.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor21.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor32]], variablesSet=[[32]], correlationVariables=[[$cor32]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.84, cpu=12.807500000000001, memory=10.5525, io=1.1724999999999999, network=10.5525], id = {id} - IgniteFilter(condition=[=($0, $cor31.L_ORDERKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor33]], variablesSet=[[33]], correlationVariables=[[$cor33]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=10.35, io=1.15, network=10.35], id = {id} - IgniteFilter(condition=[=($0, $cor32.O_CUSTKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[AND(SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(AND(=($cor17.N_NAME, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), AND(=($cor17.N_NAME, _UTF-8'GERMANY'), =($1, _UTF-8'FRANCE'))), =($cor33.C_NATIONKEY, $0))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = 1741922 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1741921 + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1741920 + IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1741919 + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1741918 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741905 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1741917 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741906 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 + IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1741916 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1741908 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1741907 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 997070 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1741915 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741910 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741909 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997116 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1741914 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741912 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741911 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997163 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741913 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741905 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index 866b8219b5a8f..fe4017c2dc922 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -1,37 +1,35 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.73291875, cpu=31.19120625, memory=44.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.73291875, cpu=27.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.73291875, cpu=26.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.73291875, cpu=25.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.73291875, cpu=24.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.73291875, cpu=18.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.73291875, cpu=14.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.73291875, cpu=7.1912062500000005, memory=12.481987499999999, io=1.1768874999999999, network=12.4799625], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.886125, cpu=7.941375, memory=23.21325, io=1.17925, network=23.19975], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.9075, cpu=12.942499999999999, memory=14.754999999999999, io=1.195, network=14.665], id = {id} - IgniteFilter(condition=[=($cor17.L_ORDERKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} - IgniteFilter(condition=[=($cor18.O_CUSTKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor19.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 1941636 + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1941635 + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1941634 + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1941633 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1941632 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 1941610 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742497 + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1941631 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1941630 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1941612 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941611 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742526 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1941629 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941614 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941613 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742560 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1941628 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1941616 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1941615 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742619 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1941627 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1941618 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1941617 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742694 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1941626 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941620 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941619 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742742 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1941625 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941622 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941621 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742790 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1941624 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1941623 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742809 diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index b0e181e4bdb24..8088e34825e4c 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,28 +1,26 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.018900000000002, cpu=36.04066875, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.018900000000002, cpu=32.04066875, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} - IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.018900000000002, cpu=31.040668750000002, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.018900000000002, cpu=30.040668750000002, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0189, cpu=24.040668750000002, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0189, cpu=20.040668750000002, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_SK_PK,PS_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0189, cpu=13.04066875, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0189, cpu=6.04066875, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.6, cpu=12.05, memory=10.35, io=1.15, network=10.35], id = {id} - IgniteFilter(condition=[=($0, $cor10.L_SUPPKEY)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor11.S_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = 2115169 + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = 2115168 + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2115167 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2115166 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2115150 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942025 + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2115165 + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2115164 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2115152 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2115151 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942040 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2115163 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2115154 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115153 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942111 + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2115162 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2115156 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2115155 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942149 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2115161 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2115158 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115157 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942224 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2115160 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115159 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942247 diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 76ef8172a3886..4faf08b7e9ba6 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = {id} - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 2122665 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 2122664 + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 2122663 + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 2122662 + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 2122661 + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2122660 + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2122659 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2115341 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117114 diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index 42cd11180cfea..53fb0de412deb 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=11.0, memory=20.0, io=2.0, network=22.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=10.0, memory=20.0, io=2.0, network=22.0], id = {id} - IgniteProject($f0=[CASE(=(SUBSTRING($4, 1, 5), _UTF-8'PROMO'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=10.0, io=2.0, network=22.0], id = {id} - IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=10.0, io=2.0, network=22.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-09-01, upperBound=1995-10-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 2126446 + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 2126445 + IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2126444 + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2126443 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2126441 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2122821 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2126442 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2122796 diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 866b8219b5a8f..baad4bea45a1b 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -1,37 +1,35 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.73291875, cpu=31.19120625, memory=44.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.73291875, cpu=27.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.73291875, cpu=26.19120625, memory=36.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.73291875, cpu=25.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.73291875, cpu=24.19120625, memory=22.4819875, io=3.1768875, network=26.4799625], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.73291875, cpu=18.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.73291875, cpu=14.19120625, memory=21.4819875, io=2.1768875, network=21.4799625], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.73291875, cpu=7.1912062500000005, memory=12.481987499999999, io=1.1768874999999999, network=12.4799625], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.886125, cpu=7.941375, memory=23.21325, io=1.17925, network=23.19975], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.9075, cpu=12.942499999999999, memory=14.754999999999999, io=1.195, network=14.665], id = {id} - IgniteFilter(condition=[=($cor17.L_ORDERKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.05, cpu=12.95, memory=11.7, io=1.3, network=11.1], id = {id} - IgniteFilter(condition=[=($cor18.O_CUSTKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteFilter(condition=[=($cor19.C_NATIONKEY, $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=18.0, io=2.0, network=14.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 2326160 + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2326159 + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2326158 + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2326157 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2326156 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2326134 + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127021 + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2326155 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2326154 + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2326136 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326135 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127049 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2326153 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326138 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326137 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127084 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2326152 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2326140 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2326139 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127154 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2326151 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2326142 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2326141 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127197 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2326150 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326144 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326143 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127252 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2326149 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326146 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326145 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127314 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2326148 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2326147 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127333 From c3bc7e1519a7d38ce4e7ad2e0b2f76e457006e5d Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 12:27:52 +0300 Subject: [PATCH 18/39] WIP. Fix plans for tpch --- modules/calcite/src/test/resources/tpch/q2.plan | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index dec6971ad6317..d43c693880058 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -6,21 +6,21 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 511715 IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 511714 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 511703 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436723 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436723 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511713 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511712 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511706 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511705 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436799 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436799 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 511711 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511708 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511707 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436854 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436854 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511710 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511709 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 511726 IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 511725 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511724 @@ -30,11 +30,11 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511723 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511718 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511717 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482091 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482091 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 511722 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511720 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511719 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482177 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482177 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511721 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511709 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 From ef8f4f18fc7acac88dcac9759c352f324282e68c Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 12:31:45 +0300 Subject: [PATCH 19/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 6 ++++-- .../calcite/src/test/resources/tpch/q10.plan | 8 ++++---- .../calcite/src/test/resources/tpch/q11.plan | 4 ++-- .../calcite/src/test/resources/tpch/q12.plan | 2 +- .../calcite/src/test/resources/tpch/q13.plan | 2 +- .../calcite/src/test/resources/tpch/q14.plan | 2 +- .../calcite/src/test/resources/tpch/q15.plan | 2 +- .../calcite/src/test/resources/tpch/q16.plan | 4 ++-- .../calcite/src/test/resources/tpch/q18.plan | 6 +++--- .../calcite/src/test/resources/tpch/q19.plan | 2 +- .../calcite/src/test/resources/tpch/q20.plan | 2 +- .../calcite/src/test/resources/tpch/q21.plan | 12 ++++++------ .../calcite/src/test/resources/tpch/q3.plan | 4 ++-- .../calcite/src/test/resources/tpch/q4.plan | 2 +- .../calcite/src/test/resources/tpch/q5.plan | 8 ++++---- .../calcite/src/test/resources/tpch/q7.plan | 18 +++++++++--------- .../calcite/src/test/resources/tpch/q8.plan | 10 +++++----- .../calcite/src/test/resources/tpch/q9.plan | 6 +++--- .../src/test/resources/tpch/variant_q12.plan | 2 +- .../src/test/resources/tpch/variant_q14.plan | 2 +- .../src/test/resources/tpch/variant_q8.plan | 10 +++++----- 21 files changed, 58 insertions(+), 56 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 540c616507dbe..b87c561df7502 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -124,7 +124,9 @@ public void testQuery() { boolean match = false; - for (String possiblePlan : preparePlan(expectedPlans[pos++])) { + List possiblePlans = preparePlan(expectedPlans[pos++]); + + for (String possiblePlan : possiblePlans) { if (possiblePlan.equals(preparedPlans.get(0))) { match = true; @@ -135,7 +137,7 @@ public void testQuery() { if (!match) { // This assertion will print nice diff in IDE that will help to investigate. // Test will fail anyway. - assertEquals(expectedPlans[pos-1], preparedPlans.get(0)); + assertEquals(possiblePlans.get(0), preparedPlans.get(0)); assert false : "Should not happen"; } diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index a0ead0b7a3a8e..ebaf394dcc17e 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -5,14 +5,14 @@ IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount= IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25639 IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25638 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25630 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25637 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25631 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 425 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 425 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25636 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25633 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25632 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25635 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25634 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512 diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index d916288bb823d..3ca41ced5cdad 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -8,7 +8,7 @@ IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = Igni IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26026 IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47270 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47268 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47269 IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26121 IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47279 @@ -19,6 +19,6 @@ IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = Igni IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38543 IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47270 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47268 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47269 IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26121 diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index ff8c415072908..75e02b229ec4e 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -6,4 +6,4 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54772 IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54771 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47453 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49224 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49224 diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index 1ab80203e54e5..be1bae9d7d834 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -7,4 +7,4 @@ IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58962 IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54974 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58963 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54927 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54927 diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index 5793d394d399a..edbdfefaf127d 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -3,6 +3,6 @@ IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1. IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62748 IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62747 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62745 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59125 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59125 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62746 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59106 diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 49e9f803248e0..0ef38f0c2ab01 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,7 +1,7 @@ IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332086 IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332085 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332076 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64355 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64355 IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332084 IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332083 IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332078 diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 8bdf6df51996d..c8d9d5647fa22 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -5,13 +5,13 @@ IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381524 IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381514 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381513 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332484 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332484 IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381523 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381517 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381516 IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381515 IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332642 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340350 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340350 IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381522 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381521 IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381520 diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 000bf2e366fc5..fc208fb126f0f 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -4,11 +4,11 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433327 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433326 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433316 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385150 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385150 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433325 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433318 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433324 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 @@ -17,4 +17,4 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433322 IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433321 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 820155cba465d..bc045cb98fad0 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -4,4 +4,4 @@ IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cum IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436192 IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436191 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433461 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433526 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433526 diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 9971a1fb83a0f..1df6227c34b8d 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -2,7 +2,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524119 IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524118 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524101 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512135 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512135 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524117 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524102 IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index 8a8d80d140f81..fc1b59f4ff649 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -8,24 +8,24 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551610 IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551609 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551601 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524585 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524585 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551608 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551602 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551607 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551604 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551603 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524672 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524672 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551606 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551605 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524709 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524709 IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551614 IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551613 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551612 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551611 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548371 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548371 IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551618 IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551617 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551616 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551602 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 6e641652d1aca..292b158cc4463 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -5,10 +5,10 @@ IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount= IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888876 IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888875 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888870 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553385 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553385 IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888874 IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888873 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888871 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553444 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553444 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888872 IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 558269 diff --git a/modules/calcite/src/test/resources/tpch/q4.plan b/modules/calcite/src/test/resources/tpch/q4.plan index d165958b7ff90..06d73f3af7ef4 100644 --- a/modules/calcite/src/test/resources/tpch/q4.plan +++ b/modules/calcite/src/test/resources/tpch/q4.plan @@ -8,4 +8,4 @@ IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 A IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889718 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889717 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889716 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 889107 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 889107 diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index 70244ffa50347..17b596ff19a59 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -12,15 +12,15 @@ IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 996449 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 996440 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 996439 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890219 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890219 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 996448 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 996442 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996441 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890288 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890288 IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 996447 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 996444 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 996443 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890336 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890336 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 996446 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 996445 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 890355 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 890355 diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 77433853d2220..a542e0d9e9fe1 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,10 +1,10 @@ -IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = 1741922 +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = {id} IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1741921 - IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1741920 - IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1741919 - IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = 1741918 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741905 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} + IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1741917 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741906 IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 @@ -15,11 +15,11 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1741915 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741910 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741909 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997116 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997116 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1741914 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741912 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741911 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997163 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997163 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741913 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741905 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index fe4017c2dc922..d41652810df16 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -9,7 +9,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1941630 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1941612 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941611 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742526 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742526 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1941629 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941614 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941613 @@ -21,15 +21,15 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1941627 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1941618 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1941617 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742694 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742694 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1941626 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941620 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941619 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742742 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742742 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1941625 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941622 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941621 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742790 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742790 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1941624 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1941623 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742809 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742809 diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index 8088e34825e4c..23fa7e6688d2a 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -16,11 +16,11 @@ IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2115162 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2115156 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2115155 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942149 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942149 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2115161 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2115158 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115157 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942224 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942224 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2115160 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115159 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942247 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942247 diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 4faf08b7e9ba6..96ef51f2230c4 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -6,4 +6,4 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2122660 IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2122659 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2115341 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117114 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117114 diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index 53fb0de412deb..20a0a99318474 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -3,6 +3,6 @@ IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1. IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2126444 IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2126443 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2126441 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2122821 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2122821 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2126442 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2122796 diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index baad4bea45a1b..492df334120ee 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -9,7 +9,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2326154 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2326136 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326135 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127049 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127049 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2326153 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326138 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326137 @@ -21,15 +21,15 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2326151 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2326142 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2326141 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127197 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127197 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2326150 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326144 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326143 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127252 + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127252 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2326149 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326146 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326145 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127314 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127314 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2326148 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2326147 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127333 + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127333 From 588bb3941326e49a15e7ddb36ab1c5b25f8222c6 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 12:45:01 +0300 Subject: [PATCH 20/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 24 +++++++++---------- .../calcite/src/test/resources/tpch/q18.plan | 2 +- .../calcite/src/test/resources/tpch/q2.plan | 4 ++-- .../calcite/src/test/resources/tpch/q20.plan | 2 +- .../calcite/src/test/resources/tpch/q22.plan | 2 +- .../calcite/src/test/resources/tpch/q7.plan | 2 +- .../calcite/src/test/resources/tpch/q8.plan | 2 +- .../calcite/src/test/resources/tpch/q9.plan | 2 +- .../src/test/resources/tpch/variant_q8.plan | 2 +- 9 files changed, 20 insertions(+), 22 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index b87c561df7502..60f7ae449c2ff 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -118,16 +118,12 @@ public void testQuery() { int pos = 0; for (String actualPlan : actualPlans) { - List preparedPlans = preparePlan(actualPlan); - - assertEquals(1, preparedPlans.size()); - boolean match = false; - List possiblePlans = preparePlan(expectedPlans[pos++]); + String expectedPlan = replaceIdAndHash(expectedPlans[pos++]); - for (String possiblePlan : possiblePlans) { - if (possiblePlan.equals(preparedPlans.get(0))) { + for (String possiblePlan : expandWithPossibleIndexes(expectedPlan)) { + if (possiblePlan.equals(actualPlan)) { match = true; break; @@ -137,7 +133,7 @@ public void testQuery() { if (!match) { // This assertion will print nice diff in IDE that will help to investigate. // Test will fail anyway. - assertEquals(possiblePlans.get(0), preparedPlans.get(0)); + assertEquals(expectedPlan, actualPlan); assert false : "Should not happen"; } @@ -197,7 +193,7 @@ private List queryPlan(String sqlScript) { catch (Exception e) { throw new RuntimeException(e); } - }).collect(Collectors.toList()); + }).map(AbstractTpcQueryPlannerTest::replaceIdAndHash).collect(Collectors.toList()); } private static List scriptToQueries(String sqlScript) { @@ -228,10 +224,7 @@ private static List scriptToQueries(String sqlScript) { return queries; } - private static List preparePlan(String plan) { - plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); - plan = HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); - + private static List expandWithPossibleIndexes(String plan) { List res = new ArrayList<>(); res.add(plan); @@ -258,6 +251,11 @@ private static List preparePlan(String plan) { return res; } + private static String replaceIdAndHash(String plan) { + plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); + return HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); + } + /** {@inheritDoc} */ @Override protected boolean isSafeTopology() { return false; diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index fc208fb126f0f..abf1e3cba5e63 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -12,7 +12,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433324 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433323 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433322 IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433321 diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index d43c693880058..6019cf4d948b4 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -9,7 +9,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436723 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511713 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511712 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511706 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511705 @@ -26,7 +26,7 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511724 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511716 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511723 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511718 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511717 diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 1df6227c34b8d..3c68e98c37543 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -5,7 +5,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512135 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524117 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524102 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:S_NK,S_NK_proxy}], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524116 IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524115 IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524114 diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index f38bb40cb0b5a..e40b04588de26 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -13,4 +13,4 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1) IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = 553100 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = 553099 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553098 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552155 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552155 diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index a542e0d9e9fe1..6a9b5bcd1cfe4 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -7,7 +7,7 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1741917 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741906 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:S_NK,S_NK_proxy}], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1741916 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1741908 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1741907 diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index d41652810df16..0b28350d2787d 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -13,7 +13,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1941629 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941614 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941613 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742560 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{CASE_INDEX:S_NK,S_NK_proxy}], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742560 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1941628 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1941616 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1941615 diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index 23fa7e6688d2a..4beebbceff25e 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -8,7 +8,7 @@ IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2115164 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2115152 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2115151 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942040 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_SK_PK,PS_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942040 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2115163 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2115154 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115153 diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 492df334120ee..83833111a92f4 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -13,7 +13,7 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2326153 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326138 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326137 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127084 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:S_NK,S_NK_proxy}], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127084 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2326152 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2326140 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2326139 From a3af4adab67f27631ec415399466e9fba2302bf4 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 14:30:08 +0300 Subject: [PATCH 21/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 70 ++++++++++++++++++- .../calcite/src/test/resources/tpch/q18.plan | 16 ++++- .../calcite/src/test/resources/tpch/q19.plan | 4 ++ .../calcite/src/test/resources/tpch/q2.plan | 12 +++- .../calcite/src/test/resources/tpch/q20.plan | 6 +- .../calcite/src/test/resources/tpch/q3.plan | 4 ++ .../calcite/src/test/resources/tpch/q7.plan | 6 +- 7 files changed, 110 insertions(+), 8 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 60f7ae449c2ff..bbf6e0dfb7456 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -28,11 +28,13 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; import com.google.common.io.CharStreams; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.sql.SqlExplainLevel; @@ -122,7 +124,7 @@ public void testQuery() { String expectedPlan = replaceIdAndHash(expectedPlans[pos++]); - for (String possiblePlan : expandWithPossibleIndexes(expectedPlan)) { + for (String possiblePlan : expandTemplates(expectedPlan)) { if (possiblePlan.equals(actualPlan)) { match = true; @@ -224,7 +226,13 @@ private static List scriptToQueries(String sqlScript) { return queries; } - private static List expandWithPossibleIndexes(String plan) { + private static List expandTemplates(String plan) { + return expandOneof(plan).stream() + .flatMap(AbstractTpcQueryPlannerTest::expandIndexCase) + .collect(Collectors.toList()); + } + + private static Stream expandIndexCase(String plan) { List res = new ArrayList<>(); res.add(plan); @@ -248,7 +256,63 @@ private static List expandWithPossibleIndexes(String plan) { break; } - return res; + return res.stream(); + } + + private static List expandOneof(String plan) { + String oneOf = "{ONEOF}"; + + if (!plan.contains(oneOf)) + return Collections.singletonList(plan); + + List res = new ArrayList<>(); + + Scanner sc = new Scanner(plan); + + StringBuffer beforeOneof = new StringBuffer(); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + if (line.trim().startsWith(oneOf)) + break; + + beforeOneof.append(line).append('\n'); + } + + boolean oneOfEnd = false; + + // Expanding first found oneof + while(sc.hasNextLine() && !oneOfEnd) { + StringBuffer oneofCase = new StringBuffer(); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + oneOfEnd = line.trim().equals(oneOf); + + if (line.trim().matches("^=+$") || oneOfEnd) + break; + + oneofCase.append(line).append('\n'); + } + + res.add(new StringBuffer(beforeOneof).append(oneofCase)); + } + + if (!oneOfEnd) + throw new IllegalStateException(oneOf + " not closed"); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + for (StringBuffer expanded : res) { + expanded.append(line).append('\n'); + } + } + + // Recursively expanding next ONEOF. + return res.stream().flatMap(p -> expandOneof(p.toString()).stream()).collect(Collectors.toList()); } private static String replaceIdAndHash(String plan) { diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index abf1e3cba5e63..0677c92f9d0b1 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -10,9 +10,23 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433324 +{ONEOF} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 +====== + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +====== + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +====== + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433323 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433322 IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433321 diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index bc045cb98fad0..2cf3b354047e3 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -3,5 +3,9 @@ IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cum IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436193 IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436192 IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436191 +{ONEOF} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433461 +===== + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433526 diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index 6019cf4d948b4..7620f5538ce09 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -9,7 +9,11 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436723 IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511713 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +===== + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511712 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511706 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511705 @@ -26,7 +30,11 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511724 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511716 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_PK,_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 +====== + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511723 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511718 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511717 diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 3c68e98c37543..38c07ca03afb9 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -5,7 +5,11 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512135 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524117 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524102 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:S_NK,S_NK_proxy}], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 +===== + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524116 IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524115 IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524114 diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 292b158cc4463..713e676b455b9 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,5 +1,9 @@ IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888880 +{ONEOF} IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888879 +===== + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} +{ONEOF} IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888878 IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888877 IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888876 diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 6a9b5bcd1cfe4..393da729b02ca 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -7,7 +7,11 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1741917 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741906 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:S_NK,S_NK_proxy}], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 +===== + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1741916 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1741908 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1741907 From 6784fe0fa1179cbf4a43eaa0a5258738436c9788 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 14:40:29 +0300 Subject: [PATCH 22/39] WIP. Fix plans for tpch --- modules/calcite/src/test/resources/tpch/q22.plan | 6 +++++- modules/calcite/src/test/resources/tpch/q8.plan | 6 +++++- modules/calcite/src/test/resources/tpch/q9.plan | 8 +++++++- modules/calcite/src/test/resources/tpch/variant_q8.plan | 6 +++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index e40b04588de26..a27790e20b7fe 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -13,4 +13,8 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1) IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = 553100 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = 553099 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553098 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552155 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552155 +===== + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index 0b28350d2787d..833e034d24930 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -13,7 +13,11 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1941629 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941614 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941613 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{CASE_INDEX:S_NK,S_NK_proxy}], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742560 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742560 +===== + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1941628 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1941616 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1941615 diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index 4beebbceff25e..c3607f72b24fd 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -8,7 +8,13 @@ IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2115164 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2115152 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2115151 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:PS_SK_PK,PS_PK}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942040 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942040 +===== + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +===== + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2115163 IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2115154 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115153 diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 83833111a92f4..2075d1af36bb3 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -13,7 +13,11 @@ IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2326153 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326138 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326137 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:S_NK,S_NK_proxy}], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127084 +{ONEOF} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127084 +===== + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} +{ONEOF} IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2326152 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2326140 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2326139 From f17b799db6f62eb6d33a167f35b5417966b3d0b8 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 14:50:22 +0300 Subject: [PATCH 23/39] WIP. Fix plans for tpch --- modules/calcite/src/test/resources/tpch/q18.plan | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 0677c92f9d0b1..7c02c29e232ec 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -14,6 +14,10 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 +====== + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ====== IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} @@ -22,10 +26,6 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} -====== - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433323 IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433322 From 95e571488e50ea5159a12bef4f2a7d2ae22cf6a0 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 14:58:44 +0300 Subject: [PATCH 24/39] WIP. Fix plans for tpch --- .../calcite/rule/logical/ExposeIndexRule.java | 14 +++++--------- .../query/calcite/integration/tpch/TpchHelper.java | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java index 58395591413c5..4b9144db13a50 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rule/logical/ExposeIndexRule.java @@ -21,7 +21,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -38,6 +37,7 @@ import org.apache.calcite.util.ImmutableBitSet; import org.apache.ignite.internal.processors.query.calcite.hint.HintDefinition; import org.apache.ignite.internal.processors.query.calcite.hint.HintUtils; +import org.apache.ignite.internal.processors.query.calcite.rel.AbstractIndexScan; import org.apache.ignite.internal.processors.query.calcite.rel.logical.IgniteLogicalIndexScan; import org.apache.ignite.internal.processors.query.calcite.rel.logical.IgniteLogicalTableScan; import org.apache.ignite.internal.processors.query.calcite.schema.IgniteTable; @@ -116,7 +116,7 @@ private IgniteBiTuple, Boolean> processHints( ) { assert !F.isEmpty(indexes); - Set tblIdxNames = indexes.stream().map(idxScan -> idxScan.indexName().toUpperCase(Locale.ROOT)).collect(Collectors.toSet()); + Set tblIdxNames = indexes.stream().map(AbstractIndexScan::indexName).collect(Collectors.toSet()); Set idxToSkip = new HashSet<>(); Set idxToUse = new HashSet<>(); @@ -144,13 +144,9 @@ private IgniteBiTuple, Boolean> processHints( } } - List idxs = indexes.stream().filter(idx -> { - String idxUpperName = idx.indexName().toUpperCase(Locale.ROOT); - - return !idxToSkip.contains(idxUpperName) && (idxToUse.isEmpty() || idxToUse.contains(idxUpperName)); - }).collect(Collectors.toList()); - - return new IgniteBiTuple<>(idxs, !idxToUse.isEmpty()); + return new IgniteBiTuple<>(indexes.stream().filter(idx -> !idxToSkip.contains(idx.indexName()) + && (idxToUse.isEmpty() || idxToUse.contains(idx.indexName()))).collect(Collectors.toList()), + !idxToUse.isEmpty()); } /** */ diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java index 07642349ff899..e381b6d39f24a 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java @@ -450,7 +450,7 @@ private static boolean allServersHaveStatistics(Ignite ignite, String tableName) * @param sql SQL query. * @param params Query parameters. */ - public static List> sql(Ignite ignite, String sql, Object... params) { + private static List> sql(Ignite ignite, String sql, Object... params) { SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(params); try (FieldsQueryCursor> cur = ((IgniteEx)ignite).context().query().querySqlFields(qry, false)) { From 6e97d2253d51405faacfe660a23e2a345b62e140 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 15:35:11 +0300 Subject: [PATCH 25/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 110 +----------------- .../query/calcite/planner/tpc/TpchHelper.java | 106 +++++++++++++++++ .../calcite/src/test/resources/tpch/q1.plan | 10 +- .../calcite/src/test/resources/tpch/q10.plan | 36 +++--- .../calcite/src/test/resources/tpch/q11.plan | 48 ++++---- .../calcite/src/test/resources/tpch/q12.plan | 18 +-- .../calcite/src/test/resources/tpch/q13.plan | 20 ++-- .../calcite/src/test/resources/tpch/q14.plan | 16 +-- .../calcite/src/test/resources/tpch/q15.plan | 28 ++--- .../calcite/src/test/resources/tpch/q16.plan | 40 +++---- .../calcite/src/test/resources/tpch/q17.plan | 32 ++--- .../calcite/src/test/resources/tpch/q18.plan | 40 +++---- .../calcite/src/test/resources/tpch/q19.plan | 14 +-- .../calcite/src/test/resources/tpch/q2.plan | 78 ++++++------- .../calcite/src/test/resources/tpch/q20.plan | 50 ++++---- .../calcite/src/test/resources/tpch/q21.plan | 62 +++++----- .../calcite/src/test/resources/tpch/q22.plan | 32 ++--- .../calcite/src/test/resources/tpch/q3.plan | 28 ++--- .../calcite/src/test/resources/tpch/q4.plan | 22 ++-- .../calcite/src/test/resources/tpch/q5.plan | 52 ++++----- .../calcite/src/test/resources/tpch/q6.plan | 6 +- .../calcite/src/test/resources/tpch/q7.plan | 40 +++---- .../calcite/src/test/resources/tpch/q8.plan | 70 +++++------ .../calcite/src/test/resources/tpch/q9.plan | 52 ++++----- .../src/test/resources/tpch/variant_q12.plan | 18 +-- .../src/test/resources/tpch/variant_q14.plan | 16 +-- .../src/test/resources/tpch/variant_q8.plan | 70 +++++------ 27 files changed, 560 insertions(+), 554 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index bbf6e0dfb7456..df64c0f9e5a32 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -27,14 +27,10 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Scanner; -import java.util.regex.Pattern; import java.util.stream.Collectors; -import java.util.stream.Stream; import com.google.common.io.CharStreams; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.sql.SqlExplainLevel; @@ -57,14 +53,12 @@ import static org.apache.logging.log4j.util.Cast.cast; /** - * Abstract test class to ensure a planner generates optimal plan for TPC queries. + * Abstract test class to ensure a planner generates expected plan for TPC queries. */ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { + /** Set to {@code true} to write plan files, instead of checking. */ private static final boolean UPDATE_PLAN = false; - private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); - private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); - private static IgniteEx srv; @Parameterized.Parameter @@ -122,9 +116,9 @@ public void testQuery() { for (String actualPlan : actualPlans) { boolean match = false; - String expectedPlan = replaceIdAndHash(expectedPlans[pos++]); + String expectedPlan = TpchHelper.replaceIdAndHash(expectedPlans[pos++]); - for (String possiblePlan : expandTemplates(expectedPlan)) { + for (String possiblePlan : TpchHelper.expandTemplates(expectedPlan)) { if (possiblePlan.equals(actualPlan)) { match = true; @@ -195,7 +189,7 @@ private List queryPlan(String sqlScript) { catch (Exception e) { throw new RuntimeException(e); } - }).map(AbstractTpcQueryPlannerTest::replaceIdAndHash).collect(Collectors.toList()); + }).map(TpchHelper::replaceIdAndHash).collect(Collectors.toList()); } private static List scriptToQueries(String sqlScript) { @@ -226,100 +220,6 @@ private static List scriptToQueries(String sqlScript) { return queries; } - private static List expandTemplates(String plan) { - return expandOneof(plan).stream() - .flatMap(AbstractTpcQueryPlannerTest::expandIndexCase) - .collect(Collectors.toList()); - } - - private static Stream expandIndexCase(String plan) { - List res = new ArrayList<>(); - - res.add(plan); - - while (true) { - String idxCaseStart = "{INDEX_CASE:"; - - if (res.get(0).contains(idxCaseStart)) { - res = res.stream().flatMap(p -> { - int start = p.indexOf(idxCaseStart); - int end = p.indexOf('}', start); - - assert start != -1 && end != -1; - - String[] idxs = p.substring(start + idxCaseStart.length(), end).split(","); - - return Arrays.stream(idxs).map(idx -> p.substring(0, start) + idx + p.substring(end + 1)); - }).collect(Collectors.toList()); - } - else - break; - } - - return res.stream(); - } - - private static List expandOneof(String plan) { - String oneOf = "{ONEOF}"; - - if (!plan.contains(oneOf)) - return Collections.singletonList(plan); - - List res = new ArrayList<>(); - - Scanner sc = new Scanner(plan); - - StringBuffer beforeOneof = new StringBuffer(); - - while (sc.hasNextLine()) { - String line = sc.nextLine(); - - if (line.trim().startsWith(oneOf)) - break; - - beforeOneof.append(line).append('\n'); - } - - boolean oneOfEnd = false; - - // Expanding first found oneof - while(sc.hasNextLine() && !oneOfEnd) { - StringBuffer oneofCase = new StringBuffer(); - - while (sc.hasNextLine()) { - String line = sc.nextLine(); - - oneOfEnd = line.trim().equals(oneOf); - - if (line.trim().matches("^=+$") || oneOfEnd) - break; - - oneofCase.append(line).append('\n'); - } - - res.add(new StringBuffer(beforeOneof).append(oneofCase)); - } - - if (!oneOfEnd) - throw new IllegalStateException(oneOf + " not closed"); - - while (sc.hasNextLine()) { - String line = sc.nextLine(); - - for (StringBuffer expanded : res) { - expanded.append(line).append('\n'); - } - } - - // Recursively expanding next ONEOF. - return res.stream().flatMap(p -> expandOneof(p.toString()).stream()).collect(Collectors.toList()); - } - - private static String replaceIdAndHash(String plan) { - plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); - return HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); - } - /** {@inheritDoc} */ @Override protected boolean isSafeTopology() { return false; diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java index 94644fce9ab8d..23a85a9c7a18d 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java @@ -23,7 +23,14 @@ import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Scanner; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; import com.google.common.io.CharStreams; import org.apache.ignite.Ignite; import org.apache.ignite.cache.query.FieldsQueryCursor; @@ -42,6 +49,11 @@ public final class TpchHelper { public static final String DATE = "DATE"; + /** */ + private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); + + private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); + private TpchHelper() { } @@ -106,4 +118,98 @@ public static List> sql(Ignite ignite, String sql, Object... params) { return cur.getAll(); } } + + public static List expandTemplates(String plan) { + return expandOneof(plan).stream() + .flatMap(TpchHelper::expandIndexCase) + .collect(Collectors.toList()); + } + + private static Stream expandIndexCase(String plan) { + List res = new ArrayList<>(); + + res.add(plan); + + while (true) { + String idxCaseStart = "{INDEX_CASE:"; + + if (res.get(0).contains(idxCaseStart)) { + res = res.stream().flatMap(p -> { + int start = p.indexOf(idxCaseStart); + int end = p.indexOf('}', start); + + assert start != -1 && end != -1; + + String[] idxs = p.substring(start + idxCaseStart.length(), end).split(","); + + return Arrays.stream(idxs).map(idx -> p.substring(0, start) + idx + p.substring(end + 1)); + }).collect(Collectors.toList()); + } + else + break; + } + + return res.stream(); + } + + private static List expandOneof(String plan) { + String oneOf = "{ONEOF}"; + + if (!plan.contains(oneOf)) + return Collections.singletonList(plan); + + List res = new ArrayList<>(); + + Scanner sc = new Scanner(plan); + + StringBuffer beforeOneof = new StringBuffer(); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + if (line.trim().startsWith(oneOf)) + break; + + beforeOneof.append(line).append('\n'); + } + + boolean oneOfEnd = false; + + // Expanding first found oneof + while(sc.hasNextLine() && !oneOfEnd) { + StringBuffer oneofCase = new StringBuffer(); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + oneOfEnd = line.trim().equals(oneOf); + + if (line.trim().matches("^=+$") || oneOfEnd) + break; + + oneofCase.append(line).append('\n'); + } + + res.add(new StringBuffer(beforeOneof).append(oneofCase)); + } + + if (!oneOfEnd) + throw new IllegalStateException(oneOf + " not closed"); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + for (StringBuffer expanded : res) { + expanded.append(line).append('\n'); + } + } + + // Recursively expanding next ONEOF. + return res.stream().flatMap(p -> expandOneof(p.toString()).stream()).collect(Collectors.toList()); + } + + public static String replaceIdAndHash(String plan) { + plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); + return HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); + } } diff --git a/modules/calcite/src/test/resources/tpch/q1.plan b/modules/calcite/src/test/resources/tpch/q1.plan index 4cfcd7a50a43f..7096aeb1e4eb3 100644 --- a/modules/calcite/src/test/resources/tpch/q1.plan +++ b/modules/calcite/src/test/resources/tpch/q1.plan @@ -1,5 +1,5 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = 117 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = 116 - IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = 115 - IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = 114 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 75 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(32767, 0) SUM_QTY, DECIMAL(32767, 0) SUM_BASE_PRICE, DECIMAL(32767, 0) SUM_DISC_PRICE, DECIMAL(32767, 0) SUM_CHARGE, DECIMAL(15, 2) AVG_QTY, DECIMAL(15, 2) AVG_PRICE, DECIMAL(15, 2) AVG_DISC, BIGINT COUNT_ORDER)], group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=77.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=77.0, io=1.0, network=13.0], id = {id} + IgniteMapSortAggregate(group=[{0, 1}], SUM_QTY=[SUM($2)], SUM_BASE_PRICE=[SUM($3)], SUM_DISC_PRICE=[SUM($4)], SUM_CHARGE=[SUM($5)], AVG_QTY=[AVG($2)], AVG_PRICE=[AVG($3)], AVG_DISC=[AVG($6)], COUNT_ORDER=[COUNT()], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=77.0, io=1.0, network=1.0], id = {id} + IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=29.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[<=($t6, 1998-09-02)], rowType=[RecordType(VARCHAR L_RETURNFLAG, VARCHAR L_LINESTATUS, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(31, 4) $f4, DECIMAL(47, 6) $f5, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t4, $t5, $t0, $t1, *($t1, -(1, $t2)), *(*($t1, -(1, $t2)), +(1, $t3)), $t2]], requiredColumns=[{6, 7, 8, 9, 10, 11, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1998-09-02, lowerInclude=false, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index ebaf394dcc17e..1786907541975 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,18 +1,18 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = 25643 - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = 25642 - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = 25641 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = 25640 - IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = 25639 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = 25638 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 25630 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 374 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = 25637 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 25631 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 425 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = 25636 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 25633 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 25632 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 25635 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 25634 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512 +IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.45, cpu=38.3, memory=97.0921875, io=3.15, network=52.35], id = {id} + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.45, cpu=37.3, memory=97.0921875, io=3.15, network=52.35], id = {id} + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.45, cpu=33.3, memory=65.0921875, io=3.15, network=52.35], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.45, cpu=32.3, memory=65.0921875, io=3.15, network=52.35], id = {id} + IgniteProject(C_CUSTKEY=[$5], C_NAME=[$6], C_ACCTBAL=[$10], C_PHONE=[$9], N_NAME=[$13], C_ADDRESS=[$7], C_COMMENT=[$11], $f7=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.45, cpu=31.3, memory=32.35, io=3.15, network=52.35], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.45, cpu=30.3, memory=32.35, io=3.15, network=52.35], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.45, cpu=16.3, memory=31.35, io=2.15, network=39.35], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor2]], variablesSet=[[2]], correlationVariables=[[$cor2]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=30.35, io=1.15, network=30.35], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor1.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor1.O_CUSTKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor2.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor2.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index 3ca41ced5cdad..a38dea6787312 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,24 +1,24 @@ -IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = 47281 - IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = 47280 - IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = 47274 - IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = 47273 - IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = 47272 - IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = 47271 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 47267 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26026 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47270 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47268 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47269 - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26121 - IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = 47279 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = 47278 - IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = 47277 - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = 47276 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 47275 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 38543 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 47270 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 47268 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26091 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 47269 - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 26121 +IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = {id} + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = {id} + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = {id} + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = {id} + IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = {id} + IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 75e02b229ec4e..2153b4def0009 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 54777 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 54776 - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 54775 - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 54774 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 54773 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 54772 - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 54771 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 47453 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 49224 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index be1bae9d7d834..4f87e7b626837 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -1,10 +1,10 @@ -IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = 58969 - IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = 58968 - IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = 58967 - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = 58966 - IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = 58965 - IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = 58964 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 58962 - IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54974 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 58963 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 54927 +IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.3, cpu=16.3, memory=23.675, io=2.0, network=14.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.3, cpu=12.3, memory=15.675, io=2.0, network=14.0], id = {id} + IgniteProject(C_COUNT=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.3, cpu=11.3, memory=11.175, io=2.0, network=14.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[COUNT($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.300000000000001, cpu=10.3, memory=11.175, io=2.0, network=14.0], id = {id} + IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=6.15, cpu=9.15, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteNestedLoopJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2}], inlineScan=[true], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index edbdfefaf127d..0a554b92928a1 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 62750 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 62749 - IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 62748 - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 62747 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 62745 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 59125 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 62746 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 59106 +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[CASE(LIKE($1, _UTF-8'PROMO%'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 0ef38f0c2ab01..b2a58b029b105 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,14 +1,14 @@ -IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = 332086 - IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = 332085 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 332076 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 64355 - IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = 332084 - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = 332083 - IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = 332078 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 332077 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 63108 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = 332082 - IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = 332081 - IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = 332080 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 332079 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 63103 +IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=28.0, memory=25.5, io=3.0, network=35.0], id = {id} + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=27.0, memory=25.5, io=3.0, network=35.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=17.0, memory=24.5, io=2.0, network=18.0], id = {id} + IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=24.5, io=2.0, network=18.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MAX($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=10.5, io=1.0, network=9.0], id = {id} + IgniteProject(EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=5.5, io=1.0, network=9.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.5, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1996-01-01), <($t3, 1996-04-01))], rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(31, 4) $f1)], projects=[[$t0, *($t1, -(1, $t2))]], requiredColumns=[{4, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1996-01-01, upperBound=1996-04-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index c8d9d5647fa22..5f74a965c60e5 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,20 +1,20 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = 381528 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = 381527 - IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = 381526 - IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = 381525 - IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = 381524 - IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = 381514 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 381513 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 332484 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = 381523 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = 381517 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = 381516 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 381515 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 332642 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340350 - IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = 381522 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = 381521 - IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = 381520 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = 381519 - IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = 381518 - IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 340703 +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = {id} + IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = {id} + IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = {id} + IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = {id} + IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q17.plan b/modules/calcite/src/test/resources/tpch/q17.plan index d30501dfe4636..14f65d5193825 100644 --- a/modules/calcite/src/test/resources/tpch/q17.plan +++ b/modules/calcite/src/test/resources/tpch/q17.plan @@ -1,16 +1,16 @@ -IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = 384863 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = 384862 - IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = 384861 - IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = 384860 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = 384859 - IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = 384853 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 384851 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 381798 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 384852 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 381776 - IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = 384858 - IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = 384857 - IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 384856 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 384855 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 384854 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 383774 +IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.9, cpu=19.75, memory=13.1, io=2.15, network=19.35], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.9, cpu=18.75, memory=13.1, io=2.15, network=19.35], id = {id} + IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.9, cpu=17.75, memory=8.1, io=2.15, network=19.35], id = {id} + IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.9, cpu=16.75, memory=8.1, io=2.15, network=19.35], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.9, cpu=12.75, memory=8.1, io=2.15, network=19.35], id = {id} + IgniteNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=6.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t1, _UTF-8'Brand#23'), =($t2, _UTF-8'MED BOX'))], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 5, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*(0.2:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=5.0, memory=14.0, io=1.0, network=9.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=14.0, io=1.0, network=9.0], id = {id} + IgniteProject(L_QUANTITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.P_PARTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 7c02c29e232ec..4ef548d8cb848 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -1,19 +1,19 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = 433330 - IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = 433329 - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = 433328 - IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = 433327 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = 433326 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433316 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385150 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = 433325 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 433318 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = 433324 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.1125, cpu=26.09, memory=75.62375, io=3.0225, network=35.2025], id = {id} + IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.1125, cpu=25.09, memory=75.62375, io=3.0225, network=35.2025], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.1125, cpu=21.09, memory=51.62375, io=3.0225, network=35.2025], id = {id} + IgniteProject(C_NAME=[$1], C_CUSTKEY=[$0], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.1125, cpu=20.09, memory=27.405, io=3.0225, network=35.2025], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.1125, cpu=19.09, memory=27.405, io=3.0225, network=35.2025], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.1125, cpu=13.09, memory=26.405, io=2.0225, network=26.2025], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.1125, cpu=6.09, memory=17.405, io=1.0225, network=17.2025], id = {id} {ONEOF} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 433320 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 433319 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385229 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor3.C_CUSTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ====== IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor3.C_CUSTKEY, $1), =($0, $cor5.L_ORDERKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.L_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} @@ -27,8 +27,8 @@ IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:O_CK,O_CK_proxy}], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = 433323 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = 433322 - IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = 433321 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 433317 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 385181 + IgniteProject(L_ORDERKEY=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=18.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(>($1, 300), =($cor6.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=18.0, io=1.0, network=9.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=10.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 2cf3b354047e3..922dbf6acbe1e 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -1,11 +1,11 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = 436195 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = 436194 - IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = 436193 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = 436192 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 436191 +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=7.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 433461 + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 433526 + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))), =($t0, $cor0.L_PARTKEY), OR(AND(=($t1, _UTF-8'Brand#12'), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 11.00)), <=($t2, 5)), AND(=($t1, _UTF-8'Brand#23'), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), AND(>=($cor0.L_QUANTITY, 10.00), <=($cor0.L_QUANTITY, 20.00)), <=($t2, 10)), AND(=($t1, _UTF-8'Brand#34'), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), AND(>=($cor0.L_QUANTITY, 20.00), <=($cor0.L_QUANTITY, 30.00)), <=($t2, 15))), AND(>=($cor0.L_QUANTITY, 1.00), <=($cor0.L_QUANTITY, 30.00)))], requiredColumns=[{2, 5, 7, 8}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index 7620f5538ce09..c584fc03dd254 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,48 +1,48 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511731 - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = 511730 - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511729 - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511728 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = 511727 - IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = 511715 - IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = 511714 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 511703 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436723 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = 511713 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.3935, cpu=51.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = {id} + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24.3935, cpu=50.09025, memory=84.63187500000001, io=4.348375, network=67.63187500000001], id = {id} + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23.3935, cpu=46.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.3935, cpu=45.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.3935, cpu=41.09025, memory=52.631875, io=4.348375, network=67.63187500000001], id = {id} + IgniteProject(P_PARTKEY=[$0], P_MFGR=[$1], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$2], PS_SUPPKEY=[$3], PS_SUPPLYCOST=[$4], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.69, cpu=28.035, memory=33.0625, io=3.1725, network=53.0625], id = {id} + IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.69, cpu=27.035, memory=33.0625, io=3.1725, network=53.0625], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.6899999999999995, cpu=13.035, memory=32.0625, io=2.1725, network=44.0625], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} {ONEOF} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = 511712 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = 511706 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = 511705 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436799 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 511711 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511708 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511707 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436854 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511710 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511709 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = 511726 - IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 511725 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = 511724 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 511716 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 511704 + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[$cor5]], variablesSet=[[5]], correlationVariables=[[$cor5]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=31.0625, io=1.1724999999999999, network=31.0625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor4.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.PS_SUPPKEY], null, null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=29.0, io=1.0, network=29.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=29.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor5.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor5.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.7035, cpu=9.055250000000001, memory=19.569375, io=1.175875, network=14.569375], id = {id} + IgniteProject(PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=8.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[$cor14]], variablesSet=[[14]], correlationVariables=[[$cor14]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 436757 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ====== IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 511723 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511718 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511717 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482091 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 511722 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 511720 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 511719 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 482177 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 511721 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 511709 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 436880 + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor14.PS_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor14.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor15.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor15.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor16.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK_proxy,_key_PK}], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 38c07ca03afb9..c26bff5639b9f 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -1,29 +1,29 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = 524120 - IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = 524119 - IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = 524118 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 524101 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512135 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = 524117 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 524102 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.05, cpu=45.35, memory=28.7, io=4.15, network=41.95], id = {id} + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.05, cpu=41.35, memory=20.7, io=4.15, network=41.95], id = {id} + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.05, cpu=40.35, memory=20.7, io=4.15, network=41.95], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor3]], variablesSet=[[3]], correlationVariables=[[$cor3]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.05, cpu=26.35, memory=19.7, io=3.15, network=36.95], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512169 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = 524116 - IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = 524115 - IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = 524114 - IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = 524113 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = 524112 - IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = 524106 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 524103 - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512220 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = 524105 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 524104 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 512267 - IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = 524111 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = 524110 - IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = 524109 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 524108 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 524107 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 512908 + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor3.S_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor3.S_SUPPKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.05, cpu=20.35, memory=18.7, io=2.15, network=19.95], id = {id} + IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.05, cpu=20.35, memory=14.7, io=2.15, network=19.95], id = {id} + IgniteProject(PS_SUPPKEY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.05, cpu=19.35, memory=10.7, io=2.15, network=19.95], id = {id} + IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.05, cpu=18.35, memory=10.7, io=2.15, network=19.95], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.05, cpu=14.35, memory=10.7, io=2.15, network=19.95], id = {id} + IgniteNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=8.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=3.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=9.0, memory=18.0, io=1.0, network=13.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=18.0, io=1.0, network=13.0], id = {id} + IgniteProject(L_QUANTITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], collation=[[0 ASC-nulls-first, 1 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.PS_PARTKEY], ExactBounds [bound=$cor0.PS_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index fc1b59f4ff649..35c5591cb0978 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -1,31 +1,31 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = 551624 - IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = 551623 - IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = 551622 - IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = 551621 - IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = 551620 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = 551619 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = 551615 - IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = 551610 - IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = 551609 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551601 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524585 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = 551608 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551602 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 551607 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 551604 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 551603 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 524672 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 551606 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 551605 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524709 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = 551614 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 551613 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 551612 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 551611 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 548371 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = 551618 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = 551617 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 551616 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = 551602 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 524617 +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=32.6, cpu=62.9, memory=54.25, io=5.15, network=45.75], id = {id} + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=31.6, cpu=61.9, memory=54.25, io=5.15, network=45.75], id = {id} + IgniteColocatedHashAggregate(group=[{0}], NUMWAIT=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=30.6, cpu=57.9, memory=46.25, io=5.15, network=45.75], id = {id} + IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=29.6, cpu=56.9, memory=41.75, io=5.15, network=45.75], id = {id} + IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=28.6, cpu=55.9, memory=41.75, io=5.15, network=45.75], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=27.6, cpu=51.9, memory=41.75, io=5.15, network=45.75], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.6, cpu=39.9, memory=28.75, io=4.15, network=36.75], id = {id} + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.6, cpu=31.9, memory=15.75, io=3.15, network=27.75], id = {id} + IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.6, cpu=30.9, memory=15.75, io=3.15, network=27.75], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.6, cpu=16.9, memory=14.75, io=2.15, network=22.75], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.L_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.S_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=13.0, io=1.0, network=9.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor4.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=13.0, io=1.0, network=9.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index a27790e20b7fe..2b64be7a62f10 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -1,20 +1,20 @@ -IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = 553106 - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = 553105 - IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = 553104 - IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = 553103 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = 553102 - IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = 553097 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 553094 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 551950 - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 553096 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553095 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 551886 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = 553101 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = 553100 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = 553099 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 553098 +IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = {id} + IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 552155 + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index 713e676b455b9..d5eda79e2a7b3 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,18 +1,18 @@ -IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = 888880 +IgniteLimit(fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.0, cpu=35.0, memory=37.875, io=3.0, network=35.0], id = {id} {ONEOF} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = 888879 + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} ===== IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.0, cpu=34.0, memory=37.875, io=3.0, network=35.0], id = {id} {ONEOF} - IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = 888878 - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = 888877 - IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = 888876 - IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = 888875 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 888870 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553385 - IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = 888874 - IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = 888873 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = 888871 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 553444 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 888872 - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 558269 + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.0, cpu=30.0, memory=21.875, io=3.0, network=35.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.0, cpu=29.0, memory=21.875, io=3.0, network=35.0], id = {id} + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.0, cpu=28.0, memory=7.0, io=3.0, network=35.0], id = {id} + IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=27.0, memory=7.0, io=3.0, network=35.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=6.0, io=2.0, network=22.0], id = {id} + IgniteNestedLoopJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=6.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q4.plan b/modules/calcite/src/test/resources/tpch/q4.plan index 06d73f3af7ef4..0fc032fbf18aa 100644 --- a/modules/calcite/src/test/resources/tpch/q4.plan +++ b/modules/calcite/src/test/resources/tpch/q4.plan @@ -1,11 +1,11 @@ -IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = 889723 - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = 889722 - IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = 889721 - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = 889720 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 889715 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 889033 - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = 889719 - IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = 889718 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 889717 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 889716 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 889107 +IgniteColocatedSortAggregate(group=[{0}], ORDER_COUNT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=20.0, memory=23.0, io=2.0, network=14.0], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=19.0, memory=14.0, io=2.0, network=14.0], id = {id} + IgniteProject(O_ORDERPRIORITY=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=15.0, memory=10.0, io=2.0, network=14.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=14.0, memory=10.0, io=2.0, network=14.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t1, 1993-07-01), <($t1, 1993-10-01))], rowType=[RecordType(INTEGER O_ORDERKEY, VARCHAR O_ORDERPRIORITY)], projects=[[$t0, $t2]], requiredColumns=[{2, 6, 7}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-07-01, upperBound=1993-10-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=8.0, memory=9.0, io=1.0, network=5.0], id = {id} + IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=7.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.O_ORDERKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[<($t1, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index 17b596ff19a59..9e63eb8699872 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -1,26 +1,26 @@ -IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = 996455 - IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = 996454 - IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996453 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = 996452 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996436 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890103 - IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = 996451 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = 996450 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 996438 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996437 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890165 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = 996449 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = 996440 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = 996439 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890219 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = 996448 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 996442 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 996441 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890288 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = 996447 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = 996444 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 996443 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 890336 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 996446 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 996445 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 890355 +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.7035, cpu=30.05525, memory=41.159375, io=3.175875, network=36.659375], id = {id} + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.7035, cpu=26.05525, memory=33.159375, io=3.175875, network=36.659375], id = {id} + IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.7035, cpu=25.05525, memory=28.659375, io=3.175875, network=36.659375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $9), =($0, $3))], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.7035, cpu=24.05525, memory=28.659375, io=3.175875, network=36.659375], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[AND(=($cor10.C_NATIONKEY, $7), =($cor10.C_CUSTKEY, $1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.7035, cpu=18.05525, memory=27.659375, io=2.175875, network=27.659375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.7035, cpu=14.055250000000001, memory=27.659375, io=2.175875, network=27.659375], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.7035, cpu=7.05525, memory=18.659375, io=1.175875, network=18.659375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor6.O_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor6.O_ORDERKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=17.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=11.0625, io=1.1724999999999999, network=11.0625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor7.L_SUPPKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=13.75, io=1.15, network=13.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor8.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.S_NATIONKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q6.plan b/modules/calcite/src/test/resources/tpch/q6.plan index 2af79c4eeb8bb..68b06ae548564 100644 --- a/modules/calcite/src/test/resources/tpch/q6.plan +++ b/modules/calcite/src/test/resources/tpch/q6.plan @@ -1,3 +1,3 @@ -IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = 996526 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 996525 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996515 +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)), AND(>=($t2, 0.05:DECIMAL(4, 2)), <=($t2, 0.07:DECIMAL(4, 2))), <($t0, 24.00))], rowType=[RecordType(DECIMAL(30, 4) $f0)], projects=[[*($t1, $t2)]], requiredColumns=[{6, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index 393da729b02ca..6ccc81d091248 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,29 +1,29 @@ IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.700125, cpu=37.04175, memory=55.457875, io=3.175875, network=40.582875], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = 1741921 + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.700125, cpu=33.04175, memory=39.457875, io=3.175875, network=40.582875], id = {id} IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.700125, cpu=32.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} IgniteFilter(condition=[AND(OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))), SEARCH($1, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($1, _UTF-8'FRANCE'), =($1, _UTF-8'GERMANY')), OR(=($14, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.700125, cpu=31.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.700125, cpu=27.04175, memory=24.582875, io=3.175875, network=40.582875], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = 1741917 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741906 + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.700125, cpu=17.04175, memory=23.582875, io=2.175875, network=31.582875], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997002 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = 1741916 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = 1741908 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = 1741907 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 997070 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = 1741915 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741910 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741909 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997116 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 1741914 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741912 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741911 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 997163 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1741913 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1741905 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 996968 + IgniteCorrelatedNestedLoopJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.700125, cpu=11.04175, memory=22.582875, io=1.175875, network=22.582875], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor6.S_SUPPKEY, $1)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor6.S_SUPPKEY], null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[$cor8]], variablesSet=[[8]], correlationVariables=[[$cor8]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6675, cpu=6.945, memory=10.5525, io=1.1724999999999999, network=10.5525], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor7.L_ORDERKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor7.L_ORDERKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor8.O_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor8.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor9.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index 833e034d24930..36dc762e828a6 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -1,39 +1,39 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 1941636 - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1941635 - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 1941634 - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1941633 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 1941632 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 1941610 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742497 - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1941631 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 1941630 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 1941612 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941611 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742526 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 1941629 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941614 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941613 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742560 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 1941628 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 1941616 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 1941615 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742619 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 1941627 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 1941618 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 1941617 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742694 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 1941626 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941620 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941619 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742742 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 1941625 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 1941622 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 1941621 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1742790 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 1941624 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 1941623 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 1742809 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index c3607f72b24fd..ba87001467449 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,32 +1,32 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = 2115169 - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = 2115168 - IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2115167 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = 2115166 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2115150 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942025 - IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2115165 - IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = 2115164 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = 2115152 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = 2115151 +IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.01501875, cpu=36.0212625, memory=69.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.01501875, cpu=32.0212625, memory=57.78493125, io=4.00388125, network=52.03493125], id = {id} + IgniteProject(NATION=[$15], O_YEAR=[EXTRACT(FLAG(YEAR), $5)], AMOUNT=[-(*($10, -(1, $11)), *($3, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.01501875, cpu=31.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[$cor12]], variablesSet=[[12]], correlationVariables=[[$cor12]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.01501875, cpu=30.0212625, memory=48.03493125, io=4.00388125, network=52.03493125], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor12.P_PARTKEY, $6)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.01501875, cpu=24.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner], variablesSet=[[$cor6]], variablesSet=[[6]], correlationVariables=[[$cor6]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.01501875, cpu=20.0212625, memory=47.03493125, io=3.00388125, network=47.03493125], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942040 + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = 2115163 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2115154 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115153 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942111 - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = 2115162 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = 2115156 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = 2115155 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942149 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = 2115161 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2115158 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115157 - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942224 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2115160 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2115159 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 1942247 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[$cor9]], variablesSet=[[9]], correlationVariables=[[$cor9]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.01501875, cpu=13.021262499999999, memory=34.03493125, io=2.00388125, network=34.03493125], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD_proxy], requiredColumns=[{2, 6}], inlineScan=[true], collation=[[6 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[$cor10]], variablesSet=[[10]], correlationVariables=[[$cor10]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.01501875, cpu=6.0212625, memory=25.03493125, io=1.00388125, network=25.03493125], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[AND(=($cor6.PS_SUPPKEY, $2), =($cor6.PS_PARTKEY, $1), =($cor9.O_ORDERKEY, $0))], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor9.O_ORDERKEY], null, null, null, null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=25.0, io=1.0, network=25.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=25.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor11]], variablesSet=[[11]], correlationVariables=[[$cor11]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.45, cpu=6.3, memory=10.35, io=1.15, network=10.35], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor10.L_SUPPKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor10.L_SUPPKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor11.S_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor11.S_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 96ef51f2230c4..8f5835e1086c8 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -1,9 +1,9 @@ -IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = 2122665 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = 2122664 - IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = 2122663 - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = 2122662 - IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = 2122661 - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash=-39424137], cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = 2122660 - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = 2122659 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2115341 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2117114 +IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=15.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=14.0, memory=24.0, io=2.0, network=18.0], id = {id} + IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} + IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index 20a0a99318474..68e4728c8a870 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -1,8 +1,8 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = 2126446 - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = 2126445 - IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = 2126444 - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = 2126443 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2126441 - IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2122821 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2126442 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2122796 +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=12.0, io=2.0, network=22.0], id = {id} + IgniteProject($f0=[CASE(=(SUBSTRING($1, 1, 5), _UTF-8'PROMO'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], $f1=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.0, cpu=17.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=16.0, memory=2.0, io=2.0, network=22.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 2075d1af36bb3..36dc762e828a6 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -1,39 +1,39 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = 2326160 - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2326159 - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = 2326158 - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2326157 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = 2326156 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = 2326134 - IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127021 - IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2326155 - IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = 2326154 - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = 2326136 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326135 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127049 - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = 2326153 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326138 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326137 +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16.72832875, cpu=31.148743125, memory=44.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=15.72832875, cpu=27.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=14.72832875, cpu=26.148743125, memory=36.477810937499996, io=3.1764571875, network=26.4778109375], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($2, _UTF-8'BRAZIL'), *($8, -(1, $9)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.72832875, cpu=25.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[$cor21]], variablesSet=[[21]], correlationVariables=[[$cor21]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.72832875, cpu=24.148743125, memory=22.4778109375, io=3.1764571875, network=26.4778109375], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteFilter(condition=[=($cor21.P_PARTKEY, $5)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.72832875, cpu=18.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[$cor15]], variablesSet=[[15]], correlationVariables=[[$cor15]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=8.72832875, cpu=14.148743125, memory=21.4778109375, io=2.1764571875, network=21.4778109375], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[$cor16]], variablesSet=[[16]], correlationVariables=[[$cor16]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.72832875, cpu=7.148743125, memory=12.4778109375, io=1.1764571875, network=12.4778109375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($1, $cor15.N_NATIONKEY)], collation=[[1 ASC-nulls-first]], searchBounds=[[null, ExactBounds [bound=$cor15.N_NATIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} {ONEOF} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127084 + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} {ONEOF} - IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = 2326152 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = 2326140 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = 2326139 - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127154 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = 2326151 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = 2326142 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = 2326141 - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127197 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = 2326150 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326144 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326143 - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127252 - IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = 2326149 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = 2326146 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = 2326145 - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = 2127314 - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = 2326148 - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = 2326147 - IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = 2127333 + IgniteCorrelatedNestedLoopJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[$cor17]], variablesSet=[[17]], correlationVariables=[[$cor17]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.855525, cpu=7.6582875, memory=23.18540625, io=1.17638125, network=23.18540625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor16.S_SUPPKEY, $2)], collation=[[2 ASC-nulls-first]], searchBounds=[[null, null, ExactBounds [bound=$cor16.S_SUPPKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=21.0, io=1.0, network=21.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=21.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[$cor18]], variablesSet=[[18]], correlationVariables=[[$cor18]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.7035, cpu=11.055250000000001, memory=14.569375, io=1.175875, network=14.569375], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor17.L_ORDERKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor17.L_ORDERKEY], null, null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=13.0, io=1.0, network=13.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=13.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor19]], variablesSet=[[19]], correlationVariables=[[$cor19]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6899999999999995, cpu=7.035, memory=10.4625, io=1.1724999999999999, network=10.4625], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor18.O_CUSTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor18.O_CUSTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[$cor20]], variablesSet=[[20]], correlationVariables=[[$cor20]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.6, cpu=6.9, memory=9.75, io=1.15, network=9.75], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor19.C_NATIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor19.C_NATIONKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor20.N_REGIONKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor20.N_REGIONKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=6.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} From 7cd83cac7d0efae398545f82447b379cb915a297 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 16:14:40 +0300 Subject: [PATCH 26/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 150 ++++++------------ .../calcite/planner/tpc/PlanChecker.java | 4 +- .../query/calcite/planner/tpc/TpchHelper.java | 64 +++++++- 3 files changed, 107 insertions(+), 111 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index df64c0f9e5a32..73da6696695f0 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -17,21 +17,11 @@ package org.apache.ignite.internal.processors.query.calcite.planner.tpc; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UncheckedIOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Scanner; import java.util.stream.Collectors; -import com.google.common.io.CharStreams; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.sql.SqlExplainLevel; import org.apache.ignite.cache.query.annotations.QuerySqlFunction; @@ -49,7 +39,10 @@ import org.junit.Test; import org.junit.runners.Parameterized; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.loadFromResource; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.scriptToQueries; import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sql; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sqlTestName; import static org.apache.logging.log4j.util.Cast.cast; /** @@ -59,11 +52,14 @@ public class AbstractTpcQueryPlannerTest extends AbstractPlannerTest { /** Set to {@code true} to write plan files, instead of checking. */ private static final boolean UPDATE_PLAN = false; + /** Server node to run queries on. */ private static IgniteEx srv; + /** Query id. Set by {@link PlanChecker}. */ @Parameterized.Parameter public String queryId; + /** Run once, before all queries check. */ @BeforePlansTest public static void startAll(Class testClass) throws Exception { AbstractTpcQueryPlannerTest mock = new AbstractTpcQueryPlannerTest(); @@ -87,6 +83,7 @@ public static void startAll(Class testClass) throws Exception { scriptToQueries(table.ddlScript()).forEach(q -> sql(srv, q)); } + /** Run once, after all queries check. */ @AfterPlansTest public static void stopAll(Class testClass) { if (srv != null) { @@ -96,133 +93,82 @@ public static void stopAll(Class testClass) { } } + /** Test single query. */ @Test public void testQuery() { - List actualPlans = queryPlan(loadFromResource(String.format(TpchHelper.name(getClass()) + "/%s.sql", queryId))); + String actualPlan = queryPlan(); if (UPDATE_PLAN) { - updateQueryPlan(queryId, actualPlans); + updatePlan(actualPlan); + return; } - String[] expectedPlans = loadFromResource(String.format("%s/%s.plan", TpchHelper.name(getClass()), queryId)) - .split("----(\\r\\n|\\n|\\r)"); - - assert expectedPlans.length == actualPlans.size() : "Unexpected number of plans, got: " + actualPlans.size() - + ", expected: " + expectedPlans.length; - - int pos = 0; - - for (String actualPlan : actualPlans) { - boolean match = false; + boolean match = false; - String expectedPlan = TpchHelper.replaceIdAndHash(expectedPlans[pos++]); - - for (String possiblePlan : TpchHelper.expandTemplates(expectedPlan)) { - if (possiblePlan.equals(actualPlan)) { - match = true; - - break; - } - } + String expPlan = TpchHelper.replaceIdAndHash(loadFromResource(String.format("%s/%s.plan", sqlTestName(getClass()), queryId))); - if (!match) { - // This assertion will print nice diff in IDE that will help to investigate. - // Test will fail anyway. - assertEquals(expectedPlan, actualPlan); + for (String possiblePlan : TpchHelper.expandTemplates(expPlan)) { + if (possiblePlan.equals(actualPlan)) { + match = true; - assert false : "Should not happen"; + break; } } - } - static String loadFromResource(String resource) { - try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) { - if (is == null) { - throw new IllegalArgumentException("Resource does not exist: " + resource); - } - try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { - return CharStreams.toString(reader); - } - } catch (IOException e) { - throw new UncheckedIOException("I/O operation failed: " + resource, e); - } - } + if (!match) { + // This assertion will print nice diff in IDE that will help to investigate. + // Test will fail anyway. + assertEquals(expPlan, actualPlan); - private static T invoke(Method method, Object... arguments) { - try { - return (T) method.invoke(null, arguments); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); + assert false : "Should not happen"; } } - private void updateQueryPlan(String queryId, List newPlans) { - Path targetDirectory = Path.of("./src/test/resources/" + TpchHelper.name(getClass())); - - // A targetDirectory must be specified by hand when expected plans are generated. - if (targetDirectory == null) { - throw new RuntimeException("Please provide target directory to where save generated plans." - + " Usually plans are kept in resource folder of tests within the same module."); - } - - try { - Files.createDirectories(targetDirectory); - - String plans = String.join("----" + System.lineSeparator(), newPlans); - Files.writeString(targetDirectory.resolve(String.format("%s.plan", queryId)), plans); - } catch (Exception e) { - throw new RuntimeException(e); - } + /** {@inheritDoc} */ + @Override protected boolean isSafeTopology() { + return false; } - - private List queryPlan(String sqlScript) { + /** */ + private String queryPlan() { CalciteQueryProcessor engine = (CalciteQueryProcessor)srv.context().query().defaultQueryEngine(); Map schemas = GridTestUtils.getFieldValue(engine.schemaHolder(), "igniteSchemas"); - return scriptToQueries(sqlScript).stream().map(qry -> { + List res = scriptToQueries(loadFromResource(sqlTestName(getClass()) + "/" + queryId + ".sql")).stream().map(qry -> { try { - return RelOptUtil.toString(physicalPlan(plannerCtx(sqlScript, schemas.values(), null)), SqlExplainLevel.ALL_ATTRIBUTES); + return RelOptUtil.toString(physicalPlan(plannerCtx(qry, schemas.values(), null)), SqlExplainLevel.ALL_ATTRIBUTES); } catch (Exception e) { throw new RuntimeException(e); } - }).map(TpchHelper::replaceIdAndHash).collect(Collectors.toList()); - } - - private static List scriptToQueries(String sqlScript) { - List queries = new ArrayList<>(); + }) + .map(TpchHelper::replaceIdAndHash) + .collect(Collectors.toList()); - Scanner sc = new Scanner(sqlScript); + assertEquals(1, res.size()); - StringBuilder current = new StringBuilder(); - - while (sc.hasNextLine()) { - String line = sc.nextLine().trim(); - - if (line.startsWith("--") || line.isEmpty()) - continue; - - current.append(line).append('\n'); + return res.get(0); + } - if (line.endsWith(";")) { - queries.add(current.toString()); + /** */ + private void updatePlan(String newPlan) { + Path targetDirectory = Path.of("./src/test/resources/" + sqlTestName(getClass())); - current = new StringBuilder(); - } + // A targetDirectory must be specified by hand when expected plans are generated. + if (targetDirectory == null) { + throw new RuntimeException("Please provide target directory to where save generated plans." + + " Usually plans are kept in resource folder of tests within the same module."); } - if (current.length() > 0) - queries.add(current.toString()); - - return queries; - } + try { + Files.createDirectories(targetDirectory); - /** {@inheritDoc} */ - @Override protected boolean isSafeTopology() { - return false; + Files.writeString(targetDirectory.resolve(String.format("%s.plan", queryId)), newPlan); + } catch (Exception e) { + throw new RuntimeException(e); + } } /** */ diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java index 301ba107ebfa0..bc1bb14468949 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -58,10 +58,10 @@ public PlanChecker(Class klass) throws Throwable { /** */ private Stream createRunnersForParameters() throws IOException { - Stream queries = Files.list(Path.of("./src/test/resources", TpchHelper.name(getTestClass().getJavaClass()))) + Stream queries = Files.list(Path.of("./src/test/resources", TpchHelper.sqlTestName(getTestClass().getJavaClass()))) .filter(p -> p.toString().endsWith(".sql")) .sorted() - .map(TpchHelper::queryId); + .map(p -> p.getFileName().toString().replace(".sql", "")); return queries .map(qryId -> new TestWithParameters("[queryId=" + qryId + "]", getTestClass(), Collections.singletonList(qryId))) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java index 23a85a9c7a18d..3350355c76e3a 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java @@ -22,7 +22,6 @@ import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -41,20 +40,25 @@ * Provides utility methods to work with queries defined by the TPC-H benchmark. */ public final class TpchHelper { + /** */ public static final String INT32 = "INT32"; + /** */ public static final String DECIMAL = "DECIMAL"; + /** */ public static final String STRING = "VARCHAR"; + /** */ public static final String DATE = "DATE"; /** */ private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); + /** */ private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); - + /** */ private TpchHelper() { } @@ -77,11 +81,8 @@ public static String loadFromResource(String resource) { } } - public static String queryId(Path p) { - return p.getFileName().toString().replace(".sql", ""); - } - - public static String name(Class klass) { + /** @return SQL test name. */ + public static String sqlTestName(Class klass) { PlanChecker.PlansTest desc = plansTest(klass); if (desc.name().isEmpty()) @@ -90,17 +91,20 @@ public static String name(Class klass) { return desc.name(); } + /** @return Tables for the test. */ public static Class> tables(Class klass) { PlanChecker.PlansTest desc = plansTest(klass); return desc.tables(); } + /** @return Test description annotation. */ private static PlanChecker.PlansTest plansTest(Class klass) { PlanChecker.PlansTest desc = klass.getAnnotation(PlanChecker.PlansTest.class); if (desc == null) throw new IllegalStateException("Test class must be annotated with @" + PlanChecker.PlansTest.class.getSimpleName()); + return desc; } @@ -119,12 +123,27 @@ public static List> sql(Ignite ignite, String sql, Object... params) { } } + /** + * Supported templates: + *
    + *
  • {@code ", id = 123} replaced with the {@code ", id = {id}}
  • + *
  • {@code ", hash=123} replaced with the {@code ", hash={hash}}
  • + *
  • {@code "{INDEX_CASE:IDX1,IDX2}} expands to the plans where {INDEX_CASE....} replaced with each of the index from list.
  • + *
  • {@code "{ONEOF}} start and finish with the {@code {ONEOF}} tag. Cases separated with the line "=====". + * Creates as many plans as there are cases. + *
  • + *
+ * + * @param plan Plan with templates + * @return Expanded (templates replaced with the possible values). One of the plan must be equal to the one created by Ignite node. + */ public static List expandTemplates(String plan) { return expandOneof(plan).stream() .flatMap(TpchHelper::expandIndexCase) .collect(Collectors.toList()); } + /** Expands plans. Replace {INDEX_CASE} tag with the possible indexes. */ private static Stream expandIndexCase(String plan) { List res = new ArrayList<>(); @@ -152,6 +171,7 @@ private static Stream expandIndexCase(String plan) { return res.stream(); } + /** Expands plans. Replace {ONEOF} tag with the possible cases. */ private static List expandOneof(String plan) { String oneOf = "{ONEOF}"; @@ -208,8 +228,38 @@ private static List expandOneof(String plan) { return res.stream().flatMap(p -> expandOneof(p.toString()).stream()).collect(Collectors.toList()); } + /** Replaces id and hash patterns. */ public static String replaceIdAndHash(String plan) { plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); return HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); } + + /** @return List of SQL queries from the script file. Comments are skipped. */ + public static List scriptToQueries(String sqlScript) { + List queries = new ArrayList<>(); + + Scanner sc = new Scanner(sqlScript); + + StringBuilder current = new StringBuilder(); + + while (sc.hasNextLine()) { + String line = sc.nextLine().trim(); + + if (line.startsWith("--") || line.isEmpty()) + continue; + + current.append(line).append('\n'); + + if (line.endsWith(";")) { + queries.add(current.toString()); + + current = new StringBuilder(); + } + } + + if (current.length() > 0) + queries.add(current.toString()); + + return queries; + } } From b49c93c15d60cb5d06fc0643059dd62635dcc8ea Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 17:48:59 +0300 Subject: [PATCH 27/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 9 +- .../calcite/planner/tpc/PlanChecker.java | 6 +- .../calcite/planner/tpc/TpcScaleFactor.java | 34 --- .../query/calcite/planner/tpc/TpcTable.java | 63 ----- .../query/calcite/planner/tpc/TpchHelper.java | 37 ++- .../planner/tpc/TpchQueryPlannerTest.java | 2 +- .../query/calcite/planner/tpc/TpchTables.java | 251 ------------------ 7 files changed, 23 insertions(+), 379 deletions(-) delete mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java delete mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java delete mode 100644 modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 73da6696695f0..639643b6e65f2 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -43,7 +43,6 @@ import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.scriptToQueries; import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sql; import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sqlTestName; -import static org.apache.logging.log4j.util.Cast.cast; /** * Abstract test class to ensure a planner generates expected plan for TPC queries. @@ -77,10 +76,10 @@ public static void startAll(Class testClass) throws Exception { .setSqlFunctionClasses(AbstractTpcQueryPlannerTest.TpchUDF.class) .setSqlSchema("PUBLIC")); - TpcTable[] tables = cast(TpchHelper.tables(testClass).getEnumConstants()); - - for (TpcTable table : tables) - scriptToQueries(table.ddlScript()).forEach(q -> sql(srv, q)); + TpchHelper.testFiles(testClass, "ddl") + .filter(p -> p.toString().endsWith(".sql")) + .map(p -> loadFromResource(p.toString())) + .forEach(ddl -> scriptToQueries(ddl).forEach(q -> sql(srv, q))); } /** Run once, after all queries check. */ diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java index bc1bb14468949..b8d623c26279b 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -23,8 +23,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -58,7 +56,7 @@ public PlanChecker(Class klass) throws Throwable { /** */ private Stream createRunnersForParameters() throws IOException { - Stream queries = Files.list(Path.of("./src/test/resources", TpchHelper.sqlTestName(getTestClass().getJavaClass()))) + Stream queries = TpchHelper.testFiles(getTestClass().getJavaClass()) .filter(p -> p.toString().endsWith(".sql")) .sorted() .map(p -> p.getFileName().toString().replace(".sql", "")); @@ -108,8 +106,6 @@ private void runAnnotated(Class annotation) { @Target(ElementType.TYPE) public @interface PlansTest { String name() default ""; - - Class> tables(); } @Retention(RetentionPolicy.RUNTIME) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java deleted file mode 100644 index 3b2162c60751a..0000000000000 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcScaleFactor.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.processors.query.calcite.planner.tpc; - -/** - * Enumerates scale factors supported for TPC tables. - */ -public enum TpcScaleFactor { - SF_1GB, SF_1TB, SF_3TB, SF_10TB, SF_30TB, SF_100TB; - - /** - * Returns size that corresponds for current scale factor. - */ - public long size(long... sizes) { - assert sizes.length == values().length; - - return sizes[ordinal()]; - } -} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java deleted file mode 100644 index aa96f98f775e8..0000000000000 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpcTable.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.processors.query.calcite.planner.tpc; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.Iterator; - -/** A table from TPC suite. */ -public interface TpcTable { - /** Returns name of the table. */ - String tableName(); - - /** Returns number of column in the table. */ - int columnsCount(); - - /** Returns name of the column with given 0-based index. */ - String columnName(int idx); - - /** Returns definition of a table including necessary indexes. */ - String ddlScript(); - - /** - * Returns DML string representing single-row INSERT statement with dynamic parameters placeholders. - * - *

The order of columns matches the order provided in table declaration, i.e. it's the same - * order like in output of {@code SELECT * FROM table_name} statement, as well as the same order - * in which column names are returned from {@link #columnName(int)} method. - * - *

The statement returned is tolerant to columns' type mismatch, implying you - * can use any value while there is cast from provided value to required type. - */ - String insertPrepareStatement(); - - /** - * Returns iterator returning rows of the corresponding table. - * - *

May be used to fill the table via KV API or SQL API. - * - * @param pathToDataset A path to a directory with CSV file containing data for the table. - * @return Iterator over data of the table. - * @throws IOException In case of error. - */ - Iterator dataProvider(Path pathToDataset) throws IOException; - - /** Returns estimated size of a table for given scale factor. */ - long estimatedSize(TpcScaleFactor sf); -} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java index 3350355c76e3a..4b16ea544a304 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java @@ -22,6 +22,8 @@ import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -41,25 +43,24 @@ */ public final class TpchHelper { /** */ - public static final String INT32 = "INT32"; - - /** */ - public static final String DECIMAL = "DECIMAL"; + private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); /** */ - public static final String STRING = "VARCHAR"; + private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); /** */ - public static final String DATE = "DATE"; + private static final String RSRC_DIR = "./src/test/resources"; /** */ - private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); + private TpchHelper() { + } - /** */ - private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); + public static Stream testFiles(Class klass) throws IOException { + return testFiles(klass, ""); + } - /** */ - private TpchHelper() { + public static Stream testFiles(Class klass, String exdDir) throws IOException { + return Files.list(Path.of(RSRC_DIR, sqlTestName(klass), exdDir)); } /** @@ -69,6 +70,9 @@ private TpchHelper() { * @return Resource as string. */ public static String loadFromResource(String resource) { + if (resource.startsWith(RSRC_DIR)) + resource = resource.substring(RSRC_DIR.length() + 1); + try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) { if (is == null) { throw new IllegalArgumentException("Resource does not exist: " + resource); @@ -91,13 +95,6 @@ public static String sqlTestName(Class klass) { return desc.name(); } - /** @return Tables for the test. */ - public static Class> tables(Class klass) { - PlanChecker.PlansTest desc = plansTest(klass); - - return desc.tables(); - } - /** @return Test description annotation. */ private static PlanChecker.PlansTest plansTest(Class klass) { PlanChecker.PlansTest desc = klass.getAnnotation(PlanChecker.PlansTest.class); @@ -182,7 +179,7 @@ private static List expandOneof(String plan) { Scanner sc = new Scanner(plan); - StringBuffer beforeOneof = new StringBuffer(); + StringBuilder beforeOneof = new StringBuilder(); while (sc.hasNextLine()) { String line = sc.nextLine(); @@ -197,7 +194,7 @@ private static List expandOneof(String plan) { // Expanding first found oneof while(sc.hasNextLine() && !oneOfEnd) { - StringBuffer oneofCase = new StringBuffer(); + StringBuilder oneofCase = new StringBuilder(); while (sc.hasNextLine()) { String line = sc.nextLine(); diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java index 15c3b6ee9d2c7..e0aa8734929d6 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchQueryPlannerTest.java @@ -25,7 +25,7 @@ * @code org.apache.ignite.internal.sql.engine.benchmarks.TpchParseBenchmark */ @RunWith(PlanChecker.class) -@PlanChecker.PlansTest(name = "tpch", tables = TpchTables.class) +@PlanChecker.PlansTest(name = "tpch") public class TpchQueryPlannerTest extends AbstractTpcQueryPlannerTest { // No-op } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java deleted file mode 100644 index dbfd6cbe548cd..0000000000000 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchTables.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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.processors.query.calcite.planner.tpc; - -import java.io.IOException; -import java.math.BigDecimal; -import java.nio.file.Files; -import java.nio.file.Path; -import java.time.LocalDate; -import java.util.Iterator; - -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.DATE; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.DECIMAL; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.INT32; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.STRING; - -/** - * Enumeration of tables from TPC-H specification. - */ -@SuppressWarnings("NonSerializableFieldInSerializableClass") -public enum TpchTables implements TpcTable { - LINEITEM( - new long[] {6_001_215, 5_999_989_709L, 18_000_048_306L, 59_999_994_267L, 179_999_978_268L, 599_999_969_200L}, - new Column("L_ORDERKEY", INT32), - new Column("L_PARTKEY", INT32), - new Column("L_SUPPKEY", INT32), - new Column("L_LINENUMBER", INT32), - new Column("L_QUANTITY", DECIMAL), - new Column("L_EXTENDEDPRICE", DECIMAL), - new Column("L_DISCOUNT", DECIMAL), - new Column("L_TAX", DECIMAL), - new Column("L_RETURNFLAG", STRING), - new Column("L_LINESTATUS", STRING), - new Column("L_SHIPDATE", DATE), - new Column("L_COMMITDATE", DATE), - new Column("L_RECEIPTDATE", DATE), - new Column("L_SHIPINSTRUCT", STRING), - new Column("L_SHIPMODE", STRING), - new Column("L_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::integer, ?::integer, ?::integer," - + "?::decimal(15, 2), ?::decimal(15, 2), ?::decimal(15, 2)," - + "?::decimal(15, 2), ?::char(1), ?::char(1), ?::date," - + "?::date, ?::date, ?::char(25), ?::char(10), ?::varchar(44));"; - } - }, - - PART( - new long[] {200_000, 200_000_000, 600_000_000, 2_000_000_000, 6_000_000_000L, 20_000_000_000L}, - new Column("P_PARTKEY", INT32), - new Column("P_NAME", STRING), - new Column("P_MFGR", STRING), - new Column("P_BRAND", STRING), - new Column("P_TYPE", STRING), - new Column("P_SIZE", INT32), - new Column("P_CONTAINER", STRING), - new Column("P_RETAILPRICE", DECIMAL), - new Column("P_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::varchar(55), ?::char(25)," - + "?::char(10), ?::varchar(25), ?::integer," - + "?::char(10), ?::decimal(15, 2), ?::varchar(23));"; - } - }, - - SUPPLIER( - new long[] {10_000, 10_000_000, 30_000_000, 100_000_000, 300_000_000, 1_000_000_000}, - new Column("S_SUPPKEY", INT32), - new Column("S_NAME", STRING), - new Column("S_ADDRESS", STRING), - new Column("S_NATIONKEY", INT32), - new Column("S_PHONE", STRING), - new Column("S_ACCTBAL", DECIMAL), - new Column("S_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::char(25), ?::varchar(40)," - + "?::integer, ?::char(15), ?::decimal(15, 2), ?::varchar(101));"; - } - }, - - PARTSUPP( - new long[] {800_000, 800_000_000, 2_400_000_000L, 8_000_000_000L, 24_000_000_000L, 80_000_000_000L}, - new Column("PS_PARTKEY", INT32), - new Column("PS_SUPPKEY", INT32), - new Column("PS_AVAILQTY", INT32), - new Column("PS_SUPPLYCOST", DECIMAL), - new Column("PS_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::integer, ?::integer," - + "?::decimal(15, 2), ?::varchar(199));"; - } - }, - - NATION( - new long[] {25, 25, 25, 25, 25, 25}, - new Column("N_NATIONKEY", INT32), - new Column("N_NAME", STRING), - new Column("N_REGIONKEY", INT32), - new Column("N_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::char(25), ?::integer, ?::varchar(152));"; - } - }, - - REGION( - new long[] {5, 5, 5, 5, 5, 5}, - new Column("R_REGIONKEY", INT32), - new Column("R_NAME", STRING), - new Column("R_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::char(25), ?::varchar(152));"; - } - }, - - ORDERS( - new long[] {1_500_000, 1_500_000_000, 4_500_000_000L, 15_000_000_000L, 45_000_000_000L, 150_000_000_000L}, - new Column("O_ORDERKEY", INT32), - new Column("O_CUSTKEY", INT32), - new Column("O_ORDERSTATUS", STRING), - new Column("O_TOTALPRICE", DECIMAL), - new Column("O_ORDERDATE", DATE), - new Column("O_ORDERPRIORITY", STRING), - new Column("O_CLERK", STRING), - new Column("O_SHIPPRIORITY", INT32), - new Column("O_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::integer, ?::char(1)," - + "?::decimal(15, 2), ?::date, ?::char(15)," - + "?::char(15), ?::integer, ?::varchar(79));"; - } - }, - - CUSTOMER( - new long[] {150_000, 150_000_000, 450_000_000L, 1_500_000_000L, 4_500_000_000L, 15_000_000_000L}, - new Column("C_CUSTKEY", INT32), - new Column("C_NAME", STRING), - new Column("C_ADDRESS", STRING), - new Column("C_NATIONKEY", INT32), - new Column("C_PHONE", STRING), - new Column("C_ACCTBAL", DECIMAL), - new Column("C_MKTSEGMENT", STRING), - new Column("C_COMMENT", STRING) - ) { - @Override public String insertPrepareStatement() { - return "INSERT INTO " + tableName() + " VALUES (" - + "?::integer, ?::varchar(25), ?::varchar(40)," - + "?::integer, ?::char(15), ?::decimal(15, 2)," - + "?::char(10), ?::varchar(117));"; - } - }; - - private final Column[] columns; - private final long[] tableSizes; - - TpchTables(long[] tableSizes, Column... columns) { - this.tableSizes = tableSizes; - this.columns = columns; - } - - @Override public String tableName() { - return name().toLowerCase(); - } - - @Override public int columnsCount() { - return columns.length; - } - - @Override public String columnName(int idx) { - return columns[idx].name; - } - - @Override public String ddlScript() { - return TpchHelper.loadFromResource("tpch/ddl/" + tableName() + "_ddl.sql"); - } - - @SuppressWarnings("resource") - @Override public Iterator dataProvider(Path pathToDataset) throws IOException { - return Files.lines(pathToDataset.resolve(tableName() + ".tbl")) - .map(this::csvLineToTableValues) - .iterator(); - } - - @Override public long estimatedSize(TpcScaleFactor sf) { - return sf.size(tableSizes); - } - - private Object[] csvLineToTableValues(String line) { - String[] stringValues = line.split("\\|"); - Object[] values = new Object[columns.length]; - - for (int i = 0; i < columns.length; i++) { - switch (columns[i].type) { - case INT32: - values[i] = Integer.valueOf(stringValues[i]); - break; - case DECIMAL: - values[i] = new BigDecimal(stringValues[i]); - break; - case DATE: - values[i] = LocalDate.parse(stringValues[i]); - break; - case STRING: - values[i] = stringValues[i]; - break; - default: - throw new IllegalStateException(columns[i].type.toString()); - } - } - - return values; - } - - private static class Column { - private final String name; - private final String type; - - private Column(String name, String type) { - this.name = name; - this.type = type; - } - } -} From 8472c03f158e3ba511dedcd36950aa136e946698 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 18:16:17 +0300 Subject: [PATCH 28/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 11 ++++--- .../calcite/planner/tpc/PlanChecker.java | 33 ++++++++++--------- .../query/calcite/planner/tpc/TpchHelper.java | 23 +++++++------ 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 639643b6e65f2..cda55b8ca0d2f 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -153,19 +153,20 @@ private String queryPlan() { /** */ private void updatePlan(String newPlan) { - Path targetDirectory = Path.of("./src/test/resources/" + sqlTestName(getClass())); + Path targetDir = Path.of("./src/test/resources/" + sqlTestName(getClass())); // A targetDirectory must be specified by hand when expected plans are generated. - if (targetDirectory == null) { + if (targetDir == null) { throw new RuntimeException("Please provide target directory to where save generated plans." + " Usually plans are kept in resource folder of tests within the same module."); } try { - Files.createDirectories(targetDirectory); + Files.createDirectories(targetDir); - Files.writeString(targetDirectory.resolve(String.format("%s.plan", queryId)), newPlan); - } catch (Exception e) { + Files.writeString(targetDir.resolve(String.format("%s.plan", queryId)), newPlan); + } + catch (Exception e) { throw new RuntimeException(e); } } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java index b8d623c26279b..9ed63bc401cf2 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -32,37 +32,31 @@ import org.junit.runner.notification.RunNotifier; import org.junit.runners.Suite; import org.junit.runners.model.InitializationError; +import org.junit.runners.model.TestClass; import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters; import org.junit.runners.parameterized.TestWithParameters; -/** */ +/** + * Suite to check queries plans. + * Makes pretty test names to simplify CI tracking. + */ public class PlanChecker extends Suite { - /** */ - private final List runners; - /** * Only called reflectively. Do not use programmatically. */ public PlanChecker(Class klass) throws Throwable { - super(klass, Collections.emptyList()); - - runners = createRunnersForParameters().collect(Collectors.toList()); - } - - /** {@inheritDoc} */ - @Override protected List getChildren() { - return runners; + super(klass, createRunnersForParameters(new TestClass(klass)).collect(Collectors.toList())); } /** */ - private Stream createRunnersForParameters() throws IOException { - Stream queries = TpchHelper.testFiles(getTestClass().getJavaClass()) + private static Stream createRunnersForParameters(TestClass testClass) throws IOException { + Stream queries = TpchHelper.testFiles(testClass.getJavaClass()) .filter(p -> p.toString().endsWith(".sql")) .sorted() .map(p -> p.getFileName().toString().replace(".sql", "")); return queries - .map(qryId -> new TestWithParameters("[queryId=" + qryId + "]", getTestClass(), Collections.singletonList(qryId))) + .map(qryId -> new TestWithParameters("[queryId=" + qryId + "]", testClass, Collections.singletonList(qryId))) .map(test -> { try { return new BlockJUnit4ClassRunnerWithParameters(test); @@ -76,6 +70,7 @@ private Stream createRunnersForParameters() throws IOException { /** {@inheritDoc} */ @Override public void run(RunNotifier notifier) { runAnnotated(BeforePlansTest.class); + try { super.run(notifier); } @@ -84,6 +79,7 @@ private Stream createRunnersForParameters() throws IOException { } } + /** Runs static void method of test class annotated with the specific annotation. */ private void runAnnotated(Class annotation) { getTestClass().getAnnotatedMethods(annotation).forEach(m -> { List errors = new ArrayList<>(); @@ -102,20 +98,25 @@ private void runAnnotated(Class annotation) { }); } + /** */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface PlansTest { + /** @return Test name. */ String name() default ""; } + /** */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface BeforePlansTest { + // No-op. } + /** */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface AfterPlansTest { - String name() default ""; + // No-op. } } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java index 4b16ea544a304..be23cd08d0a16 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java @@ -55,10 +55,12 @@ public final class TpchHelper { private TpchHelper() { } + /** */ public static Stream testFiles(Class klass) throws IOException { return testFiles(klass, ""); } + /** */ public static Stream testFiles(Class klass, String exdDir) throws IOException { return Files.list(Path.of(RSRC_DIR, sqlTestName(klass), exdDir)); } @@ -74,13 +76,14 @@ public static String loadFromResource(String resource) { resource = resource.substring(RSRC_DIR.length() + 1); try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) { - if (is == null) { + if (is == null) throw new IllegalArgumentException("Resource does not exist: " + resource); - } + try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { return CharStreams.toString(reader); } - } catch (IOException e) { + } + catch (IOException e) { throw new UncheckedIOException("I/O operation failed: " + resource, e); } } @@ -193,7 +196,7 @@ private static List expandOneof(String plan) { boolean oneOfEnd = false; // Expanding first found oneof - while(sc.hasNextLine() && !oneOfEnd) { + while (sc.hasNextLine() && !oneOfEnd) { StringBuilder oneofCase = new StringBuilder(); while (sc.hasNextLine()) { @@ -237,7 +240,7 @@ public static List scriptToQueries(String sqlScript) { Scanner sc = new Scanner(sqlScript); - StringBuilder current = new StringBuilder(); + StringBuilder cur = new StringBuilder(); while (sc.hasNextLine()) { String line = sc.nextLine().trim(); @@ -245,17 +248,17 @@ public static List scriptToQueries(String sqlScript) { if (line.startsWith("--") || line.isEmpty()) continue; - current.append(line).append('\n'); + cur.append(line).append('\n'); if (line.endsWith(";")) { - queries.add(current.toString()); + queries.add(cur.toString()); - current = new StringBuilder(); + cur = new StringBuilder(); } } - if (current.length() > 0) - queries.add(current.toString()); + if (cur.length() > 0) + queries.add(cur.toString()); return queries; } From d81e61171b39e7d4f84138105ab5d5d081a63923 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Thu, 23 Apr 2026 18:16:39 +0300 Subject: [PATCH 29/39] WIP. Fix plans for tpch --- .../java/org/apache/ignite/testsuites/PlannerTestSuite.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java index 30415c303720e..c1c24761bdb32 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java +++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java @@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.query.calcite.planner.UnionPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.UserDefinedViewsPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.hints.HintsTestSuite; +import org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchQueryPlannerTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -92,6 +93,7 @@ UncollectPlannerTest.class, HintsTestSuite.class, + TpchQueryPlannerTest.class }) public class PlannerTestSuite { } From b9de79987e015e93e838a2d84e4bd851086c8979 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 11:38:27 +0300 Subject: [PATCH 30/39] WIP. Fix plans for tpch --- .../calcite/src/test/resources/tpch/q11.plan | 2 +- .../calcite/src/test/resources/tpch/q11.sql | 38 ++++++---- .../calcite/src/test/resources/tpch/q12.sql | 53 +++++++------ .../calcite/src/test/resources/tpch/q13.sql | 42 +++++----- .../calcite/src/test/resources/tpch/q2.sql | 58 +++++++------- .../calcite/src/test/resources/tpch/q3.sql | 32 ++++---- .../calcite/src/test/resources/tpch/q4.sql | 39 ++++++---- .../calcite/src/test/resources/tpch/q5.sql | 38 ++++++---- .../calcite/src/test/resources/tpch/q6.sql | 15 ++-- .../calcite/src/test/resources/tpch/q7.sql | 67 ++++++++-------- .../calcite/src/test/resources/tpch/q8.sql | 76 ++++++++++--------- .../calcite/src/test/resources/tpch/q9.sql | 59 +++++++------- 12 files changed, 292 insertions(+), 227 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index a38dea6787312..d14f2ddd6e077 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -11,7 +11,7 @@ IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = Igni IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*($0, 0.0001:DECIMAL(5, 4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = {id} + IgniteProject(EXPR$0=[*($0, 0.0001000000:DECIMAL(11, 10))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=21.0, memory=12.0, io=3.0, network=27.0], id = {id} IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=12.0, io=3.0, network=27.0], id = {id} IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=27.0], id = {id} IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=27.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q11.sql b/modules/calcite/src/test/resources/tpch/q11.sql index d304415b2734b..198574b1f8c98 100644 --- a/modules/calcite/src/test/resources/tpch/q11.sql +++ b/modules/calcite/src/test/resources/tpch/q11.sql @@ -1,30 +1,36 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Important Stock Identification Query (Q11) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select ps_partkey, - sum(ps_supplycost * ps_availqty) AS val -FROM + sum(ps_supplycost * ps_availqty) as val +from partsupp, supplier, nation -WHERE +where ps_suppkey = s_suppkey - AND s_nationkey = n_nationkey - AND n_name = 'GERMANY' -GROUP BY - ps_partkey -HAVING + and s_nationkey = n_nationkey + and n_name = 'GERMANY' +group by + ps_partkey having sum(ps_supplycost * ps_availqty) > ( - SELECT sum(ps_supplycost * ps_availqty) * 0.0001 - FROM + select + sum(ps_supplycost * ps_availqty) * 0.0001000000 + from partsupp, supplier, nation - WHERE + where ps_suppkey = s_suppkey - AND s_nationkey = n_nationkey - AND n_name = 'GERMANY' + and s_nationkey = n_nationkey + and n_name = 'GERMANY' ) -ORDER BY - val DESC +order by + val desc; diff --git a/modules/calcite/src/test/resources/tpch/q12.sql b/modules/calcite/src/test/resources/tpch/q12.sql index 31a40ce58908d..8f6a35ec549fb 100644 --- a/modules/calcite/src/test/resources/tpch/q12.sql +++ b/modules/calcite/src/test/resources/tpch/q12.sql @@ -1,31 +1,36 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Shipping Modes and Order Priority Query (Q12) +-- Functional Query Definition +-- Approved February 1998 -SELECT +select l_shipmode, - sum(CASE - WHEN o_orderpriority = '1-URGENT' - OR o_orderpriority = '2-HIGH' - THEN 1 - ELSE 0 - END) AS high_line_count, - sum(CASE - WHEN o_orderpriority <> '1-URGENT' - AND o_orderpriority <> '2-HIGH' - THEN 1 - ELSE 0 - END) AS low_line_count -FROM + sum(case + when o_orderpriority = '1-URGENT' + or o_orderpriority = '2-HIGH' + then 1 + else 0 + end) as high_line_count, + sum(case + when o_orderpriority <> '1-URGENT' + and o_orderpriority <> '2-HIGH' + then 1 + else 0 + end) as low_line_count +from orders, lineitem -WHERE - o_orderkey = l_orderkey - AND l_shipmode IN ('MAIL', 'SHIP') - AND l_commitdate < l_receiptdate - AND l_shipdate < l_commitdate - AND l_receiptdate >= DATE '1994-01-01' - AND l_receiptdate < DATE '1994-01-01' + INTERVAL '1' YEAR -GROUP BY - l_shipmode -ORDER BY +where + o_orderkey = l_orderkey + and l_shipmode in ('MAIL', 'SHIP') + and l_commitdate < l_receiptdate + and l_shipdate < l_commitdate + and l_receiptdate >= date '1994-01-01' + and l_receiptdate < date '1994-01-01' + interval '1' year +group by l_shipmode +order by + l_shipmode; diff --git a/modules/calcite/src/test/resources/tpch/q13.sql b/modules/calcite/src/test/resources/tpch/q13.sql index c3ab108c66d4d..986f1ee59fd50 100644 --- a/modules/calcite/src/test/resources/tpch/q13.sql +++ b/modules/calcite/src/test/resources/tpch/q13.sql @@ -1,23 +1,29 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Customer Distribution Query (Q13) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select c_count, - count(*) AS custdist -FROM ( - SELECT - c_custkey, - count(o_orderkey) - FROM - customer - LEFT OUTER JOIN orders ON - c_custkey = o_custkey - AND o_comment NOT LIKE '%special%requests%' - GROUP BY - c_custkey - ) AS c_orders (c_custkey, c_count) -GROUP BY + count(*) as custdist +from + ( + select + c_custkey, + count(o_orderkey) + from + customer left outer join orders on + c_custkey = o_custkey + and o_comment not like '%special%requests%' + group by + c_custkey + ) as c_orders (c_custkey, c_count) +group by c_count -ORDER BY - custdist DESC, - c_count DESC +order by + custdist desc, + c_count desc; diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index c6981c62636ca..9a8b16aa965fd 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -1,7 +1,12 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Minimum Cost Supplier Query (Q2) +-- Functional Query Definition +-- Approved February 1998 -SELECT +select s_acctbal, s_name, n_name, @@ -10,37 +15,38 @@ SELECT s_address, s_phone, s_comment -FROM +from part, supplier, partsupp, nation, region -WHERE - p_partkey = ps_partkey - AND s_suppkey = ps_suppkey - AND p_size = 15 - AND p_type LIKE '%BRASS' - AND s_nationkey = n_nationkey - AND n_regionkey = r_regionkey - AND r_name = 'EUROPE' - AND ps_supplycost = ( - SELECT min(ps_supplycost) - FROM - partsupp, - supplier, - nation, - region - WHERE +where + p_partkey = ps_partkey + and s_suppkey = ps_suppkey + and p_size = 15 + and p_type like '%BRASS' + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'EUROPE' + and ps_supplycost = ( + select + min(ps_supplycost) + from + partsupp, + supplier, + nation, + region + where p_partkey = ps_partkey - AND s_suppkey = ps_suppkey - AND s_nationkey = n_nationkey - AND n_regionkey = r_regionkey - AND r_name = 'EUROPE' -) -ORDER BY - s_acctbal DESC, + and s_suppkey = ps_suppkey + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'EUROPE' + ) +order by + s_acctbal desc, n_name, s_name, p_partkey - LIMIT 100 +limit 100; diff --git a/modules/calcite/src/test/resources/tpch/q3.sql b/modules/calcite/src/test/resources/tpch/q3.sql index 8a6eab5ce987f..173863e0f8da1 100644 --- a/modules/calcite/src/test/resources/tpch/q3.sql +++ b/modules/calcite/src/test/resources/tpch/q3.sql @@ -1,26 +1,32 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Shipping Priority Query (Q3) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select l_orderkey, - sum(l_extendedprice * (1 - l_discount)) AS revenue, + sum(l_extendedprice * (1 - l_discount)) as revenue, o_orderdate, o_shippriority -FROM +from customer, orders, lineitem -WHERE - c_mktsegment = 'BUILDING' - AND c_custkey = o_custkey - AND l_orderkey = o_orderkey - AND o_orderdate < DATE '1995-03-15' - AND l_shipdate > DATE '1995-03-15' -GROUP BY +where + c_mktsegment = 'BUILDING' + and c_custkey = o_custkey + and l_orderkey = o_orderkey + and o_orderdate < date '1995-03-15' + and l_shipdate > date '1995-03-15' +group by l_orderkey, o_orderdate, o_shippriority -ORDER BY - revenue DESC, +order by + revenue desc, o_orderdate - LIMIT 10 +limit 10; diff --git a/modules/calcite/src/test/resources/tpch/q4.sql b/modules/calcite/src/test/resources/tpch/q4.sql index 18ca1817e0bb5..28a5dff80087b 100644 --- a/modules/calcite/src/test/resources/tpch/q4.sql +++ b/modules/calcite/src/test/resources/tpch/q4.sql @@ -1,21 +1,30 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Shipping Priority Query (Q4) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select o_orderpriority, - count(*) AS order_count -FROM orders -WHERE - o_orderdate >= DATE '1993-07-01' - AND o_orderdate < DATE '1993-07-01' + INTERVAL '3' MONTH - AND EXISTS ( - SELECT * - FROM lineitem - WHERE - l_orderkey = o_orderkey - AND l_commitdate < l_receiptdate + count(*) as order_count +from + orders +where + o_orderdate >= date '1993-07-01' + and o_orderdate < date '1993-07-01' + interval '3' month + and exists ( + select + * + from + lineitem + where + l_orderkey = o_orderkey + and l_commitdate < l_receiptdate ) -GROUP BY - o_orderpriority -ORDER BY +group by o_orderpriority +order by + o_orderpriority; diff --git a/modules/calcite/src/test/resources/tpch/q5.sql b/modules/calcite/src/test/resources/tpch/q5.sql index 2a07e3a5de52b..68c83060dd1e7 100644 --- a/modules/calcite/src/test/resources/tpch/q5.sql +++ b/modules/calcite/src/test/resources/tpch/q5.sql @@ -1,27 +1,33 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Local Supplier Volume Query (Q5) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select n_name, - sum(l_extendedprice * (1 - l_discount)) AS revenue -FROM + sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region -WHERE - c_custkey = o_custkey - AND l_orderkey = o_orderkey - AND l_suppkey = s_suppkey - AND c_nationkey = s_nationkey - AND s_nationkey = n_nationkey - AND n_regionkey = r_regionkey - AND r_name = 'ASIA' - AND o_orderdate >= DATE '1994-01-01' - AND o_orderdate < DATE '1994-01-01' + INTERVAL '1' YEAR -GROUP BY +where + c_custkey = o_custkey + and l_orderkey = o_orderkey + and l_suppkey = s_suppkey + and c_nationkey = s_nationkey + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'ASIA' + and o_orderdate >= date '1994-01-01' + and o_orderdate < date '1994-01-01' + interval '1' year +group by n_name -ORDER BY - revenue DESC +order by + revenue desc; diff --git a/modules/calcite/src/test/resources/tpch/q6.sql b/modules/calcite/src/test/resources/tpch/q6.sql index 075cf6bd1b5f6..5506abe544c92 100644 --- a/modules/calcite/src/test/resources/tpch/q6.sql +++ b/modules/calcite/src/test/resources/tpch/q6.sql @@ -1,11 +1,12 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile -SELECT sum(l_extendedprice * l_discount) AS revenue -FROM +select + sum(l_extendedprice * l_discount) as revenue +from lineitem -WHERE - l_shipdate >= DATE '1994-01-01' - AND l_shipdate < DATE '1994-01-01' + INTERVAL '1' YEAR - AND l_discount BETWEEN decimal '0.06' - decimal '0.01' AND decimal '0.06' + decimal '0.01' - AND l_quantity < 24 +where + l_shipdate >= date '1994-01-01' + and l_shipdate < date '1994-01-01' + interval '1' year + and l_discount between decimal '0.06' - decimal '0.01' and decimal '0.06' + decimal '0.01' + and l_quantity < 24; diff --git a/modules/calcite/src/test/resources/tpch/q7.sql b/modules/calcite/src/test/resources/tpch/q7.sql index a98318a1f3654..f09b02cd40a3c 100644 --- a/modules/calcite/src/test/resources/tpch/q7.sql +++ b/modules/calcite/src/test/resources/tpch/q7.sql @@ -1,41 +1,48 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Volume Shipping Query (Q7) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select supp_nation, cust_nation, l_year, - sum(volume) AS revenue -FROM ( - SELECT - n1.n_name AS supp_nation, - n2.n_name AS cust_nation, - extract(YEAR FROM l_shipdate) AS l_year, - l_extendedprice * (1 - l_discount) AS volume - FROM - supplier, - lineitem, - orders, - customer, - nation n1, - nation n2 - WHERE - s_suppkey = l_suppkey - AND o_orderkey = l_orderkey - AND c_custkey = o_custkey - AND s_nationkey = n1.n_nationkey - AND c_nationkey = n2.n_nationkey - AND ( - (n1.n_name = 'FRANCE' AND n2.n_name = 'GERMANY') - OR (n1.n_name = 'GERMANY' AND n2.n_name = 'FRANCE') - ) - AND l_shipdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' - ) AS shipping -GROUP BY + sum(volume) as revenue +from + ( + select + n1.n_name as supp_nation, + n2.n_name as cust_nation, + extract(year from l_shipdate) as l_year, + l_extendedprice * (1 - l_discount) as volume + from + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2 + where + s_suppkey = l_suppkey + and o_orderkey = l_orderkey + and c_custkey = o_custkey + and s_nationkey = n1.n_nationkey + and c_nationkey = n2.n_nationkey + and ( + (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') + or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE') + ) + and l_shipdate between date '1995-01-01' and date '1996-12-31' + ) as shipping +group by supp_nation, cust_nation, l_year -ORDER BY +order by supp_nation, cust_nation, - l_year + l_year; diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql index 617d098c1ab1b..049332886f5b8 100644 --- a/modules/calcite/src/test/resources/tpch/q8.sql +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -1,40 +1,46 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R National Market Share Query (Q8) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select o_year, - sum(CASE - WHEN nation = 'BRAZIL' - THEN volume - ELSE 0 - END) / sum(volume) AS mkt_share -FROM ( - SELECT - extract(YEAR FROM o_orderdate) AS o_year, - l_extendedprice * (1 - l_discount) AS volume, - n2.n_name AS nation - FROM - part, - supplier, - lineitem, - orders, - customer, - nation n1, - nation n2, - region - WHERE - p_partkey = l_partkey - AND s_suppkey = l_suppkey - AND l_orderkey = o_orderkey - AND o_custkey = c_custkey - AND c_nationkey = n1.n_nationkey - AND n1.n_regionkey = r_regionkey - AND r_name = 'AMERICA' - AND s_nationkey = n2.n_nationkey - AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31' - AND p_type = 'ECONOMY ANODIZED STEEL' - ) AS all_nations -GROUP BY - o_year -ORDER BY + sum(case + when nation = 'BRAZIL' then volume + else 0 + end) / sum(volume) as mkt_share +from + ( + select + extract(year from o_orderdate) as o_year, + l_extendedprice * (1 - l_discount) as volume, + n2.n_name as nation + from + part, + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2, + region + where + p_partkey = l_partkey + and s_suppkey = l_suppkey + and l_orderkey = o_orderkey + and o_custkey = c_custkey + and c_nationkey = n1.n_nationkey + and n1.n_regionkey = r_regionkey + and r_name = 'AMERICA' + and s_nationkey = n2.n_nationkey + and o_orderdate between date '1995-01-01' and date '1996-12-31' + and p_type = 'ECONOMY ANODIZED STEEL' + ) as all_nations +group by o_year +order by + o_year; diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql index 0fdc07f1bf437..97654a234313a 100644 --- a/modules/calcite/src/test/resources/tpch/q9.sql +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -1,34 +1,41 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Product Type Profit Measure Query (Q9) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select nation, o_year, - sum(amount) AS sum_profit -FROM ( - SELECT - n_name AS nation, - extract(YEAR FROM o_orderdate) AS o_year, - l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount - FROM - part, - supplier, - lineitem, - partsupp, - orders, - nation - WHERE - s_suppkey = l_suppkey - AND ps_suppkey = l_suppkey - AND ps_partkey = l_partkey - AND p_partkey = l_partkey - AND o_orderkey = l_orderkey - AND s_nationkey = n_nationkey - AND p_name LIKE '%green%' - ) AS profit -GROUP BY + sum(amount) as sum_profit +from + ( + select + n_name as nation, + extract(year from o_orderdate) as o_year, + l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount + from + part, + supplier, + lineitem, + partsupp, + orders, + nation + where + s_suppkey = l_suppkey + and ps_suppkey = l_suppkey + and ps_partkey = l_partkey + and p_partkey = l_partkey + and o_orderkey = l_orderkey + and s_nationkey = n_nationkey + and p_name like '%green%' + ) as profit +group by nation, o_year -ORDER BY +order by nation, - o_year DESC + o_year desc; From 34bb65be16fa7fabd8be683cbd29452103fb2ce6 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 11:51:22 +0300 Subject: [PATCH 31/39] WIP. Fix plans for tpch --- .../calcite/src/test/resources/tpch/q14.sql | 28 ++++--- .../calcite/src/test/resources/tpch/q15.sql | 5 ++ .../calcite/src/test/resources/tpch/q16.sql | 41 ++++++----- .../calcite/src/test/resources/tpch/q17.sql | 32 +++++--- .../calcite/src/test/resources/tpch/q18.sql | 38 ++++++---- .../calcite/src/test/resources/tpch/q19.sql | 61 +++++++++------- .../calcite/src/test/resources/tpch/q20.sql | 61 +++++++++------- .../calcite/src/test/resources/tpch/q21.sql | 70 ++++++++++-------- .../calcite/src/test/resources/tpch/q22.sql | 73 +++++++++++-------- 9 files changed, 239 insertions(+), 170 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q14.sql b/modules/calcite/src/test/resources/tpch/q14.sql index 4971ae7c7df02..b4982f05c1f1c 100644 --- a/modules/calcite/src/test/resources/tpch/q14.sql +++ b/modules/calcite/src/test/resources/tpch/q14.sql @@ -1,15 +1,23 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Promotion Effect Query (Q14) +-- Functional Query Definition +-- Approved February 1998 -SELECT 100.00 * sum(CASE - WHEN p_type LIKE 'PROMO%' - THEN l_extendedprice * (1 - l_discount) - ELSE 0 - END) / sum(l_extendedprice * (1 - l_discount)) AS promo_revenue -FROM + +select + 100.00 * sum(case + when p_type like 'PROMO%' + then l_extendedprice * (1 - l_discount) + else 0 + end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue +from lineitem, part -WHERE - l_partkey = p_partkey - AND l_shipdate >= DATE '1995-09-01' - AND l_shipdate < DATE '1995-09-01' + INTERVAL '1' MONTH +where + l_partkey = p_partkey + and l_shipdate >= date '1995-09-01' + and l_shipdate < date '1995-09-01' + interval '1' month + diff --git a/modules/calcite/src/test/resources/tpch/q15.sql b/modules/calcite/src/test/resources/tpch/q15.sql index 0bc233adf7b4d..0b372b81090fb 100644 --- a/modules/calcite/src/test/resources/tpch/q15.sql +++ b/modules/calcite/src/test/resources/tpch/q15.sql @@ -1,5 +1,10 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Top Supplier Query (Q15) +-- Functional Query Definition +-- Approved February 1998 WITH revenue (supplier_no, total_revenue) as ( SELECT diff --git a/modules/calcite/src/test/resources/tpch/q16.sql b/modules/calcite/src/test/resources/tpch/q16.sql index 9598a8c683cc6..290d6935d9558 100644 --- a/modules/calcite/src/test/resources/tpch/q16.sql +++ b/modules/calcite/src/test/resources/tpch/q16.sql @@ -1,32 +1,39 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Parts/Supplier Relationship Query (Q16) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select p_brand, p_type, p_size, - count(DISTINCT ps_suppkey) AS supplier_cnt -FROM + count(distinct ps_suppkey) as supplier_cnt +from partsupp, part -WHERE - p_partkey = ps_partkey - AND p_brand <> 'Brand#45' - AND p_type NOT LIKE 'MEDIUM POLISHED%' - AND p_size IN (49, 14, 23, 45, 19, 3, 36, 9) - AND ps_suppkey NOT IN ( - SELECT s_suppkey - FROM +where + p_partkey = ps_partkey + and p_brand <> 'Brand#45' + and p_type not like 'MEDIUM POLISHED%' + and p_size in (49, 14, 23, 45, 19, 3, 36, 9) + and ps_suppkey not in ( + select + s_suppkey + from supplier - WHERE - s_comment LIKE '%Customer%Complaints%' + where + s_comment like '%Customer%Complaints%' ) -GROUP BY +group by p_brand, p_type, p_size -ORDER BY - supplier_cnt DESC, +order by + supplier_cnt desc, p_brand, p_type, - p_size + p_size; \ No newline at end of file diff --git a/modules/calcite/src/test/resources/tpch/q17.sql b/modules/calcite/src/test/resources/tpch/q17.sql index cd594a917843c..fff4259e2090e 100644 --- a/modules/calcite/src/test/resources/tpch/q17.sql +++ b/modules/calcite/src/test/resources/tpch/q17.sql @@ -1,18 +1,26 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Small-Quantity-Order Revenue Query (Q17) +-- Functional Query Definition +-- Approved February 1998 -SELECT sum(l_extendedprice) / 7.0 AS avg_yearly -FROM + +select + sum(l_extendedprice) / 7.0 as avg_yearly +from lineitem, part -WHERE - p_partkey = l_partkey - AND p_brand = 'Brand#23' - AND p_container = 'MED BOX' - AND l_quantity < ( - SELECT 0.2 * avg(l_quantity) - FROM +where + p_partkey = l_partkey + and p_brand = 'Brand#23' + and p_container = 'MED BOX' + and l_quantity < ( + select + 0.2 * avg(l_quantity) + from lineitem - WHERE - l_partkey = p_partkey -) + where + l_partkey = p_partkey +); diff --git a/modules/calcite/src/test/resources/tpch/q18.sql b/modules/calcite/src/test/resources/tpch/q18.sql index 5b0d0d4f44561..f4a56d45b045c 100644 --- a/modules/calcite/src/test/resources/tpch/q18.sql +++ b/modules/calcite/src/test/resources/tpch/q18.sql @@ -1,36 +1,42 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Large Volume Customer Query (Q18) +-- Function Query Definition +-- Approved February 1998 -SELECT + +select c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity) -FROM +from customer, orders, lineitem -WHERE - o_orderkey IN ( - SELECT l_orderkey - FROM - lineitem - GROUP BY +where + o_orderkey in ( + select l_orderkey - HAVING - sum(l_quantity) > 300 + from + lineitem + group by + l_orderkey having + sum(l_quantity) > 300 ) - AND c_custkey = o_custkey - AND o_orderkey = l_orderkey -GROUP BY + and c_custkey = o_custkey + and o_orderkey = l_orderkey +group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice -ORDER BY - o_totalprice DESC, +order by + o_totalprice desc, o_orderdate - LIMIT 100 + limit 100; diff --git a/modules/calcite/src/test/resources/tpch/q19.sql b/modules/calcite/src/test/resources/tpch/q19.sql index 5945c5f7cd7e7..1a9f03bda9cb2 100644 --- a/modules/calcite/src/test/resources/tpch/q19.sql +++ b/modules/calcite/src/test/resources/tpch/q19.sql @@ -1,37 +1,44 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Discounted Revenue Query (Q19) +-- Functional Query Definition +-- Approved February 1998 -SELECT sum(l_extendedprice * (1 - l_discount)) AS revenue -FROM + +select + sum(l_extendedprice* (1 - l_discount)) as revenue +from lineitem, part -WHERE +where ( - p_partkey = l_partkey - AND p_brand = 'Brand#12' - AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - AND l_quantity >= 1 AND l_quantity <= 1 + 10 - AND p_size BETWEEN 1 AND 5 - AND l_shipmode IN ('AIR', 'AIR REG') - AND l_shipinstruct = 'DELIVER IN PERSON' + p_partkey = l_partkey + and p_brand = 'Brand#12' + and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') + and l_quantity >= 1 and l_quantity <= 1 + 10 + and p_size between 1 and 5 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' ) - OR + or ( - p_partkey = l_partkey - AND p_brand = 'Brand#23' - AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - AND l_quantity >= 10 AND l_quantity <= 10 + 10 - AND p_size BETWEEN 1 AND 10 - AND l_shipmode IN ('AIR', 'AIR REG') - AND l_shipinstruct = 'DELIVER IN PERSON' + p_partkey = l_partkey + and p_brand = 'Brand#23' + and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') + and l_quantity >= 10 and l_quantity <= 10 + 10 + and p_size between 1 and 10 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' ) - OR + or ( - p_partkey = l_partkey - AND p_brand = 'Brand#34' - AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - AND l_quantity >= 20 AND l_quantity <= 20 + 10 - AND p_size BETWEEN 1 AND 15 - AND l_shipmode IN ('AIR', 'AIR REG') - AND l_shipinstruct = 'DELIVER IN PERSON' - ) + p_partkey = l_partkey + and p_brand = 'Brand#34' + and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') + and l_quantity >= 20 and l_quantity <= 20 + 10 + and p_size between 1 and 15 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ); diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql index 41ce83f04d8db..0072f13b38d88 100644 --- a/modules/calcite/src/test/resources/tpch/q20.sql +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -1,35 +1,46 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Potential Part Promotion Query (Q20) +-- Function Query Definition +-- Approved February 1998 -SELECT + +select s_name, s_address -FROM - supplier, nation -WHERE - s_suppkey IN ( - SELECT ps_suppkey - FROM +from + supplier, + nation +where + s_suppkey in ( + select + ps_suppkey + from partsupp - WHERE - ps_partkey IN ( - SELECT p_partkey - FROM + where + ps_partkey in ( + select + p_partkey + from part - WHERE - p_name LIKE 'forest%' + where + p_name like 'forest%' ) - AND ps_availqty > ( - SELECT 0.5 * sum(l_quantity) - FROM + and ps_availqty > ( + select + 0.5 * sum(l_quantity) + from lineitem - WHERE - l_partkey = ps_partkey - AND l_suppkey = ps_suppkey - AND l_shipdate >= date('1994-01-01') - AND l_shipdate < date('1994-01-01') + interval '1' YEAR - ) + where + l_partkey = ps_partkey + and l_suppkey = ps_suppkey + and l_shipdate >= date '1994-01-01' + and l_shipdate < date('1994-01-01') + interval '1' YEAR + ) ) - AND s_nationkey = n_nationkey - AND n_name = 'CANADA' -ORDER BY s_name + and s_nationkey = n_nationkey + and n_name = 'CANADA' +order by + s_name; diff --git a/modules/calcite/src/test/resources/tpch/q21.sql b/modules/calcite/src/test/resources/tpch/q21.sql index 0373124f1a6e6..f6d9c72148e80 100644 --- a/modules/calcite/src/test/resources/tpch/q21.sql +++ b/modules/calcite/src/test/resources/tpch/q21.sql @@ -1,41 +1,49 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Suppliers Who Kept Orders Waiting Query (Q21) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select s_name, - count(*) AS numwait -FROM + count(*) as numwait +from supplier, lineitem l1, orders, nation -WHERE - s_suppkey = l1.l_suppkey - AND o_orderkey = l1.l_orderkey - AND o_orderstatus = 'F' - AND l1.l_receiptdate > l1.l_commitdate - AND exists( - SELECT * - FROM - lineitem l2 - WHERE - l2.l_orderkey = l1.l_orderkey - AND l2.l_suppkey <> l1.l_suppkey - ) - AND NOT exists( - SELECT * - FROM - lineitem l3 - WHERE - l3.l_orderkey = l1.l_orderkey - AND l3.l_suppkey <> l1.l_suppkey - AND l3.l_receiptdate > l3.l_commitdate - ) - AND s_nationkey = n_nationkey - AND n_name = 'SAUDI ARABIA' -GROUP BY +where + s_suppkey = l1.l_suppkey + and o_orderkey = l1.l_orderkey + and o_orderstatus = 'F' + and l1.l_receiptdate > l1.l_commitdate + and exists ( + select + * + from + lineitem l2 + where + l2.l_orderkey = l1.l_orderkey + and l2.l_suppkey <> l1.l_suppkey +) + and not exists ( + select + * + from + lineitem l3 + where + l3.l_orderkey = l1.l_orderkey + and l3.l_suppkey <> l1.l_suppkey + and l3.l_receiptdate > l3.l_commitdate +) + and s_nationkey = n_nationkey + and n_name = 'SAUDI ARABIA' +group by s_name -ORDER BY - numwait DESC, +order by + numwait desc, s_name - LIMIT 100 + limit 100; diff --git a/modules/calcite/src/test/resources/tpch/q22.sql b/modules/calcite/src/test/resources/tpch/q22.sql index d24b936bd4218..5b03ba237571e 100644 --- a/modules/calcite/src/test/resources/tpch/q22.sql +++ b/modules/calcite/src/test/resources/tpch/q22.sql @@ -1,37 +1,46 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Global Sales Opportunity Query (Q22) +-- Functional Query Definition +-- Approved February 1998 -SELECT + +select cntrycode, - count(*) AS numcust, - sum(c_acctbal) AS totacctbal -FROM ( - SELECT - substr(c_phone, 1, 2) AS cntrycode, - c_acctbal - FROM - customer - WHERE - substr(c_phone, 1, 2) IN - ('13', '31', '23', '29', '30', '18', '17') - AND c_acctbal > ( - SELECT avg(c_acctbal) - FROM - customer - WHERE - c_acctbal > 0.00 - AND substr(c_phone, 1, 2) IN - ('13', '31', '23', '29', '30', '18', '17') - ) - AND NOT exists( - SELECT * - FROM - orders - WHERE - o_custkey = c_custkey - ) - ) AS custsale -GROUP BY - cntrycode -ORDER BY + count(*) as numcust, + sum(c_acctbal) as totacctbal +from + ( + select + substr(c_phone, 1, 2) as cntrycode, + c_acctbal + from + customer + where + substr(c_phone, 1, 2) in + ('13', '31', '23', '29', '30', '18', '17') + and c_acctbal > ( + select + avg(c_acctbal) + from + customer + where + c_acctbal > 0.00 + and substr(c_phone, 1, 2) in + ('13', '31', '23', '29', '30', '18', '17') + ) + and not exists ( + select + * + from + orders + where + o_custkey = c_custkey + ) + ) as custsale +group by cntrycode +order by + cntrycode; From e706a74d349fc545efd6315805e194bc353c58f0 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 12:18:33 +0300 Subject: [PATCH 32/39] WIP. Fix plans for tpch --- .../query/calcite/integration/tpch/q1.sql | 2 + .../query/calcite/integration/tpch/q10.sql | 2 + .../query/calcite/integration/tpch/q11.sql | 2 + .../query/calcite/integration/tpch/q12.sql | 2 + .../query/calcite/integration/tpch/q13.sql | 2 + .../query/calcite/integration/tpch/q14.sql | 2 + .../query/calcite/integration/tpch/q15.sql | 2 + .../query/calcite/integration/tpch/q16.sql | 2 + .../query/calcite/integration/tpch/q17.sql | 2 + .../query/calcite/integration/tpch/q18.sql | 2 + .../query/calcite/integration/tpch/q19.sql | 2 + .../query/calcite/integration/tpch/q2.sql | 2 + .../query/calcite/integration/tpch/q20.sql | 2 + .../query/calcite/integration/tpch/q21.sql | 2 + .../query/calcite/integration/tpch/q22.sql | 2 + .../query/calcite/integration/tpch/q3.sql | 2 + .../query/calcite/integration/tpch/q4.sql | 2 + .../query/calcite/integration/tpch/q5.sql | 2 + .../query/calcite/integration/tpch/q6.sql | 2 + .../query/calcite/integration/tpch/q7.sql | 2 + .../query/calcite/integration/tpch/q8.sql | 2 + .../query/calcite/integration/tpch/q9.sql | 2 + .../calcite/src/test/resources/tpch/q1.sql | 2 + .../calcite/src/test/resources/tpch/q10.sql | 31 ++++++----- .../calcite/src/test/resources/tpch/q11.sql | 28 +++++----- .../calcite/src/test/resources/tpch/q12.sql | 30 +++++------ .../calcite/src/test/resources/tpch/q13.sql | 2 +- .../calcite/src/test/resources/tpch/q14.sql | 11 ++-- .../calcite/src/test/resources/tpch/q15.sql | 52 +++++++++---------- .../calcite/src/test/resources/tpch/q16.sql | 24 ++++----- .../calcite/src/test/resources/tpch/q17.sql | 20 +++---- .../calcite/src/test/resources/tpch/q18.sql | 8 +-- .../calcite/src/test/resources/tpch/q19.sql | 46 ++++++++-------- .../calcite/src/test/resources/tpch/q2.sql | 3 +- .../calcite/src/test/resources/tpch/q20.sql | 26 +++++----- .../calcite/src/test/resources/tpch/q21.sql | 50 +++++++++--------- .../calcite/src/test/resources/tpch/q22.sql | 38 +++++++------- .../calcite/src/test/resources/tpch/q4.sql | 2 +- .../calcite/src/test/resources/tpch/q6.sql | 5 ++ .../calcite/src/test/resources/tpch/q8.sql | 24 ++++----- .../calcite/src/test/resources/tpch/q9.sql | 12 ++--- 41 files changed, 257 insertions(+), 201 deletions(-) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql index 42346658cbc92..8aee35e163eb8 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Pricing Summary Report Query (Q1) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql index ec70dcac290b9..1f2fc65b015de 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Returned Item Reporting Query (Q10) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql index 405adad6a4848..fa47f31646483 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Important Stock Identification Query (Q11) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql index a5460ebfb4be9..99ac554c72616 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Shipping Modes and Order Priority Query (Q12) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql index f24957fc19aad..ac1ff254db910 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Customer Distribution Query (Q13) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql index d941052728351..eb26791cab0c2 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Promotion Effect Query (Q14) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql index ed220de273d0f..1da79eb554994 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Top Supplier Query (Q15) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql index be1e33333f206..867ce4b337087 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Parts/Supplier Relationship Query (Q16) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql index b021d17b0daf5..4b39ee0cb93ae 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Small-Quantity-Order Revenue Query (Q17) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql index 18746ebd2d893..bb7e21e478d14 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Large Volume Customer Query (Q18) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql index 81bde4fb30b91..fe815627096fe 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Discounted Revenue Query (Q19) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql index 119d3ea917e29..ab572e22f23a3 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Minimum Cost Supplier Query (Q2) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql index 756c74b546739..741f95b976c60 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Potential Part Promotion Query (Q20) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql index 18bd4603ed4ca..401b76e06cec1 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Suppliers Who Kept Orders Waiting Query (Q21) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql index b2e1453637e15..fd92779e31941 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Global Sales Opportunity Query (Q22) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql index 659daaac4c474..173863e0f8da1 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Shipping Priority Query (Q3) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql index 06283ef8b22ab..2637fa614371f 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Order Priority Checking Query (Q4) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql index de87b85238c76..4c44c0985e9a6 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Local Supplier Volume Query (Q5) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql index e027a0b5b96b0..5530ccaa884a3 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Forecasting Revenue Change Query (Q6) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql index c8b495151a467..f09b02cd40a3c 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Volume Shipping Query (Q7) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql index 2437b081f33bd..c11029b13876b 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R National Market Share Query (Q8) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql index 9161e201fc523..5d5f04c3b954b 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Product Type Profit Measure Query (Q9) diff --git a/modules/calcite/src/test/resources/tpch/q1.sql b/modules/calcite/src/test/resources/tpch/q1.sql index 938f33eddc566..d08fd89c8fe5c 100644 --- a/modules/calcite/src/test/resources/tpch/q1.sql +++ b/modules/calcite/src/test/resources/tpch/q1.sql @@ -1,3 +1,5 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Pricing Summary Report Query (Q1) diff --git a/modules/calcite/src/test/resources/tpch/q10.sql b/modules/calcite/src/test/resources/tpch/q10.sql index 0ba0bb540a131..e5dad05176b32 100644 --- a/modules/calcite/src/test/resources/tpch/q10.sql +++ b/modules/calcite/src/test/resources/tpch/q10.sql @@ -1,7 +1,12 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Returned Item Reporting Query (Q10) +-- Functional Query Definition +-- Approved February 1998 -SELECT +select c_custkey, c_name, sum(l_extendedprice * (1 - l_discount)) AS revenue, @@ -10,19 +15,19 @@ SELECT c_address, c_phone, c_comment -FROM +from customer, orders, lineitem, nation -WHERE - c_custkey = o_custkey - AND l_orderkey = o_orderkey - AND o_orderdate >= DATE '1993-10-01' - AND o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH - AND l_returnflag = 'R' - AND c_nationkey = n_nationkey -GROUP BY +where + c_custkey = o_custkey + and l_orderkey = o_orderkey + and o_orderdate >= date '1993-10-01' + and o_orderdate < date '1993-10-01' + interval '3' month + and l_returnflag = 'R' + and c_nationkey = n_nationkey +group by c_custkey, c_name, c_acctbal, @@ -30,6 +35,6 @@ GROUP BY n_name, c_address, c_comment -ORDER BY - revenue DESC - LIMIT 20 +order by + revenue desc +limit 20; diff --git a/modules/calcite/src/test/resources/tpch/q11.sql b/modules/calcite/src/test/resources/tpch/q11.sql index 198574b1f8c98..508c76d2663a0 100644 --- a/modules/calcite/src/test/resources/tpch/q11.sql +++ b/modules/calcite/src/test/resources/tpch/q11.sql @@ -16,21 +16,21 @@ from nation where ps_suppkey = s_suppkey - and s_nationkey = n_nationkey - and n_name = 'GERMANY' + and s_nationkey = n_nationkey + and n_name = 'GERMANY' group by ps_partkey having - sum(ps_supplycost * ps_availqty) > ( - select - sum(ps_supplycost * ps_availqty) * 0.0001000000 - from - partsupp, - supplier, - nation - where - ps_suppkey = s_suppkey - and s_nationkey = n_nationkey - and n_name = 'GERMANY' - ) + sum(ps_supplycost * ps_availqty) > ( + select + sum(ps_supplycost * ps_availqty) * 0.0001000000 + from + partsupp, + supplier, + nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'GERMANY' + ) order by val desc; diff --git a/modules/calcite/src/test/resources/tpch/q12.sql b/modules/calcite/src/test/resources/tpch/q12.sql index 8f6a35ec549fb..819b4247b8885 100644 --- a/modules/calcite/src/test/resources/tpch/q12.sql +++ b/modules/calcite/src/test/resources/tpch/q12.sql @@ -9,27 +9,27 @@ select l_shipmode, sum(case - when o_orderpriority = '1-URGENT' - or o_orderpriority = '2-HIGH' - then 1 - else 0 - end) as high_line_count, + when o_orderpriority = '1-URGENT' + or o_orderpriority = '2-HIGH' + then 1 + else 0 + end) as high_line_count, sum(case - when o_orderpriority <> '1-URGENT' - and o_orderpriority <> '2-HIGH' - then 1 - else 0 - end) as low_line_count + when o_orderpriority <> '1-URGENT' + and o_orderpriority <> '2-HIGH' + then 1 + else 0 + end) as low_line_count from orders, lineitem where o_orderkey = l_orderkey - and l_shipmode in ('MAIL', 'SHIP') - and l_commitdate < l_receiptdate - and l_shipdate < l_commitdate - and l_receiptdate >= date '1994-01-01' - and l_receiptdate < date '1994-01-01' + interval '1' year + and l_shipmode in ('MAIL', 'SHIP') + and l_commitdate < l_receiptdate + and l_shipdate < l_commitdate + and l_receiptdate >= date '1994-01-01' + and l_receiptdate < date '1994-01-01' + interval '1' year group by l_shipmode order by diff --git a/modules/calcite/src/test/resources/tpch/q13.sql b/modules/calcite/src/test/resources/tpch/q13.sql index 986f1ee59fd50..ac1ff254db910 100644 --- a/modules/calcite/src/test/resources/tpch/q13.sql +++ b/modules/calcite/src/test/resources/tpch/q13.sql @@ -18,7 +18,7 @@ from from customer left outer join orders on c_custkey = o_custkey - and o_comment not like '%special%requests%' + and o_comment not like '%special%requests%' group by c_custkey ) as c_orders (c_custkey, c_count) diff --git a/modules/calcite/src/test/resources/tpch/q14.sql b/modules/calcite/src/test/resources/tpch/q14.sql index b4982f05c1f1c..d08bb7cd4d57c 100644 --- a/modules/calcite/src/test/resources/tpch/q14.sql +++ b/modules/calcite/src/test/resources/tpch/q14.sql @@ -9,15 +9,14 @@ select 100.00 * sum(case - when p_type like 'PROMO%' - then l_extendedprice * (1 - l_discount) - else 0 - end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue + when p_type like 'PROMO%' + then l_extendedprice * (1 - l_discount) + else 0 + end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue from lineitem, part where l_partkey = p_partkey and l_shipdate >= date '1995-09-01' - and l_shipdate < date '1995-09-01' + interval '1' month - + and l_shipdate < date '1995-09-01' + interval '1' month; diff --git a/modules/calcite/src/test/resources/tpch/q15.sql b/modules/calcite/src/test/resources/tpch/q15.sql index 0b372b81090fb..da932bd575a00 100644 --- a/modules/calcite/src/test/resources/tpch/q15.sql +++ b/modules/calcite/src/test/resources/tpch/q15.sql @@ -6,34 +6,34 @@ -- Functional Query Definition -- Approved February 1998 -WITH revenue (supplier_no, total_revenue) as ( - SELECT +with revenue (supplier_no, total_revenue) as ( + select l_suppkey, sum(l_extendedprice * (1-l_discount)) - FROM + from lineitem - WHERE - l_shipdate >= DATE '1996-01-01' - AND l_shipdate < DATE '1996-01-01' + INTERVAL '3' MONTH - GROUP BY + where + l_shipdate >= date '1996-01-01' + and l_shipdate < date '1996-01-01' + interval '3' month + group by l_suppkey ) -SELECT - s_suppkey, - s_name, - s_address, - s_phone, - total_revenue -FROM - supplier, - revenue -WHERE - s_suppkey = supplier_no - AND total_revenue = ( - SELECT - max(total_revenue) - FROM - revenue -) -ORDER BY - s_suppkey +select + s_suppkey, + s_name, + s_address, + s_phone, + total_revenue +from + supplier, + revenue +where + s_suppkey = supplier_no + and total_revenue = ( + select + max(total_revenue) + from + revenue + ) +order by + s_suppkey; diff --git a/modules/calcite/src/test/resources/tpch/q16.sql b/modules/calcite/src/test/resources/tpch/q16.sql index 290d6935d9558..867ce4b337087 100644 --- a/modules/calcite/src/test/resources/tpch/q16.sql +++ b/modules/calcite/src/test/resources/tpch/q16.sql @@ -17,17 +17,17 @@ from part where p_partkey = ps_partkey - and p_brand <> 'Brand#45' - and p_type not like 'MEDIUM POLISHED%' - and p_size in (49, 14, 23, 45, 19, 3, 36, 9) - and ps_suppkey not in ( - select - s_suppkey - from - supplier - where - s_comment like '%Customer%Complaints%' -) + and p_brand <> 'Brand#45' + and p_type not like 'MEDIUM POLISHED%' + and p_size in (49, 14, 23, 45, 19, 3, 36, 9) + and ps_suppkey not in ( + select + s_suppkey + from + supplier + where + s_comment like '%Customer%Complaints%' + ) group by p_brand, p_type, @@ -36,4 +36,4 @@ order by supplier_cnt desc, p_brand, p_type, - p_size; \ No newline at end of file + p_size; diff --git a/modules/calcite/src/test/resources/tpch/q17.sql b/modules/calcite/src/test/resources/tpch/q17.sql index fff4259e2090e..4b39ee0cb93ae 100644 --- a/modules/calcite/src/test/resources/tpch/q17.sql +++ b/modules/calcite/src/test/resources/tpch/q17.sql @@ -14,13 +14,13 @@ from part where p_partkey = l_partkey - and p_brand = 'Brand#23' - and p_container = 'MED BOX' - and l_quantity < ( - select - 0.2 * avg(l_quantity) - from - lineitem - where - l_partkey = p_partkey -); + and p_brand = 'Brand#23' + and p_container = 'MED BOX' + and l_quantity < ( + select + 0.2 * avg(l_quantity) + from + lineitem + where + l_partkey = p_partkey + ); diff --git a/modules/calcite/src/test/resources/tpch/q18.sql b/modules/calcite/src/test/resources/tpch/q18.sql index f4a56d45b045c..bb7e21e478d14 100644 --- a/modules/calcite/src/test/resources/tpch/q18.sql +++ b/modules/calcite/src/test/resources/tpch/q18.sql @@ -26,10 +26,10 @@ where lineitem group by l_orderkey having - sum(l_quantity) > 300 + sum(l_quantity) > 300 ) - and c_custkey = o_custkey - and o_orderkey = l_orderkey + and c_custkey = o_custkey + and o_orderkey = l_orderkey group by c_name, c_custkey, @@ -39,4 +39,4 @@ group by order by o_totalprice desc, o_orderdate - limit 100; +limit 100; diff --git a/modules/calcite/src/test/resources/tpch/q19.sql b/modules/calcite/src/test/resources/tpch/q19.sql index 1a9f03bda9cb2..fe815627096fe 100644 --- a/modules/calcite/src/test/resources/tpch/q19.sql +++ b/modules/calcite/src/test/resources/tpch/q19.sql @@ -15,30 +15,30 @@ from where ( p_partkey = l_partkey - and p_brand = 'Brand#12' - and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - and l_quantity >= 1 and l_quantity <= 1 + 10 - and p_size between 1 and 5 - and l_shipmode in ('AIR', 'AIR REG') - and l_shipinstruct = 'DELIVER IN PERSON' - ) - or + and p_brand = 'Brand#12' + and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') + and l_quantity >= 1 and l_quantity <= 1 + 10 + and p_size between 1 and 5 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + or ( p_partkey = l_partkey - and p_brand = 'Brand#23' - and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - and l_quantity >= 10 and l_quantity <= 10 + 10 - and p_size between 1 and 10 - and l_shipmode in ('AIR', 'AIR REG') - and l_shipinstruct = 'DELIVER IN PERSON' - ) - or + and p_brand = 'Brand#23' + and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') + and l_quantity >= 10 and l_quantity <= 10 + 10 + and p_size between 1 and 10 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + or ( p_partkey = l_partkey - and p_brand = 'Brand#34' - and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - and l_quantity >= 20 and l_quantity <= 20 + 10 - and p_size between 1 and 15 - and l_shipmode in ('AIR', 'AIR REG') - and l_shipinstruct = 'DELIVER IN PERSON' - ); + and p_brand = 'Brand#34' + and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') + and l_quantity >= 20 and l_quantity <= 20 + 10 + and p_size between 1 and 15 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ); diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index 9a8b16aa965fd..97fabfae24059 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -6,6 +6,7 @@ -- Functional Query Definition -- Approved February 1998 + select s_acctbal, s_name, @@ -49,4 +50,4 @@ order by n_name, s_name, p_partkey -limit 100; +limit 100; \ No newline at end of file diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql index 0072f13b38d88..c24d3457cef7a 100644 --- a/modules/calcite/src/test/resources/tpch/q20.sql +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -28,19 +28,19 @@ where where p_name like 'forest%' ) - and ps_availqty > ( - select - 0.5 * sum(l_quantity) - from - lineitem - where - l_partkey = ps_partkey - and l_suppkey = ps_suppkey - and l_shipdate >= date '1994-01-01' - and l_shipdate < date('1994-01-01') + interval '1' YEAR - ) + and ps_availqty > ( + select + 0.5 * sum(l_quantity) + from + lineitem + where + l_partkey = ps_partkey + and l_suppkey = ps_suppkey + and l_shipdate >= date '1994-01-01' + and l_shipdate < date('1994-01-01') + interval '1' YEAR + ) ) - and s_nationkey = n_nationkey - and n_name = 'CANADA' + and s_nationkey = n_nationkey + and n_name = 'CANADA' order by s_name; diff --git a/modules/calcite/src/test/resources/tpch/q21.sql b/modules/calcite/src/test/resources/tpch/q21.sql index f6d9c72148e80..401b76e06cec1 100644 --- a/modules/calcite/src/test/resources/tpch/q21.sql +++ b/modules/calcite/src/test/resources/tpch/q21.sql @@ -17,33 +17,33 @@ from nation where s_suppkey = l1.l_suppkey - and o_orderkey = l1.l_orderkey - and o_orderstatus = 'F' - and l1.l_receiptdate > l1.l_commitdate - and exists ( - select - * - from - lineitem l2 - where - l2.l_orderkey = l1.l_orderkey - and l2.l_suppkey <> l1.l_suppkey -) - and not exists ( - select - * - from - lineitem l3 - where - l3.l_orderkey = l1.l_orderkey - and l3.l_suppkey <> l1.l_suppkey - and l3.l_receiptdate > l3.l_commitdate -) - and s_nationkey = n_nationkey - and n_name = 'SAUDI ARABIA' + and o_orderkey = l1.l_orderkey + and o_orderstatus = 'F' + and l1.l_receiptdate > l1.l_commitdate + and exists ( + select + * + from + lineitem l2 + where + l2.l_orderkey = l1.l_orderkey + and l2.l_suppkey <> l1.l_suppkey + ) + and not exists ( + select + * + from + lineitem l3 + where + l3.l_orderkey = l1.l_orderkey + and l3.l_suppkey <> l1.l_suppkey + and l3.l_receiptdate > l3.l_commitdate + ) + and s_nationkey = n_nationkey + and n_name = 'SAUDI ARABIA' group by s_name order by numwait desc, s_name - limit 100; +limit 100; diff --git a/modules/calcite/src/test/resources/tpch/q22.sql b/modules/calcite/src/test/resources/tpch/q22.sql index 5b03ba237571e..f01c976b767dc 100644 --- a/modules/calcite/src/test/resources/tpch/q22.sql +++ b/modules/calcite/src/test/resources/tpch/q22.sql @@ -20,25 +20,25 @@ from customer where substr(c_phone, 1, 2) in - ('13', '31', '23', '29', '30', '18', '17') - and c_acctbal > ( - select - avg(c_acctbal) - from - customer - where - c_acctbal > 0.00 - and substr(c_phone, 1, 2) in - ('13', '31', '23', '29', '30', '18', '17') - ) - and not exists ( - select - * - from - orders - where - o_custkey = c_custkey - ) + ('13', '31', '23', '29', '30', '18', '17') + and c_acctbal > ( + select + avg(c_acctbal) + from + customer + where + c_acctbal > 0.00 + and substr(c_phone, 1, 2) in + ('13', '31', '23', '29', '30', '18', '17') + ) + and not exists ( + select + * + from + orders + where + o_custkey = c_custkey + ) ) as custsale group by cntrycode diff --git a/modules/calcite/src/test/resources/tpch/q4.sql b/modules/calcite/src/test/resources/tpch/q4.sql index 28a5dff80087b..041dfff812f2f 100644 --- a/modules/calcite/src/test/resources/tpch/q4.sql +++ b/modules/calcite/src/test/resources/tpch/q4.sql @@ -2,7 +2,7 @@ -- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ --- TPC-H/TPC-R Shipping Priority Query (Q4) +-- TPC-H/TPC-R Order Priority Checking Query (Q4) -- Functional Query Definition -- Approved February 1998 diff --git a/modules/calcite/src/test/resources/tpch/q6.sql b/modules/calcite/src/test/resources/tpch/q6.sql index 5506abe544c92..1ed0de3650c8e 100644 --- a/modules/calcite/src/test/resources/tpch/q6.sql +++ b/modules/calcite/src/test/resources/tpch/q6.sql @@ -1,5 +1,10 @@ -- noinspection SqlDialectInspectionForFile -- noinspection SqlNoDataSourceInspectionForFile +-- using default substitutions +-- $ID$ +-- TPC-H/TPC-R Forecasting Revenue Change Query (Q6) +-- Functional Query Definition +-- Approved February 1998 select sum(l_extendedprice * l_discount) as revenue diff --git a/modules/calcite/src/test/resources/tpch/q8.sql b/modules/calcite/src/test/resources/tpch/q8.sql index 049332886f5b8..c11029b13876b 100644 --- a/modules/calcite/src/test/resources/tpch/q8.sql +++ b/modules/calcite/src/test/resources/tpch/q8.sql @@ -10,9 +10,9 @@ select o_year, sum(case - when nation = 'BRAZIL' then volume - else 0 - end) / sum(volume) as mkt_share + when nation = 'BRAZIL' then volume + else 0 + end) / sum(volume) as mkt_share from ( select @@ -30,15 +30,15 @@ from region where p_partkey = l_partkey - and s_suppkey = l_suppkey - and l_orderkey = o_orderkey - and o_custkey = c_custkey - and c_nationkey = n1.n_nationkey - and n1.n_regionkey = r_regionkey - and r_name = 'AMERICA' - and s_nationkey = n2.n_nationkey - and o_orderdate between date '1995-01-01' and date '1996-12-31' - and p_type = 'ECONOMY ANODIZED STEEL' + and s_suppkey = l_suppkey + and l_orderkey = o_orderkey + and o_custkey = c_custkey + and c_nationkey = n1.n_nationkey + and n1.n_regionkey = r_regionkey + and r_name = 'AMERICA' + and s_nationkey = n2.n_nationkey + and o_orderdate between date '1995-01-01' and date '1996-12-31' + and p_type = 'ECONOMY ANODIZED STEEL' ) as all_nations group by o_year diff --git a/modules/calcite/src/test/resources/tpch/q9.sql b/modules/calcite/src/test/resources/tpch/q9.sql index 97654a234313a..5d5f04c3b954b 100644 --- a/modules/calcite/src/test/resources/tpch/q9.sql +++ b/modules/calcite/src/test/resources/tpch/q9.sql @@ -26,12 +26,12 @@ from nation where s_suppkey = l_suppkey - and ps_suppkey = l_suppkey - and ps_partkey = l_partkey - and p_partkey = l_partkey - and o_orderkey = l_orderkey - and s_nationkey = n_nationkey - and p_name like '%green%' + and ps_suppkey = l_suppkey + and ps_partkey = l_partkey + and p_partkey = l_partkey + and o_orderkey = l_orderkey + and s_nationkey = n_nationkey + and p_name like '%green%' ) as profit group by nation, From 179de9866e8c2601ebddbeea358d24b0bb233b70 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 12:44:30 +0300 Subject: [PATCH 33/39] WIP. Fix plans for tpch --- modules/calcite/src/test/resources/tpch/q1.sql | 1 - modules/calcite/src/test/resources/tpch/q10.sql | 6 ++++-- modules/calcite/src/test/resources/tpch/q11.plan | 4 ++-- modules/calcite/src/test/resources/tpch/q11.sql | 4 ++-- modules/calcite/src/test/resources/tpch/q12.sql | 3 ++- modules/calcite/src/test/resources/tpch/q14.sql | 2 +- modules/calcite/src/test/resources/tpch/q2.sql | 2 +- modules/calcite/src/test/resources/tpch/q20.sql | 2 +- modules/calcite/src/test/resources/tpch/q22.plan | 6 +++--- modules/calcite/src/test/resources/tpch/q22.sql | 6 +++--- modules/calcite/src/test/resources/tpch/q4.sql | 2 +- modules/calcite/src/test/resources/tpch/q5.sql | 2 +- modules/calcite/src/test/resources/tpch/q6.sql | 5 +++-- 13 files changed, 24 insertions(+), 21 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q1.sql b/modules/calcite/src/test/resources/tpch/q1.sql index d08fd89c8fe5c..8aee35e163eb8 100644 --- a/modules/calcite/src/test/resources/tpch/q1.sql +++ b/modules/calcite/src/test/resources/tpch/q1.sql @@ -5,7 +5,6 @@ -- TPC-H/TPC-R Pricing Summary Report Query (Q1) -- Functional Query Definition -- Approved February 1998 --- TODO: actual SQL query differs from Ignite3 version. Why? select diff --git a/modules/calcite/src/test/resources/tpch/q10.sql b/modules/calcite/src/test/resources/tpch/q10.sql index e5dad05176b32..1f2fc65b015de 100644 --- a/modules/calcite/src/test/resources/tpch/q10.sql +++ b/modules/calcite/src/test/resources/tpch/q10.sql @@ -6,10 +6,11 @@ -- Functional Query Definition -- Approved February 1998 + select c_custkey, c_name, - sum(l_extendedprice * (1 - l_discount)) AS revenue, + sum(l_extendedprice * (1 - l_discount)) as revenue, c_acctbal, n_name, c_address, @@ -24,7 +25,8 @@ where c_custkey = o_custkey and l_orderkey = o_orderkey and o_orderdate >= date '1993-10-01' - and o_orderdate < date '1993-10-01' + interval '3' month +-- and o_orderdate < TIMESTAMPADD(MONTH, 3, date '1993-10-01') + and o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH and l_returnflag = 'R' and c_nationkey = n_nationkey group by diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index d14f2ddd6e077..cf0f6c96b47f2 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,7 +1,7 @@ -IgniteProject(PS_PARTKEY=[$0], VAL=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = {id} +IgniteProject(PS_PARTKEY=[$0], VALUE=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=50.0, memory=35.5, io=6.0, network=58.0], id = {id} IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=25.0, cpu=49.0, memory=35.5, io=6.0, network=58.0], id = {id} IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=24.0, memory=19.5, io=3.0, network=31.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], VAL=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], VALUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.0, cpu=20.0, memory=11.5, io=3.0, network=31.0], id = {id} IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=19.0, memory=7.0, io=3.0, network=31.0], id = {id} IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.0, cpu=18.0, memory=7.0, io=3.0, network=31.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=17.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q11.sql b/modules/calcite/src/test/resources/tpch/q11.sql index 508c76d2663a0..fa47f31646483 100644 --- a/modules/calcite/src/test/resources/tpch/q11.sql +++ b/modules/calcite/src/test/resources/tpch/q11.sql @@ -9,7 +9,7 @@ select ps_partkey, - sum(ps_supplycost * ps_availqty) as val + sum(ps_supplycost * ps_availqty) as value from partsupp, supplier, @@ -33,4 +33,4 @@ group by and n_name = 'GERMANY' ) order by - val desc; + value desc; diff --git a/modules/calcite/src/test/resources/tpch/q12.sql b/modules/calcite/src/test/resources/tpch/q12.sql index 819b4247b8885..99ac554c72616 100644 --- a/modules/calcite/src/test/resources/tpch/q12.sql +++ b/modules/calcite/src/test/resources/tpch/q12.sql @@ -6,6 +6,7 @@ -- Functional Query Definition -- Approved February 1998 + select l_shipmode, sum(case @@ -29,7 +30,7 @@ where and l_commitdate < l_receiptdate and l_shipdate < l_commitdate and l_receiptdate >= date '1994-01-01' - and l_receiptdate < date '1994-01-01' + interval '1' year + and l_receiptdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') group by l_shipmode order by diff --git a/modules/calcite/src/test/resources/tpch/q14.sql b/modules/calcite/src/test/resources/tpch/q14.sql index d08bb7cd4d57c..eb26791cab0c2 100644 --- a/modules/calcite/src/test/resources/tpch/q14.sql +++ b/modules/calcite/src/test/resources/tpch/q14.sql @@ -19,4 +19,4 @@ from where l_partkey = p_partkey and l_shipdate >= date '1995-09-01' - and l_shipdate < date '1995-09-01' + interval '1' month; + and l_shipdate < TIMESTAMPADD(MONTH, 1, date '1995-09-01'); diff --git a/modules/calcite/src/test/resources/tpch/q2.sql b/modules/calcite/src/test/resources/tpch/q2.sql index 97fabfae24059..ab572e22f23a3 100644 --- a/modules/calcite/src/test/resources/tpch/q2.sql +++ b/modules/calcite/src/test/resources/tpch/q2.sql @@ -50,4 +50,4 @@ order by n_name, s_name, p_partkey -limit 100; \ No newline at end of file +limit 100; diff --git a/modules/calcite/src/test/resources/tpch/q20.sql b/modules/calcite/src/test/resources/tpch/q20.sql index c24d3457cef7a..741f95b976c60 100644 --- a/modules/calcite/src/test/resources/tpch/q20.sql +++ b/modules/calcite/src/test/resources/tpch/q20.sql @@ -37,7 +37,7 @@ where l_partkey = ps_partkey and l_suppkey = ps_suppkey and l_shipdate >= date '1994-01-01' - and l_shipdate < date('1994-01-01') + interval '1' YEAR + and l_shipdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') ) ) and s_nationkey = n_nationkey diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 2b64be7a62f10..c1042ffbcaf12 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -1,14 +1,14 @@ IgniteColocatedSortAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=13.5, cpu=25.0, memory=37.5, io=2.5, network=20.5], id = {id} IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.5, cpu=24.0, memory=23.5, io=2.5, network=20.5], id = {id} - IgniteProject(CNTRYCODE=[SUBSTR($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = {id} + IgniteProject(CNTRYCODE=[SUBSTRING($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=11.5, cpu=20.0, memory=15.5, io=2.5, network=20.5], id = {id} IgniteFilter(condition=[IS NULL($4)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.5, cpu=19.0, memory=15.5, io=2.5, network=20.5], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=9.5, cpu=15.0, memory=15.5, io=2.5, network=20.5], id = {id} IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=9.0, memory=11.0, io=2.0, network=18.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=13.0], id = {id} - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTR($t1, 1, 2), _UTF-8'13'), =(SUBSTR($t1, 1, 2), _UTF-8'31'), =(SUBSTR($t1, 1, 2), _UTF-8'23'), =(SUBSTR($t1, 1, 2), _UTF-8'29'), =(SUBSTR($t1, 1, 2), _UTF-8'30'), =(SUBSTR($t1, 1, 2), _UTF-8'18'), =(SUBSTR($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTRING($t1, 1, 2), _UTF-8'13'), =(SUBSTRING($t1, 1, 2), _UTF-8'31'), =(SUBSTRING($t1, 1, 2), _UTF-8'23'), =(SUBSTRING($t1, 1, 2), _UTF-8'29'), =(SUBSTRING($t1, 1, 2), _UTF-8'30'), =(SUBSTRING($t1, 1, 2), _UTF-8'18'), =(SUBSTRING($t1, 1, 2), _UTF-8'17'))], requiredColumns=[{2, 6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteColocatedHashAggregate(group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} - IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTR($t0, 1, 2), _UTF-8'13'), =(SUBSTR($t0, 1, 2), _UTF-8'31'), =(SUBSTR($t0, 1, 2), _UTF-8'23'), =(SUBSTR($t0, 1, 2), _UTF-8'29'), =(SUBSTR($t0, 1, 2), _UTF-8'30'), =(SUBSTR($t0, 1, 2), _UTF-8'18'), =(SUBSTR($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[AND(>($t1, 0.00), OR(=(SUBSTRING($t0, 1, 2), _UTF-8'13'), =(SUBSTRING($t0, 1, 2), _UTF-8'31'), =(SUBSTRING($t0, 1, 2), _UTF-8'23'), =(SUBSTRING($t0, 1, 2), _UTF-8'29'), =(SUBSTRING($t0, 1, 2), _UTF-8'30'), =(SUBSTRING($t0, 1, 2), _UTF-8'18'), =(SUBSTRING($t0, 1, 2), _UTF-8'17')))], rowType=[RecordType(DECIMAL(15, 2) C_ACCTBAL)], projects=[[$t1]], requiredColumns=[{6, 7}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=4.0, memory=9.0, io=1.0, network=5.0], id = {id} IgniteProject(i=[true]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($0, $cor0.C_CUSTKEY)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.C_CUSTKEY]]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=2.0, memory=5.0, io=1.0, network=5.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.sql b/modules/calcite/src/test/resources/tpch/q22.sql index f01c976b767dc..fd92779e31941 100644 --- a/modules/calcite/src/test/resources/tpch/q22.sql +++ b/modules/calcite/src/test/resources/tpch/q22.sql @@ -14,12 +14,12 @@ select from ( select - substr(c_phone, 1, 2) as cntrycode, + substring(c_phone from 1 for 2) as cntrycode, c_acctbal from customer where - substr(c_phone, 1, 2) in + substring(c_phone from 1 for 2) in ('13', '31', '23', '29', '30', '18', '17') and c_acctbal > ( select @@ -28,7 +28,7 @@ from customer where c_acctbal > 0.00 - and substr(c_phone, 1, 2) in + and substring(c_phone from 1 for 2) in ('13', '31', '23', '29', '30', '18', '17') ) and not exists ( diff --git a/modules/calcite/src/test/resources/tpch/q4.sql b/modules/calcite/src/test/resources/tpch/q4.sql index 041dfff812f2f..2637fa614371f 100644 --- a/modules/calcite/src/test/resources/tpch/q4.sql +++ b/modules/calcite/src/test/resources/tpch/q4.sql @@ -14,7 +14,7 @@ from orders where o_orderdate >= date '1993-07-01' - and o_orderdate < date '1993-07-01' + interval '3' month + and o_orderdate < TIMESTAMPADD(MONTH, 3, date '1993-07-01') and exists ( select * diff --git a/modules/calcite/src/test/resources/tpch/q5.sql b/modules/calcite/src/test/resources/tpch/q5.sql index 68c83060dd1e7..4c44c0985e9a6 100644 --- a/modules/calcite/src/test/resources/tpch/q5.sql +++ b/modules/calcite/src/test/resources/tpch/q5.sql @@ -26,7 +26,7 @@ where and n_regionkey = r_regionkey and r_name = 'ASIA' and o_orderdate >= date '1994-01-01' - and o_orderdate < date '1994-01-01' + interval '1' year + and o_orderdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') group by n_name order by diff --git a/modules/calcite/src/test/resources/tpch/q6.sql b/modules/calcite/src/test/resources/tpch/q6.sql index 1ed0de3650c8e..5530ccaa884a3 100644 --- a/modules/calcite/src/test/resources/tpch/q6.sql +++ b/modules/calcite/src/test/resources/tpch/q6.sql @@ -6,12 +6,13 @@ -- Functional Query Definition -- Approved February 1998 + select sum(l_extendedprice * l_discount) as revenue from lineitem where l_shipdate >= date '1994-01-01' - and l_shipdate < date '1994-01-01' + interval '1' year - and l_discount between decimal '0.06' - decimal '0.01' and decimal '0.06' + decimal '0.01' + and l_shipdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') + and l_discount between .06 - 0.01 and .06 + 0.01 and l_quantity < 24; From 6605cec4c5b177ee42f18379290d5fc1420f75ea Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 15:13:23 +0300 Subject: [PATCH 34/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 5 +- .../calcite/planner/tpc/PlanChecker.java | 1 + .../calcite/src/test/resources/tpch/ddl.sql | 117 ++++++++++++++++++ .../test/resources/tpch/ddl/customer_ddl.sql | 19 --- .../test/resources/tpch/ddl/lineitem_ddl.sql | 32 ----- .../test/resources/tpch/ddl/nation_ddl.sql | 15 --- .../test/resources/tpch/ddl/orders_ddl.sql | 21 ---- .../src/test/resources/tpch/ddl/part_ddl.sql | 18 --- .../test/resources/tpch/ddl/partsupp_ddl.sql | 17 --- .../test/resources/tpch/ddl/region_ddl.sql | 12 -- .../test/resources/tpch/ddl/supplier_ddl.sql | 18 --- .../calcite/src/test/resources/tpch/q12.plan | 2 +- .../calcite/src/test/resources/tpch/q19.plan | 2 +- .../src/test/resources/tpch/variant_q12.plan | 2 +- 14 files changed, 122 insertions(+), 159 deletions(-) create mode 100644 modules/calcite/src/test/resources/tpch/ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql delete mode 100644 modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index cda55b8ca0d2f..b2586dac2c544 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -76,10 +76,7 @@ public static void startAll(Class testClass) throws Exception { .setSqlFunctionClasses(AbstractTpcQueryPlannerTest.TpchUDF.class) .setSqlSchema("PUBLIC")); - TpchHelper.testFiles(testClass, "ddl") - .filter(p -> p.toString().endsWith(".sql")) - .map(p -> loadFromResource(p.toString())) - .forEach(ddl -> scriptToQueries(ddl).forEach(q -> sql(srv, q))); + scriptToQueries(loadFromResource(TpchHelper.sqlTestName(testClass) + "/ddl.sql")).forEach(q -> sql(srv, q)); } /** Run once, after all queries check. */ diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java index 9ed63bc401cf2..d8fb58f199da9 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -51,6 +51,7 @@ public PlanChecker(Class klass) throws Throwable { /** */ private static Stream createRunnersForParameters(TestClass testClass) throws IOException { Stream queries = TpchHelper.testFiles(testClass.getJavaClass()) + .filter(p -> !p.toString().endsWith("ddl.sql")) .filter(p -> p.toString().endsWith(".sql")) .sorted() .map(p -> p.getFileName().toString().replace(".sql", "")); diff --git a/modules/calcite/src/test/resources/tpch/ddl.sql b/modules/calcite/src/test/resources/tpch/ddl.sql new file mode 100644 index 0000000000000..a2aab9a323546 --- /dev/null +++ b/modules/calcite/src/test/resources/tpch/ddl.sql @@ -0,0 +1,117 @@ +CREATE TABLE IF NOT EXISTS nation( + N_NATIONKEY INTEGER, + N_NAME CHAR(25) NOT NULL, + N_REGIONKEY INTEGER NOT NULL, + N_COMMENT VARCHAR(152), + PRIMARY KEY(N_NATIONKEY)) + WITH "atomicity=transactional,cache_name=nation,value_type=nation"; +CREATE INDEX n_rk ON nation (N_REGIONKEY ASC); + +CREATE TABLE IF NOT EXISTS region( + R_REGIONKEY INTEGER, + R_NAME CHAR(25) NOT NULL, + R_COMMENT VARCHAR(152), + PRIMARY KEY(R_REGIONKEY)) + WITH "atomicity=transactional,cache_name=region,value_type=region"; + +CREATE TABLE IF NOT EXISTS part( + P_PARTKEY INTEGER, + P_NAME VARCHAR(55) NOT NULL, + P_MFGR CHAR(25) NOT NULL, + P_BRAND CHAR(10) NOT NULL, + P_TYPE VARCHAR(25) NOT NULL, + P_SIZE INTEGER NOT NULL, + P_CONTAINER CHAR(10) NOT NULL, + P_RETAILPRICE DECIMAL(15,2) NOT NULL, + P_COMMENT VARCHAR(23) NOT NULL, + PRIMARY KEY(P_PARTKEY)) + WITH "atomicity=transactional,cache_name=part,value_type=part"; + +CREATE TABLE IF NOT EXISTS supplier ( + S_SUPPKEY INTEGER, + S_NAME CHAR(25) NOT NULL, + S_ADDRESS VARCHAR(40) NOT NULL, + S_NATIONKEY INTEGER NOT NULL, + S_PHONE CHAR(15) NOT NULL, + S_ACCTBAL DECIMAL(15,2) NOT NULL, + S_COMMENT VARCHAR(101) NOT NULL, + PRIMARY KEY(S_SUPPKEY)) + WITH "atomicity=transactional,cache_name=supplier,value_type=supplier"; +CREATE INDEX s_nk ON supplier (S_NATIONKEY ASC); + +CREATE TABLE IF NOT EXISTS partsupp ( + PS_PARTKEY INTEGER NOT NULL, + PS_SUPPKEY INTEGER NOT NULL, + PS_AVAILQTY INTEGER NOT NULL, + PS_SUPPLYCOST DECIMAL(15,2) NOT NULL, + PS_COMMENT VARCHAR(199) NOT NULL, + PRIMARY KEY (PS_PARTKEY, PS_SUPPKEY) ) + WITH "atomicity=transactional,cache_name=partsupp,value_type=partsupp,key_type=partsupp_key"; +CREATE INDEX ps_pk ON partsupp (PS_PARTKEY ASC); +CREATE INDEX ps_sk_pk ON partsupp (PS_SUPPKEY ASC, PS_PARTKEY ASC); + +CREATE TABLE IF NOT EXISTS customer ( + C_CUSTKEY INTEGER, + C_NAME VARCHAR(25) NOT NULL, + C_ADDRESS VARCHAR(40) NOT NULL, + C_NATIONKEY INTEGER NOT NULL, + C_PHONE CHAR(15) NOT NULL, + C_ACCTBAL DECIMAL(15,2) NOT NULL, + C_MKTSEGMENT CHAR(10) NOT NULL, + C_COMMENT VARCHAR(117) NOT NULL, + PRIMARY KEY(C_CUSTKEY)) + WITH "atomicity=transactional,cache_name=customer,value_type=customer"; +CREATE INDEX c_nk ON customer (C_NATIONKEY ASC); + +CREATE TABLE IF NOT EXISTS orders ( + O_ORDERKEY INTEGER, + O_CUSTKEY INTEGER NOT NULL, + O_ORDERSTATUS CHAR(1) NOT NULL, + O_TOTALPRICE DECIMAL(15,2) NOT NULL, + O_ORDERDATE DATE NOT NULL, + O_ORDERPRIORITY CHAR(15) NOT NULL, + O_CLERK CHAR(15) NOT NULL, + O_SHIPPRIORITY INTEGER NOT NULL, + O_COMMENT VARCHAR(79) NOT NULL, + PRIMARY KEY(O_ORDERKEY)) + WITH "atomicity=transactional,cache_name=orders,value_type=orders"; +CREATE INDEX o_ck ON orders (O_CUSTKEY ASC); +CREATE INDEX o_od ON orders (O_ORDERDATE ASC); + +CREATE TABLE IF NOT EXISTS lineitem( + L_ORDERKEY INTEGER NOT NULL, + L_PARTKEY INTEGER NOT NULL, + L_SUPPKEY INTEGER NOT NULL, + L_LINENUMBER INTEGER NOT NULL, + L_QUANTITY DECIMAL(15,2) NOT NULL, + L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL, + L_DISCOUNT DECIMAL(15,2) NOT NULL, + L_TAX DECIMAL(15,2) NOT NULL, + L_RETURNFLAG CHAR(1) NOT NULL, + L_LINESTATUS CHAR(1) NOT NULL, + L_SHIPDATE DATE NOT NULL, + L_COMMITDATE DATE NOT NULL, + L_RECEIPTDATE DATE NOT NULL, + L_SHIPINSTRUCT CHAR(25) NOT NULL, + L_SHIPMODE CHAR(10) NOT NULL, + L_COMMENT VARCHAR(44) NOT NULL, + PRIMARY KEY(L_ORDERKEY,L_LINENUMBER)) + WITH "atomicity=transactional,cache_name=lineitem,value_type=lineitem,key_type=lineitem_key"; +CREATE INDEX l_sd ON lineitem (L_SHIPDATE ASC); +CREATE INDEX l_cd ON lineitem (L_COMMITDATE ASC); +CREATE INDEX l_rd ON lineitem (L_RECEIPTDATE ASC); +CREATE INDEX l_ok ON lineitem (L_ORDERKEY ASC); +CREATE INDEX l_pk_sk ON lineitem (L_PARTKEY ASC, L_SUPPKEY ASC); +CREATE INDEX l_sk_pk ON lineitem (L_SUPPKEY ASC, L_PARTKEY ASC); + +CREATE OR REPLACE VIEW revenue0 AS +SELECT + l_suppkey AS supplier_no, + SUM(l_extendedprice * (1 - l_discount)) AS total_revenue +FROM + lineitem +WHERE + l_shipdate >= DATE '1996-01-01' + AND l_shipdate < TIMESTAMPADD(MONTH, 3, DATE '1996-01-01') +GROUP BY + l_suppkey; diff --git a/modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql deleted file mode 100644 index 1bba80dda97ed..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/customer_ddl.sql +++ /dev/null @@ -1,19 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: SF*150,000 - -DROP TABLE IF EXISTS customer; - -CREATE TABLE customer ( - c_custkey integer NOT NULL, - c_name varchar(25) NOT NULL, - c_address varchar(40) NOT NULL, - c_nationkey integer NOT NULL, - c_phone varchar(15) NOT NULL, - c_acctbal decimal(15, 2) NOT NULL, - c_mktsegment varchar(10) NOT NULL, - c_comment varchar(117) NOT NULL, - PRIMARY KEY (c_custkey) -); - -CREATE INDEX c_nk ON customer (c_nationkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql deleted file mode 100644 index 07d937fa2ce41..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/lineitem_ddl.sql +++ /dev/null @@ -1,32 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: SF*6,000,000 - -DROP TABLE IF EXISTS lineitem; - -CREATE TABLE lineitem ( - l_orderkey integer NOT NULL, - l_partkey integer NOT NULL, - l_suppkey integer NOT NULL, - l_linenumber integer NOT NULL, - l_quantity decimal(15, 2) NOT NULL, - l_extendedprice decimal(15, 2) NOT NULL, - l_discount decimal(15, 2) NOT NULL, - l_tax decimal(15, 2) NOT NULL, - l_returnflag varchar(1) NOT NULL, - l_linestatus varchar(1) NOT NULL, - l_shipdate date NOT NULL, - l_commitdate date NOT NULL, - l_receiptdate date NOT NULL, - l_shipinstruct varchar(25) NOT NULL, - l_shipmode varchar(10) NOT NULL, - l_comment varchar(44) NOT NULL, - PRIMARY KEY (l_orderkey, l_linenumber) -); - -CREATE INDEX l_sd ON lineitem (l_shipdate ASC); -CREATE INDEX l_cd ON lineitem (l_commitdate ASC); -CREATE INDEX l_rd ON lineitem (l_receiptdate ASC); -CREATE INDEX l_ok ON lineitem (l_orderkey ASC); -CREATE INDEX l_pk_sk ON lineitem (l_partkey ASC, l_suppkey ASC); -CREATE INDEX l_sk_pk ON lineitem (l_suppkey ASC, l_partkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql deleted file mode 100644 index c24517333c88b..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/nation_ddl.sql +++ /dev/null @@ -1,15 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: 25 - -DROP TABLE IF EXISTS nation; - -CREATE TABLE nation ( - n_nationkey integer NOT NULL, - n_name varchar(25) NOT NULL, - n_regionkey integer NOT NULL, - n_comment varchar(152), - PRIMARY KEY (n_nationkey) -); - -CREATE INDEX n_rk ON nation (n_regionkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql deleted file mode 100644 index c5a855c670ab3..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/orders_ddl.sql +++ /dev/null @@ -1,21 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: SF*1,500,000 - -DROP TABLE IF EXISTS orders; - -CREATE TABLE orders ( - o_orderkey integer NOT NULL, - o_custkey integer NOT NULL, - o_orderstatus varchar(1) NOT NULL, - o_totalprice decimal(15, 2) NOT NULL, - o_orderdate date NOT NULL, - o_orderpriority varchar(15) NOT NULL, - o_clerk varchar(15) NOT NULL, - o_shippriority integer NOT NULL, - o_comment varchar(79) NOT NULL, - PRIMARY KEY (o_orderkey) -); - -CREATE INDEX o_ck ON orders (o_custkey ASC); -CREATE INDEX o_od ON orders (o_orderdate ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql deleted file mode 100644 index e0b79be7fb71f..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/part_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: SF*200,000 - -DROP TABLE IF EXISTS part; - -CREATE TABLE part ( - p_partkey integer NOT NULL, - p_name varchar(55) NOT NULL, - p_mfgr varchar(25) NOT NULL, - p_brand varchar(10) NOT NULL, - p_type varchar(25) NOT NULL, - p_size integer NOT NULL, - p_container varchar(10) NOT NULL, - p_retailprice decimal(15, 2) NOT NULL, - p_comment varchar(23) NOT NULL, - PRIMARY KEY (p_partkey) -); diff --git a/modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql deleted file mode 100644 index b93210e667323..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/partsupp_ddl.sql +++ /dev/null @@ -1,17 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: SF*800,000 - -DROP TABLE IF EXISTS partsupp; - -CREATE TABLE partsupp ( - ps_partkey integer NOT NULL, - ps_suppkey integer NOT NULL, - ps_availqty integer NOT NULL, - ps_supplycost decimal(15, 2) NOT NULL, - ps_comment varchar(199) NOT NULL, - PRIMARY KEY (ps_partkey, ps_suppkey) -); - -CREATE INDEX ps_pk ON partsupp (ps_partkey ASC); -CREATE INDEX ps_sk_pk ON partsupp (ps_suppkey ASC, ps_partkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql deleted file mode 100644 index f224ae412da7c..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/region_ddl.sql +++ /dev/null @@ -1,12 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: 5 - -DROP TABLE IF EXISTS region; - -CREATE TABLE region ( - r_regionkey integer NOT NULL, - r_name varchar(25) NOT NULL, - r_comment varchar(152), - PRIMARY KEY (r_regionkey) -); diff --git a/modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql b/modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql deleted file mode 100644 index e50ab1fe94a85..0000000000000 --- a/modules/calcite/src/test/resources/tpch/ddl/supplier_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- Size: SF*10,000 - -DROP TABLE IF EXISTS supplier; - -CREATE TABLE supplier ( - s_suppkey integer NOT NULL, - s_name varchar(25) NOT NULL, - s_address varchar(40) NOT NULL, - s_nationkey integer NOT NULL, - s_phone varchar(15) NOT NULL, - s_acctbal decimal(15, 2) NOT NULL, - s_comment varchar(101) NOT NULL, - PRIMARY KEY (s_suppkey) -); - -CREATE INDEX s_nk ON supplier (s_nationkey ASC); diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 2153b4def0009..1c0e583d63c38 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -3,7 +3,7 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index 922dbf6acbe1e..7f094c0b88092 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -2,7 +2,7 @@ IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cum IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=2.0, io=2.0, network=22.0], id = {id} IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=2.0, io=2.0, network=18.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))), OR(AND(<=($6, 5), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#12')), AND(<=($6, 10), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#23')), AND(<=($6, 15), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), =($5, _UTF-8'Brand#34'))), OR(SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2))))], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=2.0, io=2.0, network=18.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=17.0], id = {id} {ONEOF} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(=($t4, _UTF-8'DELIVER IN PERSON'), OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} ===== diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 8f5835e1086c8..d21608dd56b87 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -3,7 +3,7 @@ IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LI IgniteMapSortAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=13.0, memory=24.0, io=2.0, network=10.0], id = {id} IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=12.0, memory=10.0, io=2.0, network=10.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=11.0, memory=10.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1464737622][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=9.0, io=1.0, network=9.0], id = {id} IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=9.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[=($t0, $cor0.L_ORDERKEY)], requiredColumns=[{2, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor0.L_ORDERKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} From 6f04b0df21e66a9bd7966fee02365e9042bf68ec Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 15:17:56 +0300 Subject: [PATCH 35/39] WIP. Fix plans for tpch --- .../calcite/src/test/resources/tpch/q16.plan | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 5f74a965c60e5..d44cda893a5ae 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,20 +1,18 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=22.15, cpu=43.6, memory=58.5, io=4.0, network=52.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=21.15, cpu=39.6, memory=42.5, io=4.0, network=52.0], id = {id} - IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=38.6, memory=27.0, io=4.0, network=52.0], id = {id} - IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=27.0, io=4.0, network=52.0], id = {id} - IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=18.0, cpu=33.0, memory=27.0, io=4.0, network=52.0], id = {id} +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=20.15, cpu=41.6, memory=58.5, io=4.0, network=44.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=19.15, cpu=37.6, memory=42.5, io=4.0, network=44.0], id = {id} + IgniteProject(P_BRAND=[$5], P_TYPE=[$6], P_SIZE=[$7], PS_SUPPKEY=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18.15, cpu=36.6, memory=27.0, io=4.0, network=44.0], id = {id} + IgniteFilter(condition=[OR(=($8, 0), AND(IS NULL($1), >=($9, $8)))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=17.15, cpu=35.6, memory=27.0, io=4.0, network=44.0], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[right], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]], allowNulls=[{}]): rowcount = 1.15, cumulative cost = IgniteCost [rowCount=16.0, cpu=31.0, memory=27.0, io=4.0, network=44.0], id = {id} IgniteColocatedSortAggregate(group=[{0}], i=[LITERAL_AGG(true)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=10.0, io=1.0, network=5.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=6.0, memory=1.0, io=1.0, network=5.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=5.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=12.0, cpu=18.0, memory=17.0, io=3.0, network=47.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=10.0, cpu=16.0, memory=17.0, io=3.0, network=39.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=8.0, memory=2.0, io=2.0, network=34.0], id = {id} IgniteCorrelatedNestedLoopJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[$cor1]], variablesSet=[[1]], correlationVariables=[[$cor1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=7.0, memory=2.0, io=2.0, network=10.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-2066312456][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=9.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PART]], index=[{INDEX_CASE:_key_PK,_key_PK_proxy}], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), =($t0, $cor1.PS_PARTKEY), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], searchBounds=[[null, null, ExactBounds [bound=$cor1.PS_PARTKEY], null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(c=[$0], ck=[$0]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=6.0, memory=15.0, io=1.0, network=13.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=5.0, memory=15.0, io=1.0, network=13.0], id = {id} - IgniteReduceHashAggregate(rowType=[RecordType(BIGINT c)], group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=11.0, io=1.0, network=13.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=6.0, io=1.0, network=13.0], id = {id} - IgniteMapHashAggregate(group=[{}], c=[COUNT()]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=6.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t8, _UTF-8'%Customer%Complaints%')]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.0, cpu=4.0, memory=15.0, io=1.0, network=5.0], id = {id} + IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3.0, cpu=3.0, memory=5.0, io=1.0, network=5.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2.0, cpu=2.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteTableScan(table=[[PUBLIC, SUPPLIER]], filters=[LIKE($t1, _UTF-8'%Customer%Complaints%')], rowType=[RecordType(INTEGER S_SUPPKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.0, cpu=1.0, memory=1.0, io=1.0, network=1.0], id = {id} From 6a4806d179452820d6ae9b3484c013382a407053 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 16:15:17 +0300 Subject: [PATCH 36/39] WIP. Fix plans for tpch --- .../calcite/integration/tpch/TpchHelper.java | 8 +- .../query/calcite/integration/tpch/ddl.sql | 117 ------------------ .../query/calcite/integration/tpch/q1.sql | 30 ----- .../query/calcite/integration/tpch/q10.sql | 42 ------- .../query/calcite/integration/tpch/q11.sql | 36 ------ .../query/calcite/integration/tpch/q12.sql | 37 ------ .../query/calcite/integration/tpch/q13.sql | 29 ----- .../query/calcite/integration/tpch/q14.sql | 22 ---- .../query/calcite/integration/tpch/q16.sql | 39 ------ .../query/calcite/integration/tpch/q17.sql | 26 ---- .../query/calcite/integration/tpch/q18.sql | 42 ------- .../query/calcite/integration/tpch/q19.sql | 44 ------- .../query/calcite/integration/tpch/q2.sql | 53 -------- .../query/calcite/integration/tpch/q20.sql | 46 ------- .../query/calcite/integration/tpch/q21.sql | 49 -------- .../query/calcite/integration/tpch/q22.sql | 46 ------- .../query/calcite/integration/tpch/q3.sql | 32 ----- .../query/calcite/integration/tpch/q4.sql | 30 ----- .../query/calcite/integration/tpch/q5.sql | 33 ----- .../query/calcite/integration/tpch/q6.sql | 18 --- .../query/calcite/integration/tpch/q7.sql | 48 ------- .../query/calcite/integration/tpch/q8.sql | 46 ------- .../query/calcite/integration/tpch/q9.sql | 41 ------ 23 files changed, 6 insertions(+), 908 deletions(-) delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql delete mode 100644 modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java index e381b6d39f24a..e891b7cb7b8ae 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchHelper.java @@ -65,7 +65,7 @@ private TpchHelper() { * @param ignite Ignite instance. */ public static void createTables(Ignite ignite) { - try (InputStream inputStream = TpchHelper.class.getResourceAsStream("ddl.sql")) { + try (InputStream inputStream = TpchHelper.class.getResourceAsStream("/tpch/ddl.sql")) { if (inputStream == null) throw new RuntimeException("Failed to create TPC-H tables: ddl.sql not found in resources"); @@ -148,7 +148,11 @@ public static void generateDataset(double scale, Path datasetDir) throws IOExcep * @param queryId Query identifier. */ public static String getQuery(int queryId) { - try (InputStream inputStream = TpchHelper.class.getResourceAsStream(String.format("q%d.sql", queryId))) { + String path = queryId == 15 + ? String.format("q%d.sql", queryId) + : String.format("/tpch/q%d.sql", queryId); + + try (InputStream inputStream = TpchHelper.class.getResourceAsStream(path)) { if (inputStream == null) throw new RuntimeException(String.format("Query Q%d is not found in resources", queryId)); diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql deleted file mode 100644 index a2aab9a323546..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql +++ /dev/null @@ -1,117 +0,0 @@ -CREATE TABLE IF NOT EXISTS nation( - N_NATIONKEY INTEGER, - N_NAME CHAR(25) NOT NULL, - N_REGIONKEY INTEGER NOT NULL, - N_COMMENT VARCHAR(152), - PRIMARY KEY(N_NATIONKEY)) - WITH "atomicity=transactional,cache_name=nation,value_type=nation"; -CREATE INDEX n_rk ON nation (N_REGIONKEY ASC); - -CREATE TABLE IF NOT EXISTS region( - R_REGIONKEY INTEGER, - R_NAME CHAR(25) NOT NULL, - R_COMMENT VARCHAR(152), - PRIMARY KEY(R_REGIONKEY)) - WITH "atomicity=transactional,cache_name=region,value_type=region"; - -CREATE TABLE IF NOT EXISTS part( - P_PARTKEY INTEGER, - P_NAME VARCHAR(55) NOT NULL, - P_MFGR CHAR(25) NOT NULL, - P_BRAND CHAR(10) NOT NULL, - P_TYPE VARCHAR(25) NOT NULL, - P_SIZE INTEGER NOT NULL, - P_CONTAINER CHAR(10) NOT NULL, - P_RETAILPRICE DECIMAL(15,2) NOT NULL, - P_COMMENT VARCHAR(23) NOT NULL, - PRIMARY KEY(P_PARTKEY)) - WITH "atomicity=transactional,cache_name=part,value_type=part"; - -CREATE TABLE IF NOT EXISTS supplier ( - S_SUPPKEY INTEGER, - S_NAME CHAR(25) NOT NULL, - S_ADDRESS VARCHAR(40) NOT NULL, - S_NATIONKEY INTEGER NOT NULL, - S_PHONE CHAR(15) NOT NULL, - S_ACCTBAL DECIMAL(15,2) NOT NULL, - S_COMMENT VARCHAR(101) NOT NULL, - PRIMARY KEY(S_SUPPKEY)) - WITH "atomicity=transactional,cache_name=supplier,value_type=supplier"; -CREATE INDEX s_nk ON supplier (S_NATIONKEY ASC); - -CREATE TABLE IF NOT EXISTS partsupp ( - PS_PARTKEY INTEGER NOT NULL, - PS_SUPPKEY INTEGER NOT NULL, - PS_AVAILQTY INTEGER NOT NULL, - PS_SUPPLYCOST DECIMAL(15,2) NOT NULL, - PS_COMMENT VARCHAR(199) NOT NULL, - PRIMARY KEY (PS_PARTKEY, PS_SUPPKEY) ) - WITH "atomicity=transactional,cache_name=partsupp,value_type=partsupp,key_type=partsupp_key"; -CREATE INDEX ps_pk ON partsupp (PS_PARTKEY ASC); -CREATE INDEX ps_sk_pk ON partsupp (PS_SUPPKEY ASC, PS_PARTKEY ASC); - -CREATE TABLE IF NOT EXISTS customer ( - C_CUSTKEY INTEGER, - C_NAME VARCHAR(25) NOT NULL, - C_ADDRESS VARCHAR(40) NOT NULL, - C_NATIONKEY INTEGER NOT NULL, - C_PHONE CHAR(15) NOT NULL, - C_ACCTBAL DECIMAL(15,2) NOT NULL, - C_MKTSEGMENT CHAR(10) NOT NULL, - C_COMMENT VARCHAR(117) NOT NULL, - PRIMARY KEY(C_CUSTKEY)) - WITH "atomicity=transactional,cache_name=customer,value_type=customer"; -CREATE INDEX c_nk ON customer (C_NATIONKEY ASC); - -CREATE TABLE IF NOT EXISTS orders ( - O_ORDERKEY INTEGER, - O_CUSTKEY INTEGER NOT NULL, - O_ORDERSTATUS CHAR(1) NOT NULL, - O_TOTALPRICE DECIMAL(15,2) NOT NULL, - O_ORDERDATE DATE NOT NULL, - O_ORDERPRIORITY CHAR(15) NOT NULL, - O_CLERK CHAR(15) NOT NULL, - O_SHIPPRIORITY INTEGER NOT NULL, - O_COMMENT VARCHAR(79) NOT NULL, - PRIMARY KEY(O_ORDERKEY)) - WITH "atomicity=transactional,cache_name=orders,value_type=orders"; -CREATE INDEX o_ck ON orders (O_CUSTKEY ASC); -CREATE INDEX o_od ON orders (O_ORDERDATE ASC); - -CREATE TABLE IF NOT EXISTS lineitem( - L_ORDERKEY INTEGER NOT NULL, - L_PARTKEY INTEGER NOT NULL, - L_SUPPKEY INTEGER NOT NULL, - L_LINENUMBER INTEGER NOT NULL, - L_QUANTITY DECIMAL(15,2) NOT NULL, - L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL, - L_DISCOUNT DECIMAL(15,2) NOT NULL, - L_TAX DECIMAL(15,2) NOT NULL, - L_RETURNFLAG CHAR(1) NOT NULL, - L_LINESTATUS CHAR(1) NOT NULL, - L_SHIPDATE DATE NOT NULL, - L_COMMITDATE DATE NOT NULL, - L_RECEIPTDATE DATE NOT NULL, - L_SHIPINSTRUCT CHAR(25) NOT NULL, - L_SHIPMODE CHAR(10) NOT NULL, - L_COMMENT VARCHAR(44) NOT NULL, - PRIMARY KEY(L_ORDERKEY,L_LINENUMBER)) - WITH "atomicity=transactional,cache_name=lineitem,value_type=lineitem,key_type=lineitem_key"; -CREATE INDEX l_sd ON lineitem (L_SHIPDATE ASC); -CREATE INDEX l_cd ON lineitem (L_COMMITDATE ASC); -CREATE INDEX l_rd ON lineitem (L_RECEIPTDATE ASC); -CREATE INDEX l_ok ON lineitem (L_ORDERKEY ASC); -CREATE INDEX l_pk_sk ON lineitem (L_PARTKEY ASC, L_SUPPKEY ASC); -CREATE INDEX l_sk_pk ON lineitem (L_SUPPKEY ASC, L_PARTKEY ASC); - -CREATE OR REPLACE VIEW revenue0 AS -SELECT - l_suppkey AS supplier_no, - SUM(l_extendedprice * (1 - l_discount)) AS total_revenue -FROM - lineitem -WHERE - l_shipdate >= DATE '1996-01-01' - AND l_shipdate < TIMESTAMPADD(MONTH, 3, DATE '1996-01-01') -GROUP BY - l_suppkey; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql deleted file mode 100644 index 8aee35e163eb8..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q1.sql +++ /dev/null @@ -1,30 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Pricing Summary Report Query (Q1) --- Functional Query Definition --- Approved February 1998 - - -select - l_returnflag, - l_linestatus, - sum(l_quantity) as sum_qty, - sum(l_extendedprice) as sum_base_price, - sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, - sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, - avg(l_quantity) as avg_qty, - avg(l_extendedprice) as avg_price, - avg(l_discount) as avg_disc, - count(*) as count_order -from - lineitem -where - l_shipdate <= TIMESTAMPADD(DAY, -90, date '1998-12-01') -group by - l_returnflag, - l_linestatus -order by - l_returnflag, - l_linestatus; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql deleted file mode 100644 index 1f2fc65b015de..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q10.sql +++ /dev/null @@ -1,42 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Returned Item Reporting Query (Q10) --- Functional Query Definition --- Approved February 1998 - - -select - c_custkey, - c_name, - sum(l_extendedprice * (1 - l_discount)) as revenue, - c_acctbal, - n_name, - c_address, - c_phone, - c_comment -from - customer, - orders, - lineitem, - nation -where - c_custkey = o_custkey - and l_orderkey = o_orderkey - and o_orderdate >= date '1993-10-01' --- and o_orderdate < TIMESTAMPADD(MONTH, 3, date '1993-10-01') - and o_orderdate < DATE '1993-10-01' + INTERVAL '3' MONTH - and l_returnflag = 'R' - and c_nationkey = n_nationkey -group by - c_custkey, - c_name, - c_acctbal, - c_phone, - n_name, - c_address, - c_comment -order by - revenue desc -limit 20; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql deleted file mode 100644 index fa47f31646483..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q11.sql +++ /dev/null @@ -1,36 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Important Stock Identification Query (Q11) --- Functional Query Definition --- Approved February 1998 - - -select - ps_partkey, - sum(ps_supplycost * ps_availqty) as value -from - partsupp, - supplier, - nation -where - ps_suppkey = s_suppkey - and s_nationkey = n_nationkey - and n_name = 'GERMANY' -group by - ps_partkey having - sum(ps_supplycost * ps_availqty) > ( - select - sum(ps_supplycost * ps_availqty) * 0.0001000000 - from - partsupp, - supplier, - nation - where - ps_suppkey = s_suppkey - and s_nationkey = n_nationkey - and n_name = 'GERMANY' - ) -order by - value desc; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql deleted file mode 100644 index 99ac554c72616..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q12.sql +++ /dev/null @@ -1,37 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Shipping Modes and Order Priority Query (Q12) --- Functional Query Definition --- Approved February 1998 - - -select - l_shipmode, - sum(case - when o_orderpriority = '1-URGENT' - or o_orderpriority = '2-HIGH' - then 1 - else 0 - end) as high_line_count, - sum(case - when o_orderpriority <> '1-URGENT' - and o_orderpriority <> '2-HIGH' - then 1 - else 0 - end) as low_line_count -from - orders, - lineitem -where - o_orderkey = l_orderkey - and l_shipmode in ('MAIL', 'SHIP') - and l_commitdate < l_receiptdate - and l_shipdate < l_commitdate - and l_receiptdate >= date '1994-01-01' - and l_receiptdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') -group by - l_shipmode -order by - l_shipmode; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql deleted file mode 100644 index ac1ff254db910..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q13.sql +++ /dev/null @@ -1,29 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Customer Distribution Query (Q13) --- Functional Query Definition --- Approved February 1998 - - -select - c_count, - count(*) as custdist -from - ( - select - c_custkey, - count(o_orderkey) - from - customer left outer join orders on - c_custkey = o_custkey - and o_comment not like '%special%requests%' - group by - c_custkey - ) as c_orders (c_custkey, c_count) -group by - c_count -order by - custdist desc, - c_count desc; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql deleted file mode 100644 index eb26791cab0c2..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q14.sql +++ /dev/null @@ -1,22 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Promotion Effect Query (Q14) --- Functional Query Definition --- Approved February 1998 - - -select - 100.00 * sum(case - when p_type like 'PROMO%' - then l_extendedprice * (1 - l_discount) - else 0 - end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue -from - lineitem, - part -where - l_partkey = p_partkey - and l_shipdate >= date '1995-09-01' - and l_shipdate < TIMESTAMPADD(MONTH, 1, date '1995-09-01'); diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql deleted file mode 100644 index 867ce4b337087..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q16.sql +++ /dev/null @@ -1,39 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Parts/Supplier Relationship Query (Q16) --- Functional Query Definition --- Approved February 1998 - - -select - p_brand, - p_type, - p_size, - count(distinct ps_suppkey) as supplier_cnt -from - partsupp, - part -where - p_partkey = ps_partkey - and p_brand <> 'Brand#45' - and p_type not like 'MEDIUM POLISHED%' - and p_size in (49, 14, 23, 45, 19, 3, 36, 9) - and ps_suppkey not in ( - select - s_suppkey - from - supplier - where - s_comment like '%Customer%Complaints%' - ) -group by - p_brand, - p_type, - p_size -order by - supplier_cnt desc, - p_brand, - p_type, - p_size; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql deleted file mode 100644 index 4b39ee0cb93ae..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q17.sql +++ /dev/null @@ -1,26 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Small-Quantity-Order Revenue Query (Q17) --- Functional Query Definition --- Approved February 1998 - - -select - sum(l_extendedprice) / 7.0 as avg_yearly -from - lineitem, - part -where - p_partkey = l_partkey - and p_brand = 'Brand#23' - and p_container = 'MED BOX' - and l_quantity < ( - select - 0.2 * avg(l_quantity) - from - lineitem - where - l_partkey = p_partkey - ); diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql deleted file mode 100644 index bb7e21e478d14..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q18.sql +++ /dev/null @@ -1,42 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Large Volume Customer Query (Q18) --- Function Query Definition --- Approved February 1998 - - -select - c_name, - c_custkey, - o_orderkey, - o_orderdate, - o_totalprice, - sum(l_quantity) -from - customer, - orders, - lineitem -where - o_orderkey in ( - select - l_orderkey - from - lineitem - group by - l_orderkey having - sum(l_quantity) > 300 - ) - and c_custkey = o_custkey - and o_orderkey = l_orderkey -group by - c_name, - c_custkey, - o_orderkey, - o_orderdate, - o_totalprice -order by - o_totalprice desc, - o_orderdate -limit 100; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql deleted file mode 100644 index fe815627096fe..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q19.sql +++ /dev/null @@ -1,44 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Discounted Revenue Query (Q19) --- Functional Query Definition --- Approved February 1998 - - -select - sum(l_extendedprice* (1 - l_discount)) as revenue -from - lineitem, - part -where - ( - p_partkey = l_partkey - and p_brand = 'Brand#12' - and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - and l_quantity >= 1 and l_quantity <= 1 + 10 - and p_size between 1 and 5 - and l_shipmode in ('AIR', 'AIR REG') - and l_shipinstruct = 'DELIVER IN PERSON' - ) - or - ( - p_partkey = l_partkey - and p_brand = 'Brand#23' - and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - and l_quantity >= 10 and l_quantity <= 10 + 10 - and p_size between 1 and 10 - and l_shipmode in ('AIR', 'AIR REG') - and l_shipinstruct = 'DELIVER IN PERSON' - ) - or - ( - p_partkey = l_partkey - and p_brand = 'Brand#34' - and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - and l_quantity >= 20 and l_quantity <= 20 + 10 - and p_size between 1 and 15 - and l_shipmode in ('AIR', 'AIR REG') - and l_shipinstruct = 'DELIVER IN PERSON' - ); diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql deleted file mode 100644 index ab572e22f23a3..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q2.sql +++ /dev/null @@ -1,53 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Minimum Cost Supplier Query (Q2) --- Functional Query Definition --- Approved February 1998 - - -select - s_acctbal, - s_name, - n_name, - p_partkey, - p_mfgr, - s_address, - s_phone, - s_comment -from - part, - supplier, - partsupp, - nation, - region -where - p_partkey = ps_partkey - and s_suppkey = ps_suppkey - and p_size = 15 - and p_type like '%BRASS' - and s_nationkey = n_nationkey - and n_regionkey = r_regionkey - and r_name = 'EUROPE' - and ps_supplycost = ( - select - min(ps_supplycost) - from - partsupp, - supplier, - nation, - region - where - p_partkey = ps_partkey - and s_suppkey = ps_suppkey - and s_nationkey = n_nationkey - and n_regionkey = r_regionkey - and r_name = 'EUROPE' - ) -order by - s_acctbal desc, - n_name, - s_name, - p_partkey -limit 100; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql deleted file mode 100644 index 741f95b976c60..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q20.sql +++ /dev/null @@ -1,46 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Potential Part Promotion Query (Q20) --- Function Query Definition --- Approved February 1998 - - -select - s_name, - s_address -from - supplier, - nation -where - s_suppkey in ( - select - ps_suppkey - from - partsupp - where - ps_partkey in ( - select - p_partkey - from - part - where - p_name like 'forest%' - ) - and ps_availqty > ( - select - 0.5 * sum(l_quantity) - from - lineitem - where - l_partkey = ps_partkey - and l_suppkey = ps_suppkey - and l_shipdate >= date '1994-01-01' - and l_shipdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') - ) - ) - and s_nationkey = n_nationkey - and n_name = 'CANADA' -order by - s_name; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql deleted file mode 100644 index 401b76e06cec1..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q21.sql +++ /dev/null @@ -1,49 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Suppliers Who Kept Orders Waiting Query (Q21) --- Functional Query Definition --- Approved February 1998 - - -select - s_name, - count(*) as numwait -from - supplier, - lineitem l1, - orders, - nation -where - s_suppkey = l1.l_suppkey - and o_orderkey = l1.l_orderkey - and o_orderstatus = 'F' - and l1.l_receiptdate > l1.l_commitdate - and exists ( - select - * - from - lineitem l2 - where - l2.l_orderkey = l1.l_orderkey - and l2.l_suppkey <> l1.l_suppkey - ) - and not exists ( - select - * - from - lineitem l3 - where - l3.l_orderkey = l1.l_orderkey - and l3.l_suppkey <> l1.l_suppkey - and l3.l_receiptdate > l3.l_commitdate - ) - and s_nationkey = n_nationkey - and n_name = 'SAUDI ARABIA' -group by - s_name -order by - numwait desc, - s_name -limit 100; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql deleted file mode 100644 index fd92779e31941..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q22.sql +++ /dev/null @@ -1,46 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Global Sales Opportunity Query (Q22) --- Functional Query Definition --- Approved February 1998 - - -select - cntrycode, - count(*) as numcust, - sum(c_acctbal) as totacctbal -from - ( - select - substring(c_phone from 1 for 2) as cntrycode, - c_acctbal - from - customer - where - substring(c_phone from 1 for 2) in - ('13', '31', '23', '29', '30', '18', '17') - and c_acctbal > ( - select - avg(c_acctbal) - from - customer - where - c_acctbal > 0.00 - and substring(c_phone from 1 for 2) in - ('13', '31', '23', '29', '30', '18', '17') - ) - and not exists ( - select - * - from - orders - where - o_custkey = c_custkey - ) - ) as custsale -group by - cntrycode -order by - cntrycode; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql deleted file mode 100644 index 173863e0f8da1..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q3.sql +++ /dev/null @@ -1,32 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Shipping Priority Query (Q3) --- Functional Query Definition --- Approved February 1998 - - -select - l_orderkey, - sum(l_extendedprice * (1 - l_discount)) as revenue, - o_orderdate, - o_shippriority -from - customer, - orders, - lineitem -where - c_mktsegment = 'BUILDING' - and c_custkey = o_custkey - and l_orderkey = o_orderkey - and o_orderdate < date '1995-03-15' - and l_shipdate > date '1995-03-15' -group by - l_orderkey, - o_orderdate, - o_shippriority -order by - revenue desc, - o_orderdate -limit 10; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql deleted file mode 100644 index 2637fa614371f..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q4.sql +++ /dev/null @@ -1,30 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Order Priority Checking Query (Q4) --- Functional Query Definition --- Approved February 1998 - - -select - o_orderpriority, - count(*) as order_count -from - orders -where - o_orderdate >= date '1993-07-01' - and o_orderdate < TIMESTAMPADD(MONTH, 3, date '1993-07-01') - and exists ( - select - * - from - lineitem - where - l_orderkey = o_orderkey - and l_commitdate < l_receiptdate - ) -group by - o_orderpriority -order by - o_orderpriority; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql deleted file mode 100644 index 4c44c0985e9a6..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q5.sql +++ /dev/null @@ -1,33 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Local Supplier Volume Query (Q5) --- Functional Query Definition --- Approved February 1998 - - -select - n_name, - sum(l_extendedprice * (1 - l_discount)) as revenue -from - customer, - orders, - lineitem, - supplier, - nation, - region -where - c_custkey = o_custkey - and l_orderkey = o_orderkey - and l_suppkey = s_suppkey - and c_nationkey = s_nationkey - and s_nationkey = n_nationkey - and n_regionkey = r_regionkey - and r_name = 'ASIA' - and o_orderdate >= date '1994-01-01' - and o_orderdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') -group by - n_name -order by - revenue desc; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql deleted file mode 100644 index 5530ccaa884a3..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q6.sql +++ /dev/null @@ -1,18 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Forecasting Revenue Change Query (Q6) --- Functional Query Definition --- Approved February 1998 - - -select - sum(l_extendedprice * l_discount) as revenue -from - lineitem -where - l_shipdate >= date '1994-01-01' - and l_shipdate < TIMESTAMPADD(YEAR, 1, date '1994-01-01') - and l_discount between .06 - 0.01 and .06 + 0.01 - and l_quantity < 24; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql deleted file mode 100644 index f09b02cd40a3c..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q7.sql +++ /dev/null @@ -1,48 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Volume Shipping Query (Q7) --- Functional Query Definition --- Approved February 1998 - - -select - supp_nation, - cust_nation, - l_year, - sum(volume) as revenue -from - ( - select - n1.n_name as supp_nation, - n2.n_name as cust_nation, - extract(year from l_shipdate) as l_year, - l_extendedprice * (1 - l_discount) as volume - from - supplier, - lineitem, - orders, - customer, - nation n1, - nation n2 - where - s_suppkey = l_suppkey - and o_orderkey = l_orderkey - and c_custkey = o_custkey - and s_nationkey = n1.n_nationkey - and c_nationkey = n2.n_nationkey - and ( - (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY') - or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE') - ) - and l_shipdate between date '1995-01-01' and date '1996-12-31' - ) as shipping -group by - supp_nation, - cust_nation, - l_year -order by - supp_nation, - cust_nation, - l_year; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql deleted file mode 100644 index c11029b13876b..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q8.sql +++ /dev/null @@ -1,46 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R National Market Share Query (Q8) --- Functional Query Definition --- Approved February 1998 - - -select - o_year, - sum(case - when nation = 'BRAZIL' then volume - else 0 - end) / sum(volume) as mkt_share -from - ( - select - extract(year from o_orderdate) as o_year, - l_extendedprice * (1 - l_discount) as volume, - n2.n_name as nation - from - part, - supplier, - lineitem, - orders, - customer, - nation n1, - nation n2, - region - where - p_partkey = l_partkey - and s_suppkey = l_suppkey - and l_orderkey = o_orderkey - and o_custkey = c_custkey - and c_nationkey = n1.n_nationkey - and n1.n_regionkey = r_regionkey - and r_name = 'AMERICA' - and s_nationkey = n2.n_nationkey - and o_orderdate between date '1995-01-01' and date '1996-12-31' - and p_type = 'ECONOMY ANODIZED STEEL' - ) as all_nations -group by - o_year -order by - o_year; diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql deleted file mode 100644 index 5d5f04c3b954b..0000000000000 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q9.sql +++ /dev/null @@ -1,41 +0,0 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile --- using default substitutions --- $ID$ --- TPC-H/TPC-R Product Type Profit Measure Query (Q9) --- Functional Query Definition --- Approved February 1998 - - -select - nation, - o_year, - sum(amount) as sum_profit -from - ( - select - n_name as nation, - extract(year from o_orderdate) as o_year, - l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount - from - part, - supplier, - lineitem, - partsupp, - orders, - nation - where - s_suppkey = l_suppkey - and ps_suppkey = l_suppkey - and ps_partkey = l_partkey - and p_partkey = l_partkey - and o_orderkey = l_orderkey - and s_nationkey = n_nationkey - and p_name like '%green%' - ) as profit -group by - nation, - o_year -order by - nation, - o_year desc; From 16a4fe6b8838219fd49c28af16062695c062d217 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 16:50:57 +0300 Subject: [PATCH 37/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 81 +++++++---- .../calcite/planner/tpc/PlanChecker.java | 20 ++- .../{TpchHelper.java => PlanTemplate.java} | 130 +----------------- 3 files changed, 83 insertions(+), 148 deletions(-) rename modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/{TpchHelper.java => PlanTemplate.java} (54%) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index b2586dac2c544..13e1c17b106a2 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -17,13 +17,21 @@ package org.apache.ignite.internal.processors.query.calcite.planner.tpc; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; +import com.google.common.io.CharStreams; import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.sql.SqlExplainLevel; +import org.apache.ignite.Ignite; +import org.apache.ignite.cache.query.FieldsQueryCursor; +import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.cache.query.annotations.QuerySqlFunction; import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; import org.apache.ignite.configuration.CacheConfiguration; @@ -31,18 +39,18 @@ import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgnitionEx; import org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor; +import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchHelper; import org.apache.ignite.internal.processors.query.calcite.planner.AbstractPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.AfterPlansTest; import org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.BeforePlansTest; +import org.apache.ignite.internal.processors.query.calcite.prepare.PlanningContext; import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema; import org.apache.ignite.testframework.GridTestUtils; import org.junit.Test; import org.junit.runners.Parameterized; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.loadFromResource; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.scriptToQueries; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sql; -import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.TpchHelper.sqlTestName; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.RSRC_DIR; +import static org.apache.ignite.internal.processors.query.calcite.planner.tpc.PlanChecker.sqlTestName; /** * Abstract test class to ensure a planner generates expected plan for TPC queries. @@ -76,7 +84,7 @@ public static void startAll(Class testClass) throws Exception { .setSqlFunctionClasses(AbstractTpcQueryPlannerTest.TpchUDF.class) .setSqlSchema("PUBLIC")); - scriptToQueries(loadFromResource(TpchHelper.sqlTestName(testClass) + "/ddl.sql")).forEach(q -> sql(srv, q)); + TpchHelper.createTables(srv); } /** Run once, after all queries check. */ @@ -91,7 +99,7 @@ public static void stopAll(Class testClass) { /** Test single query. */ @Test - public void testQuery() { + public void testQuery() throws Exception { String actualPlan = queryPlan(); if (UPDATE_PLAN) { @@ -102,9 +110,9 @@ public void testQuery() { boolean match = false; - String expPlan = TpchHelper.replaceIdAndHash(loadFromResource(String.format("%s/%s.plan", sqlTestName(getClass()), queryId))); + String expPlan = PlanTemplate.replaceIdAndHash(loadFromResource(String.format("%s/%s.plan", sqlTestName(getClass()), queryId))); - for (String possiblePlan : TpchHelper.expandTemplates(expPlan)) { + for (String possiblePlan : PlanTemplate.expandTemplates(expPlan)) { if (possiblePlan.equals(actualPlan)) { match = true; @@ -127,25 +135,14 @@ public void testQuery() { } /** */ - private String queryPlan() { + private String queryPlan() throws Exception { CalciteQueryProcessor engine = (CalciteQueryProcessor)srv.context().query().defaultQueryEngine(); Map schemas = GridTestUtils.getFieldValue(engine.schemaHolder(), "igniteSchemas"); - List res = scriptToQueries(loadFromResource(sqlTestName(getClass()) + "/" + queryId + ".sql")).stream().map(qry -> { - try { - return RelOptUtil.toString(physicalPlan(plannerCtx(qry, schemas.values(), null)), SqlExplainLevel.ALL_ATTRIBUTES); - } - catch (Exception e) { - throw new RuntimeException(e); - } - }) - .map(TpchHelper::replaceIdAndHash) - .collect(Collectors.toList()); - - assertEquals(1, res.size()); + PlanningContext ctx = plannerCtx(loadFromResource(sqlTestName(getClass()) + "/" + queryId + ".sql"), schemas.values(), null); - return res.get(0); + return PlanTemplate.replaceIdAndHash(RelOptUtil.toString(physicalPlan(ctx), SqlExplainLevel.ALL_ATTRIBUTES)); } /** */ @@ -168,6 +165,21 @@ private void updatePlan(String newPlan) { } } + /** + * Execute SQL query. + * + * @param ignite Ignite. + * @param sql SQL query. + * @param params Query parameters. + */ + public static List> sql(Ignite ignite, String sql, Object... params) { + SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(params); + + try (FieldsQueryCursor> cur = ((IgniteEx)ignite).context().query().querySqlFields(qry, false)) { + return cur.getAll(); + } + } + /** */ public static class TpchUDF { /** */ @@ -176,4 +188,27 @@ public static String substr(String str, int from, int cnt) { return str.substring(from, from + cnt); } } + + /** + * Loads resource with given name as string. + * + * @param resource Name of the resource to load. + * @return Resource as string. + */ + private static String loadFromResource(String resource) { + if (resource.startsWith(RSRC_DIR)) + resource = resource.substring(RSRC_DIR.length() + 1); + + try (InputStream is = AbstractTpcQueryPlannerTest.class.getClassLoader().getResourceAsStream(resource)) { + if (is == null) + throw new IllegalArgumentException("Resource does not exist: " + resource); + + try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { + return CharStreams.toString(reader); + } + } + catch (IOException e) { + throw new UncheckedIOException("I/O operation failed: " + resource, e); + } + } } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java index d8fb58f199da9..153776e092b2a 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -23,6 +23,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -41,6 +43,9 @@ * Makes pretty test names to simplify CI tracking. */ public class PlanChecker extends Suite { + /** */ + public static final String RSRC_DIR = "./src/test/resources"; + /** * Only called reflectively. Do not use programmatically. */ @@ -50,7 +55,7 @@ public PlanChecker(Class klass) throws Throwable { /** */ private static Stream createRunnersForParameters(TestClass testClass) throws IOException { - Stream queries = TpchHelper.testFiles(testClass.getJavaClass()) + Stream queries = Files.list(Path.of(RSRC_DIR, sqlTestName(testClass.getJavaClass()))) .filter(p -> !p.toString().endsWith("ddl.sql")) .filter(p -> p.toString().endsWith(".sql")) .sorted() @@ -99,6 +104,19 @@ private void runAnnotated(Class annotation) { }); } + /** @return SQL test name. */ + public static String sqlTestName(Class klass) { + PlanChecker.PlansTest desc = klass.getAnnotation(PlanChecker.PlansTest.class); + + if (desc == null) + throw new IllegalStateException("Test class must be annotated with @" + PlanChecker.PlansTest.class.getSimpleName()); + + if (desc.name().isEmpty()) + throw new IllegalStateException("Please, set test name with the @PlanTest(name=\"XXX\")"); + + return desc.name(); + } + /** */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java similarity index 54% rename from modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java rename to modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java index be23cd08d0a16..771951cf0ea2a 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/TpchHelper.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java @@ -1,10 +1,10 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with + * 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 + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -17,13 +17,6 @@ package org.apache.ignite.internal.processors.query.calcite.planner.tpc; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UncheckedIOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -32,97 +25,15 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import com.google.common.io.CharStreams; -import org.apache.ignite.Ignite; -import org.apache.ignite.cache.query.FieldsQueryCursor; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.internal.IgniteEx; - -/** - * Provides utility methods to work with queries defined by the TPC-H benchmark. - */ -public final class TpchHelper { + +/** Contains logic to process plans templates. */ +public class PlanTemplate { /** */ private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); /** */ private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); - /** */ - private static final String RSRC_DIR = "./src/test/resources"; - - /** */ - private TpchHelper() { - } - - /** */ - public static Stream testFiles(Class klass) throws IOException { - return testFiles(klass, ""); - } - - /** */ - public static Stream testFiles(Class klass, String exdDir) throws IOException { - return Files.list(Path.of(RSRC_DIR, sqlTestName(klass), exdDir)); - } - - /** - * Loads resource with given name as string. - * - * @param resource Name of the resource to load. - * @return Resource as string. - */ - public static String loadFromResource(String resource) { - if (resource.startsWith(RSRC_DIR)) - resource = resource.substring(RSRC_DIR.length() + 1); - - try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) { - if (is == null) - throw new IllegalArgumentException("Resource does not exist: " + resource); - - try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) { - return CharStreams.toString(reader); - } - } - catch (IOException e) { - throw new UncheckedIOException("I/O operation failed: " + resource, e); - } - } - - /** @return SQL test name. */ - public static String sqlTestName(Class klass) { - PlanChecker.PlansTest desc = plansTest(klass); - - if (desc.name().isEmpty()) - throw new IllegalStateException("Please, set test name with the @PlanTest(name=\"XXX\")"); - - return desc.name(); - } - - /** @return Test description annotation. */ - private static PlanChecker.PlansTest plansTest(Class klass) { - PlanChecker.PlansTest desc = klass.getAnnotation(PlanChecker.PlansTest.class); - - if (desc == null) - throw new IllegalStateException("Test class must be annotated with @" + PlanChecker.PlansTest.class.getSimpleName()); - - return desc; - } - - /** - * Execute SQL query. - * - * @param ignite Ignite. - * @param sql SQL query. - * @param params Query parameters. - */ - public static List> sql(Ignite ignite, String sql, Object... params) { - SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(params); - - try (FieldsQueryCursor> cur = ((IgniteEx)ignite).context().query().querySqlFields(qry, false)) { - return cur.getAll(); - } - } - /** * Supported templates: *

    @@ -139,7 +50,7 @@ public static List> sql(Ignite ignite, String sql, Object... params) { */ public static List expandTemplates(String plan) { return expandOneof(plan).stream() - .flatMap(TpchHelper::expandIndexCase) + .flatMap(PlanTemplate::expandIndexCase) .collect(Collectors.toList()); } @@ -233,33 +144,4 @@ public static String replaceIdAndHash(String plan) { plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); return HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); } - - /** @return List of SQL queries from the script file. Comments are skipped. */ - public static List scriptToQueries(String sqlScript) { - List queries = new ArrayList<>(); - - Scanner sc = new Scanner(sqlScript); - - StringBuilder cur = new StringBuilder(); - - while (sc.hasNextLine()) { - String line = sc.nextLine().trim(); - - if (line.startsWith("--") || line.isEmpty()) - continue; - - cur.append(line).append('\n'); - - if (line.endsWith(";")) { - queries.add(cur.toString()); - - cur = new StringBuilder(); - } - } - - if (cur.length() > 0) - queries.add(cur.toString()); - - return queries; - } } From 035eedba6d6e6433b1e57533b497fd243e84545d Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 16:51:43 +0300 Subject: [PATCH 38/39] WIP. Fix plans for tpch --- .../internal/processors/query/calcite/integration/tpch/q15.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql index 1da79eb554994..ed220de273d0f 100644 --- a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql +++ b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql @@ -1,5 +1,3 @@ --- noinspection SqlDialectInspectionForFile --- noinspection SqlNoDataSourceInspectionForFile -- using default substitutions -- $ID$ -- TPC-H/TPC-R Top Supplier Query (Q15) From fdc78dc2698690743af1da57db066579f2c59540 Mon Sep 17 00:00:00 2001 From: Nikolay Izhikov Date: Fri, 24 Apr 2026 17:28:36 +0300 Subject: [PATCH 39/39] WIP. Fix plans for tpch --- .../tpc/AbstractTpcQueryPlannerTest.java | 33 ++++++------- .../calcite/planner/tpc/PlanChecker.java | 17 +++---- .../calcite/planner/tpc/PlanTemplate.java | 49 ++++++++++--------- 3 files changed, 50 insertions(+), 49 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java index 13e1c17b106a2..8bdc9ac7a3bfb 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/AbstractTpcQueryPlannerTest.java @@ -85,6 +85,12 @@ public static void startAll(Class testClass) throws Exception { .setSqlSchema("PUBLIC")); TpchHelper.createTables(srv); + +/* + TpchHelper.fillTables(srv, 0.01); + + TpchHelper.collectSqlStatistics(srv); +*/ } /** Run once, after all queries check. */ @@ -108,22 +114,12 @@ public void testQuery() throws Exception { return; } - boolean match = false; - - String expPlan = PlanTemplate.replaceIdAndHash(loadFromResource(String.format("%s/%s.plan", sqlTestName(getClass()), queryId))); - - for (String possiblePlan : PlanTemplate.expandTemplates(expPlan)) { - if (possiblePlan.equals(actualPlan)) { - match = true; + PlanTemplate pt = new PlanTemplate(loadFromResource(String.format("%s/%s.plan", sqlTestName(getClass()), queryId))); - break; - } - } - - if (!match) { + if (!pt.match(actualPlan)) { // This assertion will print nice diff in IDE that will help to investigate. // Test will fail anyway. - assertEquals(expPlan, actualPlan); + assertEquals(pt.template, actualPlan); assert false : "Should not happen"; } @@ -136,18 +132,19 @@ public void testQuery() throws Exception { /** */ private String queryPlan() throws Exception { - CalciteQueryProcessor engine = (CalciteQueryProcessor)srv.context().query().defaultQueryEngine(); - - Map schemas = GridTestUtils.getFieldValue(engine.schemaHolder(), "igniteSchemas"); + Map schemas = GridTestUtils.getFieldValue( + ((CalciteQueryProcessor)srv.context().query().defaultQueryEngine()).schemaHolder(), + "igniteSchemas" + ); PlanningContext ctx = plannerCtx(loadFromResource(sqlTestName(getClass()) + "/" + queryId + ".sql"), schemas.values(), null); - return PlanTemplate.replaceIdAndHash(RelOptUtil.toString(physicalPlan(ctx), SqlExplainLevel.ALL_ATTRIBUTES)); + return new PlanTemplate(RelOptUtil.toString(physicalPlan(ctx), SqlExplainLevel.ALL_ATTRIBUTES)).template; } /** */ private void updatePlan(String newPlan) { - Path targetDir = Path.of("./src/test/resources/" + sqlTestName(getClass())); + Path targetDir = Path.of(RSRC_DIR + sqlTestName(getClass())); // A targetDirectory must be specified by hand when expected plans are generated. if (targetDir == null) { diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java index 153776e092b2a..e13991f33a355 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanChecker.java @@ -44,7 +44,7 @@ */ public class PlanChecker extends Suite { /** */ - public static final String RSRC_DIR = "./src/test/resources"; + public static final String RSRC_DIR = "./src/test/resources/"; /** * Only called reflectively. Do not use programmatically. @@ -55,17 +55,16 @@ public PlanChecker(Class klass) throws Throwable { /** */ private static Stream createRunnersForParameters(TestClass testClass) throws IOException { - Stream queries = Files.list(Path.of(RSRC_DIR, sqlTestName(testClass.getJavaClass()))) - .filter(p -> !p.toString().endsWith("ddl.sql")) - .filter(p -> p.toString().endsWith(".sql")) + return Files.list(Path.of(RSRC_DIR, sqlTestName(testClass.getJavaClass()))) + .filter(p -> p.toString().endsWith(".sql") && !p.toString().endsWith("ddl.sql")) .sorted() - .map(p -> p.getFileName().toString().replace(".sql", "")); + .map(p -> { + String qryId = p.getFileName().toString().replace(".sql", ""); - return queries - .map(qryId -> new TestWithParameters("[queryId=" + qryId + "]", testClass, Collections.singletonList(qryId))) - .map(test -> { try { - return new BlockJUnit4ClassRunnerWithParameters(test); + return new BlockJUnit4ClassRunnerWithParameters( + new TestWithParameters("[queryId=" + qryId + "]", testClass, Collections.singletonList(qryId)) + ); } catch (InitializationError e) { throw new RuntimeException(e); diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java index 771951cf0ea2a..89e80a9e50771 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/tpc/PlanTemplate.java @@ -26,7 +26,18 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -/** Contains logic to process plans templates. */ +/** + * Contains logic to process plans templates. + * Supported templates: + *
      + *
    • {@code ", id = 123} replaced with the {@code ", id = {id}}
    • + *
    • {@code ", hash=123} replaced with the {@code ", hash={hash}}
    • + *
    • {@code "{INDEX_CASE:IDX1,IDX2}} expands to the plans where {INDEX_CASE....} replaced with each of the index from list.
    • + *
    • {@code "{ONEOF}} start and finish with the {@code {ONEOF}} tag. Cases separated with the line "=====". + * Creates as many plans as there are cases. + *
    • + *
    + */ public class PlanTemplate { /** */ private static final Pattern ID_PATTERN = Pattern.compile(", id = \\d+"); @@ -34,24 +45,24 @@ public class PlanTemplate { /** */ private static final Pattern HASH_PATTERN = Pattern.compile(", hash=-?\\d+]"); + /** */ + public final String template; + + /** */ + public PlanTemplate(String template) { + this.template = HASH_PATTERN.matcher(ID_PATTERN.matcher(template) + .replaceAll(", id = {id}")) + .replaceAll(", hash={hash}"); + } + /** - * Supported templates: - *
      - *
    • {@code ", id = 123} replaced with the {@code ", id = {id}}
    • - *
    • {@code ", hash=123} replaced with the {@code ", hash={hash}}
    • - *
    • {@code "{INDEX_CASE:IDX1,IDX2}} expands to the plans where {INDEX_CASE....} replaced with each of the index from list.
    • - *
    • {@code "{ONEOF}} start and finish with the {@code {ONEOF}} tag. Cases separated with the line "=====". - * Creates as many plans as there are cases. - *
    • - *
    - * - * @param plan Plan with templates - * @return Expanded (templates replaced with the possible values). One of the plan must be equal to the one created by Ignite node. + * @param actualPlan Plan to match. + * @return {@code True} if any expanded plan equals to the parameter. */ - public static List expandTemplates(String plan) { - return expandOneof(plan).stream() + public boolean match(String actualPlan) { + return expandOneof(template).stream() .flatMap(PlanTemplate::expandIndexCase) - .collect(Collectors.toList()); + .anyMatch(possiblePlan -> possiblePlan.equals(actualPlan)); } /** Expands plans. Replace {INDEX_CASE} tag with the possible indexes. */ @@ -138,10 +149,4 @@ private static List expandOneof(String plan) { // Recursively expanding next ONEOF. return res.stream().flatMap(p -> expandOneof(p.toString()).stream()).collect(Collectors.toList()); } - - /** Replaces id and hash patterns. */ - public static String replaceIdAndHash(String plan) { - plan = ID_PATTERN.matcher(plan).replaceAll(", id = {id}"); - return HASH_PATTERN.matcher(plan).replaceAll(", hash={hash}"); - } }