This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 300742dfdb3 Remove useless FederationDatabaseMetaData, 
FederationSchemaMetaData and FederationTable (#19832)
300742dfdb3 is described below

commit 300742dfdb3df62b92b6cdd13482c8d45d45ea58
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Wed Aug 3 15:27:39 2022 +0800

    Remove useless FederationDatabaseMetaData, FederationSchemaMetaData and 
FederationTable (#19832)
---
 .../advanced/AdvancedFederationExecutor.java       |   2 +-
 .../advanced/resultset/FederationResultSet.java    |   2 +-
 .../resultset/FederationResultSetMetaData.java     |   2 +-
 .../original/OriginalFederationExecutor.java       |   2 +-
 .../table/FilterableTableScanExecutor.java         |  20 ++--
 .../optimizer/executor/TableScanExecutor.java}     |  29 +++---
 .../executor/TableScanExecutorContext.java}        |   6 +-
 .../metadata/FederationDatabaseMetaData.java       | 110 ---------------------
 .../optimizer/metadata/FederationMetaData.java     |  51 ----------
 .../metadata/FederationSchemaMetaData.java         |  62 ------------
 .../metadata/FederationTableMetaData.java          |  69 -------------
 .../metadata/calcite/FederationDatabase.java       |  48 ---------
 .../metadata/calcite/FederationSchema.java         |  48 ---------
 .../metadata/calcite/FederationTable.java          |  49 ---------
 .../metadata/filter}/FilterableDatabase.java       |   9 +-
 .../metadata/filter}/FilterableSchema.java         |  13 ++-
 .../metadata/filter}/FilterableTable.java          |  11 ++-
 .../metadata/statistic/FederationStatistic.java}   |   4 +-
 .../optimizer/ShardingSphereOptimizerTest.java     |   5 +-
 .../metadata/FederationDatabaseMetaDataTest.java   |  90 -----------------
 20 files changed, 49 insertions(+), 583 deletions(-)

diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/AdvancedFederationExecutor.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/AdvancedFederationExecutor.java
index d3a0c89e6f7..c5a0fa70a16 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/AdvancedFederationExecutor.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/AdvancedFederationExecutor.java
@@ -43,7 +43,7 @@ import 
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecuti
 import org.apache.shardingsphere.infra.federation.executor.FederationContext;
 import org.apache.shardingsphere.infra.federation.executor.FederationExecutor;
 import 
org.apache.shardingsphere.infra.federation.executor.advanced.resultset.FederationResultSet;
-import 
org.apache.shardingsphere.infra.federation.executor.original.schema.FilterableSchema;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.filter.FilterableSchema;
 import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTableScanExecutor;
 import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTableScanExecutorContext;
 import 
org.apache.shardingsphere.infra.federation.optimizer.ShardingSphereOptimizer;
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSet.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSet.java
index 9cfed743252..2f090a0936f 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSet.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSet.java
@@ -23,7 +23,7 @@ import 
org.apache.shardingsphere.infra.binder.segment.select.projection.Projecti
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.util.ResultSetUtil;
-import 
org.apache.shardingsphere.infra.federation.executor.original.schema.FilterableSchema;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.filter.FilterableSchema;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
 
 import java.io.InputStream;
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSetMetaData.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSetMetaData.java
index fbd2f44880d..377e0e153eb 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSetMetaData.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/advanced/resultset/FederationResultSetMetaData.java
@@ -25,7 +25,7 @@ import 
org.apache.shardingsphere.infra.binder.segment.select.projection.Projecti
 import 
org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
 import 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
-import 
org.apache.shardingsphere.infra.federation.executor.original.schema.FilterableSchema;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.filter.FilterableSchema;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
 
 import java.sql.ResultSetMetaData;
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/OriginalFederationExecutor.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/OriginalFederationExecutor.java
index 8dc4901bc34..19e8aa0f759 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/OriginalFederationExecutor.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/OriginalFederationExecutor.java
@@ -28,7 +28,7 @@ import 
org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult
 import 
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine;
 import org.apache.shardingsphere.infra.federation.executor.FederationContext;
 import org.apache.shardingsphere.infra.federation.executor.FederationExecutor;
