@Override
    public boolean decide(final SelectStatementContext selectStatementContext, final List<Object> parameters,
                          final RuleMetaData globalRuleMetaData, final ShardingSphereDatabase database, final ShardingRule rule, final Collection<DataNode> includedDataNodes) {
        Collection<String> tableNames = rule.getShardingLogicTableNames(selectStatementContext.getTablesContext().getTableNames());
        if (tableNames.isEmpty()) {
            return false;
        }
        includedDataNodes.addAll(getTableDataNodes(rule, tableNames, database));
        if (selectStatementContext.isContainsSubquery() || selectStatementContext.isContainsHaving()
                || selectStatementContext.isContainsCombine() || selectStatementContext.isContainsPartialDistinctAggregation()) {
            return true;
        }
        if (!selectStatementContext.isContainsJoinQuery() || rule.isAllTablesInSameDataSource(tableNames)) {
            return false;
        }
        if (1 == tableNames.size() && selectStatementContext.isContainsJoinQuery() && !rule.isAllBindingTables(database, selectStatementContext, tableNames)) {
            return true;
        }
        return tableNames.size() > 1 && !rule.isAllBindingTables(database, selectStatementContext, tableNames);
    }
@Test
    void assertDecideWhenNotContainsShardingTable() {
        ShardingRule rule = mock(ShardingRule.class);
        when(rule.getShardingLogicTableNames(Arrays.asList("t_order", "t_order_item"))).thenReturn(Collections.emptyList());
        when(rule.findShardingTable("t_order")).thenReturn(Optional.of(mock(ShardingTable.class)));
        when(rule.findShardingTable("t_order_item")).thenReturn(Optional.of(mock(ShardingTable.class)));
        Collection<DataNode> includedDataNodes = new HashSet<>();
        assertFalse(new ShardingSQLFederationDecider().decide(
                createStatementContext(), Collections.emptyList(), mock(RuleMetaData.class), mock(ShardingSphereDatabase.class), rule, includedDataNodes));
        assertTrue(includedDataNodes.isEmpty());
    }