@Override
    public Enumerable<Object> execute(final ShardingSphereTable table, final ScanExecutorContext scanContext) {
        String databaseName = executorContext.getDatabaseName();
        String schemaName = executorContext.getSchemaName();
        DatabaseType databaseType = optimizerContext.getParserContext(databaseName).getDatabaseType();
        if (new SystemDatabase(databaseType).getSystemSchemas().contains(schemaName)) {
            return createMemoryEnumerable(databaseName, schemaName, table, databaseType);
        }
        QueryContext queryContext = createQueryContext(federationContext.getMetaData(), scanContext, databaseType, federationContext.getQueryContext().isUseCache());
        ExecutionContext executionContext = new KernelProcessor().generateExecutionContext(queryContext, globalRuleMetaData, executorContext.getProps(), new ConnectionContext(Collections::emptySet));
        if (federationContext.isPreview()) {
            federationContext.getPreviewExecutionUnits().addAll(executionContext.getExecutionUnits());
            return createEmptyEnumerable();
        }
        return createJDBCEnumerable(queryContext, federationContext.getMetaData().getDatabase(databaseName), executionContext);
    }
@Test
    void assertExecuteWithStatistics() {
        OptimizerContext optimizerContext = mock(OptimizerContext.class, RETURNS_DEEP_STUBS);
        when(optimizerContext.getParserContext(any()).getDatabaseType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"));
        SQLFederationExecutorContext executorContext = mock(SQLFederationExecutorContext.class);
        when(executorContext.getDatabaseName()).thenReturn("db");
        when(executorContext.getSchemaName()).thenReturn("pg_catalog");
        ShardingSphereStatistics statistics = mock(ShardingSphereStatistics.class, RETURNS_DEEP_STUBS);
        ShardingSphereDatabaseData databaseData = mock(ShardingSphereDatabaseData.class, RETURNS_DEEP_STUBS);
        when(statistics.getDatabase("db")).thenReturn(databaseData);
        ShardingSphereSchemaData schemaData = mock(ShardingSphereSchemaData.class, RETURNS_DEEP_STUBS);
        when(databaseData.getSchema("pg_catalog")).thenReturn(schemaData);
        ShardingSphereTableData tableData = mock(ShardingSphereTableData.class);
        when(tableData.getRows()).thenReturn(Collections.singletonList(new ShardingSphereRowData(Collections.singletonList(1))));
        when(schemaData.getTable("test")).thenReturn(tableData);
        ShardingSphereTable table = mock(ShardingSphereTable.class, RETURNS_DEEP_STUBS);
        when(table.getName()).thenReturn("test");
        when(table.getColumns().values()).thenReturn(Collections.singleton(new ShardingSphereColumn("id", Types.INTEGER, true, false, false, false, true, false)));
        Enumerable<Object> enumerable = new EnumerableScanExecutor(null, null, null, optimizerContext, executorContext, null, null, statistics)
                .execute(table, mock(ScanExecutorContext.class));
        try (Enumerator<Object> actual = enumerable.enumerator()) {
            actual.moveNext();
            Object row = actual.current();
            assertThat(row, instanceOf(Object[].class));
            assertThat(((Object[]) row)[0], is(1));
        }
    }