-import 
org.apache.shardingsphere.infra.federation.executor.original.database.FilterableDatabase;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.filter.FilterableDatabase;
 import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTableScanExecutor;
 import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTableScanExecutorContext;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
index 81a31241847..4ccc74a5eaa 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanExecutor.java
@@ -59,9 +59,11 @@ import 
org.apache.shardingsphere.infra.federation.executor.FederationContext;
 import 
org.apache.shardingsphere.infra.federation.executor.original.SQLDialectFactory;
 import 
org.apache.shardingsphere.infra.federation.executor.original.row.EmptyRowEnumerator;
 import 
org.apache.shardingsphere.infra.federation.executor.original.row.FilterableRowEnumerator;
-import 
org.apache.shardingsphere.infra.federation.executor.original.schema.FilterableSchema;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.planner.OptimizerPlannerContextFactory;
+import 
org.apache.shardingsphere.infra.federation.optimizer.executor.TableScanExecutorContext;
+import 
org.apache.shardingsphere.infra.federation.optimizer.executor.TableScanExecutor;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.filter.FilterableSchema;
 import 
org.apache.shardingsphere.infra.federation.optimizer.planner.QueryOptimizePlannerFactory;
 import org.apache.shardingsphere.infra.merge.MergeEngine;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
@@ -89,7 +91,7 @@ import java.util.stream.Collectors;
  * Filterable table scan executor.
  */
 @RequiredArgsConstructor
