This is an automated email from the ASF dual-hosted git repository. agoncharuk pushed a commit to branch gg-33019 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 01379be2c57335fd08605dbfe8314e3317b03030 Author: Alexey Goncharuk <alexey.goncha...@gmail.com> AuthorDate: Wed Apr 7 15:08:38 2021 +0300 GG-33019 Introduce ProjectableFilterableTableScan for native storage integration --- modules/sql/pom.xml | 81 ++++++++++++++++++++++ .../ignite/internal/sql/rel/IgniteTableScan.java | 36 ++++++++++ .../sql/rel/ProjectableFilterableTableScan.java | 66 ++++++++++++++++++ parent/pom.xml | 19 +++++ pom.xml | 1 + 5 files changed, 203 insertions(+) diff --git a/modules/sql/pom.xml b/modules/sql/pom.xml new file mode 100644 index 0000000..d9a245f --- /dev/null +++ b/modules/sql/pom.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-parent</artifactId> + <version>1</version> + <relativePath>../../parent/pom.xml</relativePath> + </parent> + + <artifactId>ignite-sql</artifactId> + <version>3.0.0-SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-api</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-schema</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.jetbrains</groupId> + <artifactId>annotations</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-core</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-babel</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-linq4j</artifactId> + </dependency> + + <!-- Test dependencies --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/modules/sql/src/main/java/org/apache/ignite/internal/sql/rel/IgniteTableScan.java b/modules/sql/src/main/java/org/apache/ignite/internal/sql/rel/IgniteTableScan.java new file mode 100644 index 0000000..6609cb0 --- /dev/null +++ b/modules/sql/src/main/java/org/apache/ignite/internal/sql/rel/IgniteTableScan.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.sql.rel; + +import java.util.List; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.util.ImmutableBitSet; +import org.jetbrains.annotations.Nullable; + +/** + * + */ +public class IgniteTableScan extends ProjectableFilterableTableScan { + public IgniteTableScan( + @Nullable List<RexNode> proj, + @Nullable RexNode cond, + @Nullable ImmutableBitSet reqColumns + ) { + super(proj, cond, reqColumns); + } +} diff --git a/modules/sql/src/main/java/org/apache/ignite/internal/sql/rel/ProjectableFilterableTableScan.java b/modules/sql/src/main/java/org/apache/ignite/internal/sql/rel/ProjectableFilterableTableScan.java new file mode 100644 index 0000000..bd876f0 --- /dev/null +++ b/modules/sql/src/main/java/org/apache/ignite/internal/sql/rel/ProjectableFilterableTableScan.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.sql.rel; + +import java.util.List; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.util.ImmutableBitSet; +import org.jetbrains.annotations.Nullable; + +/** Scan with projects and filters. */ +public abstract class ProjectableFilterableTableScan { + /** Filters. */ + protected final RexNode condition; + + /** Projects. */ + protected final List<RexNode> projects; + + /** Participating columns. */ + protected final ImmutableBitSet requiredColumns; + + /** */ + protected ProjectableFilterableTableScan( + @Nullable List<RexNode> proj, + @Nullable RexNode cond, + @Nullable ImmutableBitSet reqColumns + ) { + projects = proj; + condition = cond; + requiredColumns = reqColumns; + } + + /** @return Projections. */ + public List<RexNode> projects() { + return projects; + } + + /** @return Rex condition. */ + public RexNode condition() { + return condition; + } + + /** @return Participating columns. */ + public ImmutableBitSet requiredColumns() { + return requiredColumns; + } + + /** */ + public boolean simple() { + return condition == null && projects == null && requiredColumns == null; + } +} diff --git a/parent/pom.xml b/parent/pom.xml index 2f32870..478fdcc 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -74,6 +74,7 @@ <typesafe.version>1.4.1</typesafe.version> <hamcrest.version>2.2</hamcrest.version> <scalecube.version>2.6.6</scalecube.version> + <calcite.version>1.26.0</calcite.version> <!-- Plugins versions --> <apache.rat.plugin.version>0.13</apache.rat.plugin.version> @@ -305,6 +306,24 @@ <artifactId>netty-codec-http</artifactId> <version>${netty.version}</version> </dependency> + + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-core</artifactId> + <version>${calcite.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-babel</artifactId> + <version>${calcite.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-linq4j</artifactId> + <version>${calcite.version}</version> + </dependency> </dependencies> </dependencyManagement> diff --git a/pom.xml b/pom.xml index 4e87920..248010d 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,7 @@ <module>modules/rest</module> <module>modules/runner</module> <module>modules/schema</module> + <module>modules/sql</module> <module>modules/table</module> </modules>