-public final class FilterableTableScanExecutor {
+public final class FilterableTableScanExecutor implements TableScanExecutor {
     
     private final DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> 
prepareEngine;
     
@@ -105,14 +107,8 @@ public final class FilterableTableScanExecutor {
     
     private final EventBusContext eventBusContext;
     
-    /**
-     * Execute.
-     *
-     * @param table table meta data
-     * @param scanContext filterable table scan context
-     * @return query results
-     */
-    public Enumerable<Object[]> execute(final ShardingSphereTable table, final 
FilterableTableScanContext scanContext) {
+    @Override
+    public Enumerable<Object[]> execute(final ShardingSphereTable table, final 
TableScanExecutorContext scanContext) {
         String databaseName = executorContext.getDatabaseName();
         String schemaName = executorContext.getSchemaName();
         DatabaseType databaseType = 
DatabaseTypeEngine.getTrunkDatabaseType(optimizerContext.getParserContexts().get(databaseName).getDatabaseType().getType());
@@ -169,7 +165,7 @@ public final class FilterableTableScanExecutor {
         return result;
     }
     
-    private SqlString createSQLString(final ShardingSphereTable table, final 
FilterableTableScanContext scanContext, final SqlDialect sqlDialect) {
+    private SqlString createSQLString(final ShardingSphereTable table, final 
TableScanExecutorContext scanContext, final SqlDialect sqlDialect) {
         return new 
RelToSqlConverter(sqlDialect).visitRoot(createRelNode(table, 
scanContext)).asStatement().toSqlString(sqlDialect);
     }
     
@@ -192,7 +188,7 @@ public final class FilterableTableScanExecutor {
         }
     }
     
-    private RelNode createRelNode(final ShardingSphereTable table, final 
FilterableTableScanContext scanContext) {
+    private RelNode createRelNode(final ShardingSphereTable table, final 
TableScanExecutorContext scanContext) {
         String databaseName = executorContext.getDatabaseName();
         String schemaName = executorContext.getSchemaName();
         CalciteConnectionConfig connectionConfig = new 
CalciteConnectionConfigImpl(OptimizerPlannerContextFactory.createConnectionProperties());
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanContext.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/executor/TableScanExecutor.java
similarity index 60%
copy from 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanContext.java
copy to 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/executor/TableScanExecutor.java
index 0bee86c8c8d..3a6cbf68a4a 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanContext.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/executor/TableScanExecutor.java
@@ -15,25 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.federation.executor.original.table;
+package org.apache.shardingsphere.infra.federation.optimizer.executor;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.calcite.DataContext;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.List;
+import org.apache.calcite.linq4j.Enumerable;
+import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
 
 /**
- * Filterable table scan context.
+ * Table scan executor.
  */
-@RequiredArgsConstructor
-@Getter
-public final class FilterableTableScanContext {
-    
-    private final DataContext root;
-    
-    private final List<RexNode> filters;
+public interface TableScanExecutor {
     
-    private final int[] projects;
+    /**
+     * Execute.
+     *
+     * @param table table meta data
+     * @param scanContext filterable table scan context
+     * @return query results
+     */
+    Enumerable<Object[]> execute(ShardingSphereTable table, 
TableScanExecutorContext scanContext);
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanContext.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/executor/TableScanExecutorContext.java
similarity index 87%
rename from 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanContext.java
rename to 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/executor/TableScanExecutorContext.java
index 0bee86c8c8d..bfb5b423544 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTableScanContext.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/executor/TableScanExecutorContext.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.federation.executor.original.table;
+package org.apache.shardingsphere.infra.federation.optimizer.executor;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
@@ -25,11 +25,11 @@ import org.apache.calcite.rex.RexNode;
 import java.util.List;
 
 /**
- * Filterable table scan context.
+ * Table scan executor context.
  */
 @RequiredArgsConstructor
 @Getter
-public final class FilterableTableScanContext {
+public final class TableScanExecutorContext {
     
     private final DataContext root;
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationDatabaseMetaData.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationDatabaseMetaData.java
deleted file mode 100644
index 031911c10da..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationDatabaseMetaData.java
+++ /dev/null
@@ -1,110 +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.shardingsphere.infra.federation.optimizer.metadata;
-
-import lombok.Getter;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Federation database meta data.
- */
-@Getter
-public final class FederationDatabaseMetaData {
-    
-    private final String name;
-    
-    private final Map<String, FederationSchemaMetaData> schemas;
-    
-    public FederationDatabaseMetaData(final String name, final Map<String, 
ShardingSphereSchema> schemas) {
-        this.name = name;
-        this.schemas = new ConcurrentHashMap<>(schemas.size(), 1);
-        for (Entry<String, ShardingSphereSchema> entry : schemas.entrySet()) {
-            this.schemas.put(entry.getKey().toLowerCase(), new 
FederationSchemaMetaData(entry.getKey(), entry.getValue().getTables()));
-        }
-    }
-    
-    /**
-     * Put schema meta data.
-     *
-     * @param schemaName schema name
-     * @param schemaMetaData schema metadata
-     */
-    public void putSchemaMetadata(final String schemaName, final 
FederationSchemaMetaData schemaMetaData) {
-        schemas.put(schemaName.toLowerCase(), schemaMetaData);
-    }
-    
-    /**
-     * Judge contains schema from database or not.
-     *
-     * @param schemaName schema name
-     * @return contains schema from database or not
-     */
-    public boolean containsSchemaMetadata(final String schemaName) {
-        return schemas.containsKey(schemaName.toLowerCase());
-    }
-    
-    /**
-     * Put table.
-     *
-     * @param schemaName schema name
-     * @param table table
-     */
-    public void putTable(final String schemaName, final ShardingSphereTable 
table) {
-        FederationSchemaMetaData schemaMetaData = 
schemas.computeIfAbsent(schemaName.toLowerCase(), key -> new 
FederationSchemaMetaData(schemaName, new LinkedHashMap<>()));
-        schemaMetaData.put(table);
-    }
-    
-    /**
-     * Remove schema meta data.
-     *
-     * @param schemaName schema name
-     */
-    public void removeSchemaMetadata(final String schemaName) {
-        schemas.remove(schemaName.toLowerCase());
-    }
-    
-    /**
-     * Remove table meta data.
-     *
-     * @param schemaName schema name
-     * @param tableName table name
-     */
-    public void removeTableMetadata(final String schemaName, final String 
tableName) {
-        if (containsSchemaMetadata(schemaName)) {
-            
schemas.get(schemaName.toLowerCase()).remove(tableName.toLowerCase());
-        }
-    }
-    
-    /**
-     * Get table meta data.
-     *
-     * @param schemaName schema name
-     *
-     * @return FederationSchemaMetaData schema meta data
-     */
-    public Optional<FederationSchemaMetaData> getSchemaMetadata(final String 
schemaName) {
-        return Optional.ofNullable(schemas.get(schemaName.toLowerCase()));
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationMetaData.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationMetaData.java
deleted file mode 100644
index 5f81ec54efa..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationMetaData.java
+++ /dev/null
@@ -1,51 +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.shardingsphere.infra.federation.optimizer.metadata;
-
-import lombok.Getter;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Federation meta data.
- */
-@Getter
-public final class FederationMetaData {
-    
-    private final Map<String, FederationDatabaseMetaData> databases;
-    
-    public FederationMetaData(final Map<String, ShardingSphereDatabase> 
databases) {
-        this.databases = new ConcurrentHashMap<>(databases.size(), 1);
-        for (Entry<String, ShardingSphereDatabase> entry : 
databases.entrySet()) {
-            this.databases.put(entry.getKey().toLowerCase(), new 
FederationDatabaseMetaData(entry.getKey(), entry.getValue().getSchemas()));
-        }
-    }
-    
-    /**
-     * Get database.
-     *
-     * @param databaseName database name
-     * @return database
-     */
-    public FederationDatabaseMetaData getDatabase(final String databaseName) {
-        return databases.get(databaseName.toLowerCase());
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationSchemaMetaData.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationSchemaMetaData.java
deleted file mode 100644
index a80bff3e0e6..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationSchemaMetaData.java
+++ /dev/null
@@ -1,62 +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.shardingsphere.infra.federation.optimizer.metadata;
-
-import lombok.Getter;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
-
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Federation schema meta data.
- */
-@Getter
-public final class FederationSchemaMetaData {
-    
-    private final String name;
-    
-    private final Map<String, FederationTableMetaData> tables;
-    
-    public FederationSchemaMetaData(final String name, final Map<String, 
ShardingSphereTable> metaData) {
-        this.name = name;
-        this.tables = new ConcurrentHashMap<>(metaData.size(), 1);
-        for (Entry<String, ShardingSphereTable> entry : metaData.entrySet()) {
-            tables.put(entry.getKey().toLowerCase(), new 
FederationTableMetaData(entry.getValue().getName(), entry.getValue()));
-        }
-    }
-    
-    /**
-     * Add table meta data.
-     * 
-     * @param metaData table meta data to be updated
-     */
-    public void put(final ShardingSphereTable metaData) {
-        tables.put(metaData.getName().toLowerCase(), new 
FederationTableMetaData(metaData.getName(), metaData));
-    }
-    
-    /**
-     * Remove table meta data.
-     * 
-     * @param tableName table name to be removed
-     */
-    public void remove(final String tableName) {
-        tables.remove(tableName.toLowerCase());
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationTableMetaData.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationTableMetaData.java
deleted file mode 100644
index 7d27116269a..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationTableMetaData.java
+++ /dev/null
@@ -1,69 +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.shardingsphere.infra.federation.optimizer.metadata;
-
-import lombok.Getter;
-import org.apache.calcite.avatica.SqlType;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeFactory.Builder;
-import org.apache.calcite.rel.type.RelDataTypeImpl;
-import org.apache.calcite.rel.type.RelDataTypeSystem;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereColumn;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Federation table meta data.
- */
-@Getter
-public final class FederationTableMetaData {
-    
-    private static final RelDataTypeFactory REL_DATA_TYPE_FACTORY = new 
SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
-    
-    private final String name;
-    
-    private final RelProtoDataType relProtoDataType;
-    
-    private final List<String> columnNames;
-    
-    public FederationTableMetaData(final String name, final 
ShardingSphereTable table) {
-        this.name = name;
-        relProtoDataType = createRelProtoDataType(table);
-        // TODO consider using keySet when ShardingSphere supports column name 
case sensitivity
-        columnNames = 
table.getColumns().values().stream().map(ShardingSphereColumn::getName).collect(Collectors.toList());
-    }
-    
-    private RelProtoDataType createRelProtoDataType(final ShardingSphereTable 
table) {
-        Builder fieldInfoBuilder = REL_DATA_TYPE_FACTORY.builder();
-        for (ShardingSphereColumn each : table.getColumns().values()) {
-            fieldInfoBuilder.add(each.getName(), getRelDataType(each));
-        }
-        return RelDataTypeImpl.proto(fieldInfoBuilder.build());
-    }
-    
-    private RelDataType getRelDataType(final ShardingSphereColumn column) {
-        Class<?> sqlTypeClass = SqlType.valueOf(column.getDataType()).clazz;
-        RelDataType javaType = 
REL_DATA_TYPE_FACTORY.createJavaType(sqlTypeClass);
-        return REL_DATA_TYPE_FACTORY.createTypeWithNullability(javaType, true);
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationDatabase.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationDatabase.java
deleted file mode 100644
index 64c8d3e60bd..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationDatabase.java
+++ /dev/null
@@ -1,48 +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.shardingsphere.infra.federation.optimizer.metadata.calcite;
-
-import lombok.Getter;
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.impl.AbstractSchema;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationDatabaseMetaData;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationSchemaMetaData;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Federation database.
- */
-@Getter
-public final class FederationDatabase extends AbstractSchema {
-    
-    private final Map<String, Schema> subSchemaMap;
-    
-    public FederationDatabase(final FederationDatabaseMetaData metaData) {
-        subSchemaMap = getSubSchemaMap(metaData);
-    }
-    
-    private Map<String, Schema> getSubSchemaMap(final 
FederationDatabaseMetaData metaData) {
-        Map<String, Schema> result = new 
LinkedHashMap<>(metaData.getSchemas().size(), 1);
-        for (FederationSchemaMetaData each : metaData.getSchemas().values()) {
-            result.put(each.getName(), new FederationSchema(each));
-        }
-        return result;
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationSchema.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationSchema.java
deleted file mode 100644
index 4ce17fd06f9..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationSchema.java
+++ /dev/null
@@ -1,48 +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.shardingsphere.infra.federation.optimizer.metadata.calcite;
-
-import lombok.Getter;
-import org.apache.calcite.schema.Table;
-import org.apache.calcite.schema.impl.AbstractSchema;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationSchemaMetaData;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationTableMetaData;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Federation schema.
- */
-@Getter
-public final class FederationSchema extends AbstractSchema {
-    
-    private final Map<String, Table> tableMap;
-    
-    public FederationSchema(final FederationSchemaMetaData metaData) {
-        tableMap = getTableMap(metaData);
-    }
-    
-    private Map<String, Table> getTableMap(final FederationSchemaMetaData 
metaData) {
-        Map<String, Table> result = new 
LinkedHashMap<>(metaData.getTables().size(), 1);
-        for (FederationTableMetaData each : metaData.getTables().values()) {
-            result.put(each.getName(), new FederationTable(each));
-        }
-        return result;
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationTable.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationTable.java
deleted file mode 100644
index 88e4e877553..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/calcite/FederationTable.java
+++ /dev/null
@@ -1,49 +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.shardingsphere.infra.federation.optimizer.metadata.calcite;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.calcite.DataContext;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.schema.ProjectableFilterableTable;
-import org.apache.calcite.schema.impl.AbstractTable;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationTableMetaData;
-
-import java.util.List;
-
-/**
- * Federation table.
- */
-@RequiredArgsConstructor
-public final class FederationTable extends AbstractTable implements 
ProjectableFilterableTable {
-    
-    private final FederationTableMetaData metaData;
-    
-    @Override
-    public RelDataType getRowType(final RelDataTypeFactory typeFactory) {
-        return metaData.getRelProtoDataType().apply(typeFactory);
-    }
-    
-    @Override
-    public Enumerable<Object[]> scan(final DataContext root, final 
List<RexNode> filters, final int[] projects) {
-        return null;
-    }
-}
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/database/FilterableDatabase.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableDatabase.java
similarity index 83%
rename from 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/database/FilterableDatabase.java
rename to 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableDatabase.java
index d8101491f26..ef92efbf7c7 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/database/FilterableDatabase.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableDatabase.java
@@ -15,13 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.federation.executor.original.database;
+package org.apache.shardingsphere.infra.federation.optimizer.metadata.filter;
 
 import lombok.Getter;
 import org.apache.calcite.schema.Schema;
 import org.apache.calcite.schema.impl.AbstractSchema;
-import 
org.apache.shardingsphere.infra.federation.executor.original.schema.FilterableSchema;
-import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTableScanExecutor;
+import 
org.apache.shardingsphere.infra.federation.optimizer.executor.TableScanExecutor;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
 
@@ -39,12 +38,12 @@ public final class FilterableDatabase extends 
AbstractSchema {
     
     private final Map<String, Schema> subSchemaMap;
     
-    public FilterableDatabase(final ShardingSphereDatabase database, final 
FilterableTableScanExecutor executor) {
+    public FilterableDatabase(final ShardingSphereDatabase database, final 
TableScanExecutor executor) {
         name = database.getName();
         subSchemaMap = createSubSchemaMap(database, executor);
     }
     
-    private Map<String, Schema> createSubSchemaMap(final 
ShardingSphereDatabase database, final FilterableTableScanExecutor executor) {
+    private Map<String, Schema> createSubSchemaMap(final 
ShardingSphereDatabase database, final TableScanExecutor executor) {
         Map<String, Schema> result = new 
LinkedHashMap<>(database.getSchemas().size(), 1);
         for (Entry<String, ShardingSphereSchema> entry : 
database.getSchemas().entrySet()) {
             result.put(entry.getKey(), new FilterableSchema(entry.getKey(), 
entry.getValue(), executor));
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/schema/FilterableSchema.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableSchema.java
similarity index 77%
rename from 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/schema/FilterableSchema.java
rename to 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableSchema.java
index c8770be3aac..ec036c88ec0 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/schema/FilterableSchema.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableSchema.java
@@ -15,14 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.federation.executor.original.schema;
+package org.apache.shardingsphere.infra.federation.optimizer.metadata.filter;
 
 import lombok.Getter;
 import org.apache.calcite.schema.Table;
 import org.apache.calcite.schema.impl.AbstractSchema;
-import 
org.apache.shardingsphere.infra.federation.executor.original.table.FederationTableStatistic;
-import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTable;
-import 
org.apache.shardingsphere.infra.federation.executor.original.table.FilterableTableScanExecutor;
+import 
org.apache.shardingsphere.infra.federation.optimizer.executor.TableScanExecutor;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.statistic.FederationStatistic;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
 
@@ -39,16 +38,16 @@ public final class FilterableSchema extends AbstractSchema {
     
     private final Map<String, Table> tableMap;
     
-    public FilterableSchema(final String schemaName, final 
ShardingSphereSchema schema, final FilterableTableScanExecutor executor) {
+    public FilterableSchema(final String schemaName, final 
ShardingSphereSchema schema, final TableScanExecutor executor) {
         name = schemaName;
         tableMap = createTableMap(schema, executor);
     }
     
-    private Map<String, Table> createTableMap(final ShardingSphereSchema 
schema, final FilterableTableScanExecutor executor) {
+    private Map<String, Table> createTableMap(final ShardingSphereSchema 
schema, final TableScanExecutor executor) {
         Map<String, Table> result = new 
LinkedHashMap<>(schema.getTables().size(), 1);
         for (ShardingSphereTable each : schema.getTables().values()) {
             // TODO implement table statistic logic after using custom 
operators
-            result.put(each.getName(), new FilterableTable(each, executor, new 
FederationTableStatistic()));
+            result.put(each.getName(), new FilterableTable(each, executor, new 
FederationStatistic()));
         }
         return result;
     }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTable.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableTable.java
similarity index 83%
rename from 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTable.java
rename to 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableTable.java
index 10c7908d812..84b4db2df91 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FilterableTable.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/filter/FilterableTable.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.federation.executor.original.table;
+package org.apache.shardingsphere.infra.federation.optimizer.metadata.filter;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.calcite.DataContext;
@@ -28,6 +28,9 @@ import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.schema.ProjectableFilterableTable;
 import org.apache.calcite.schema.Statistic;
 import org.apache.calcite.schema.impl.AbstractTable;
+import 
org.apache.shardingsphere.infra.federation.optimizer.executor.TableScanExecutorContext;
+import 
org.apache.shardingsphere.infra.federation.optimizer.executor.TableScanExecutor;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.statistic.FederationStatistic;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
 
@@ -41,9 +44,9 @@ public final class FilterableTable extends AbstractTable 
implements ProjectableF
     
     private final ShardingSphereTable table;
     
-    private final FilterableTableScanExecutor executor;
+    private final TableScanExecutor executor;
     
-    private final FederationTableStatistic statistic;
+    private final FederationStatistic statistic;
     
     @Override
     public RelDataType getRowType(final RelDataTypeFactory typeFactory) {
@@ -52,7 +55,7 @@ public final class FilterableTable extends AbstractTable 
implements ProjectableF
     
     @Override
     public Enumerable<Object[]> scan(final DataContext root, final 
List<RexNode> filters, final int[] projects) {
-        return executor.execute(table, new FilterableTableScanContext(root, 
filters, projects));
+        return executor.execute(table, new TableScanExecutorContext(root, 
filters, projects));
     }
     
     @Override
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FederationTableStatistic.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/statistic/FederationStatistic.java
similarity index 91%
rename from 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FederationTableStatistic.java
rename to 
shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/statistic/FederationStatistic.java
index b80fab8bb54..abf68dd6f58 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-executor/src/main/java/org/apache/shardingsphere/infra/federation/executor/original/table/FederationTableStatistic.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/statistic/FederationStatistic.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.federation.executor.original.table;
+package 
org.apache.shardingsphere.infra.federation.optimizer.metadata.statistic;
 
 import org.apache.calcite.rel.RelCollation;
 import org.apache.calcite.rel.RelDistribution;
@@ -29,7 +29,7 @@ import java.util.List;
 /**
  * Statistic of federation table.
  */
-public final class FederationTableStatistic implements Statistic {
+public final class FederationStatistic implements Statistic {
     
     @Override
     public List<RelReferentialConstraint> getReferentialConstraints() {
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/ShardingSphereOptimizerTest.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/ShardingSphereOptimizerTest.java
index ffa29861443..5ada76319ff 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/ShardingSphereOptimizerTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/ShardingSphereOptimizerTest.java
@@ -27,8 +27,7 @@ import org.apache.calcite.sql2rel.SqlToRelConverter;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
 import org.apache.shardingsphere.infra.database.type.dialect.H2DatabaseType;
 import 
org.apache.shardingsphere.infra.federation.optimizer.context.planner.OptimizerPlannerContextFactory;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationSchemaMetaData;
-import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.calcite.FederationSchema;
+import 
org.apache.shardingsphere.infra.federation.optimizer.metadata.filter.FilterableSchema;
 import 
org.apache.shardingsphere.infra.federation.optimizer.planner.QueryOptimizePlannerFactory;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
@@ -107,7 +106,7 @@ public final class ShardingSphereOptimizerTest {
     private static SqlToRelConverter createSqlToRelConverter(final 
ShardingSphereSchema schema) {
         CalciteConnectionConfig connectionConfig = new 
CalciteConnectionConfigImpl(OptimizerPlannerContextFactory.createConnectionProperties());
         RelDataTypeFactory relDataTypeFactory = new JavaTypeFactoryImpl();
-        FederationSchema federationSchema = new FederationSchema(new 
FederationSchemaMetaData(SCHEMA_NAME, schema.getTables()));
+        FilterableSchema federationSchema = new FilterableSchema(SCHEMA_NAME, 
schema, null);
         CalciteCatalogReader catalogReader = 
OptimizerPlannerContextFactory.createCatalogReader(SCHEMA_NAME, 
federationSchema, relDataTypeFactory, connectionConfig);
         SqlValidator validator = 
OptimizerPlannerContextFactory.createValidator(catalogReader, 
relDataTypeFactory, connectionConfig);
         return OptimizerPlannerContextFactory.createConverter(catalogReader, 
validator, relDataTypeFactory);
diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationDatabaseMetaDataTest.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationDatabaseMetaDataTest.java
deleted file mode 100644
index e0778e288f7..00000000000
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/test/java/org/apache/shardingsphere/infra/federation/optimizer/metadata/FederationDatabaseMetaDataTest.java
+++ /dev/null
@@ -1,90 +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.shardingsphere.infra.federation.optimizer.metadata;
-
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereSchema;
-import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
-public final class FederationDatabaseMetaDataTest {
-    
-    @Test
-    public void assertPutSchemaMetadata() {
-        FederationDatabaseMetaData databaseMetaData = new 
FederationDatabaseMetaData("foo_db", Collections.emptyMap());
-        FederationSchemaMetaData schemaMetaData = 
mock(FederationSchemaMetaData.class);
-        databaseMetaData.putSchemaMetadata("foo_schema", schemaMetaData);
-        assertThat(databaseMetaData.getSchemaMetadata("foo_schema").get(), 
is(schemaMetaData));
-    }
-    
-    @Test
-    public void assertRemoveSchemaMetadata() {
-        Map<String, ShardingSphereSchema> schemas = new HashMap<>(2, 1);
-        schemas.put("foo_schema_1", mock(ShardingSphereSchema.class));
-        schemas.put("foo_schema_2", mock(ShardingSphereSchema.class));
-        FederationDatabaseMetaData databaseMetaData = new 
FederationDatabaseMetaData("foo_db", schemas);
-        assertTrue(databaseMetaData.containsSchemaMetadata("foo_schema_1"));
-        databaseMetaData.removeSchemaMetadata("foo_schema_1");
-        assertFalse(databaseMetaData.containsSchemaMetadata("foo_schema_1"));
-        assertTrue(databaseMetaData.containsSchemaMetadata("foo_schema_2"));
-    }
-    
-    @Test
-    public void assertGetSchemaMetadata() {
-        Map<String, ShardingSphereSchema> schemas = new HashMap<>(1, 1);
-        schemas.put("foo_schema", mock(ShardingSphereSchema.class));
-        FederationDatabaseMetaData federationDatabaseMetaData = new 
FederationDatabaseMetaData("foo_db", schemas);
-        
assertTrue(federationDatabaseMetaData.getSchemaMetadata("foo_schema").isPresent());
-    }
-    
-    @Test
-    public void assertGetSchemaMetadataWhenNotContainsKey() {
-        Map<String, ShardingSphereSchema> schemas = new HashMap<>(1, 1);
-        schemas.put("foo_schema", mock(ShardingSphereSchema.class));
-        FederationDatabaseMetaData federationDatabaseMetaData = new 
FederationDatabaseMetaData("foo_db", schemas);
-        
assertFalse(federationDatabaseMetaData.getSchemaMetadata("foo_schema_2").isPresent());
-    }
-    
-    @Test
-    public void assertPutTable() {
-        FederationDatabaseMetaData databaseMetaData = new 
FederationDatabaseMetaData("foo_db", Collections.emptyMap());
-        ShardingSphereTable table = new ShardingSphereTable("foo_table", 
Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
-        databaseMetaData.putTable("foo_schema", table);
-        
assertTrue(databaseMetaData.getSchemaMetadata("foo_schema").isPresent());
-        
assertTrue(databaseMetaData.getSchemaMetadata("foo_schema").get().getTables().containsKey("foo_table"));
-    }
-    
-    @Test
-    public void assertRemoveTableMetadata() {
-        FederationDatabaseMetaData databaseMetaData = new 
FederationDatabaseMetaData("foo_db", Collections.emptyMap());
-        ShardingSphereTable table = new ShardingSphereTable("foo_table", 
Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
-        databaseMetaData.putTable("foo_schema", table);
-        databaseMetaData.removeTableMetadata("foo_schema", "foo_table");
-        
assertTrue(databaseMetaData.getSchemaMetadata("foo_schema").isPresent());
-        
assertFalse(databaseMetaData.getSchemaMetadata("foo_schema").get().getTables().containsKey("foo_table"));
-    }
-}

Reply via email to