public static SubquerySegment bind(final SubquerySegment segment, final SQLStatementBinderContext binderContext, final Map<String, TableSegmentBinderContext> outerTableBinderContexts) {
        SQLStatementBinderContext selectBinderContext = new SQLStatementBinderContext(segment.getSelect(), binderContext.getMetaData(), binderContext.getCurrentDatabaseName());
        selectBinderContext.getExternalTableBinderContexts().putAll(binderContext.getExternalTableBinderContexts());
        SelectStatement boundSelectStatement = new SelectStatementBinder(outerTableBinderContexts).bind(segment.getSelect(), selectBinderContext);
        SubquerySegment result = new SubquerySegment(segment.getStartIndex(), segment.getStopIndex(), boundSelectStatement, segment.getText());
        result.setSubqueryType(segment.getSubqueryType());
        return result;
    }
@Test
    void assertBind() {
        MySQLSelectStatement mysqlSelectStatement = new MySQLSelectStatement();
        ColumnSegment columnSegment = new ColumnSegment(58, 65, new IdentifierValue("order_id"));
        ProjectionsSegment projectionsSegment = new ProjectionsSegment(58, 65);
        projectionsSegment.getProjections().add(new ColumnProjectionSegment(columnSegment));
        mysqlSelectStatement.setProjections(projectionsSegment);
        mysqlSelectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(72, 78, new IdentifierValue("t_order"))));
        ExpressionSegment whereExpressionSegment = new ColumnSegment(86, 91, new IdentifierValue("status"));
        mysqlSelectStatement.setWhere(new WhereSegment(80, 102, whereExpressionSegment));
        SubquerySegment subquerySegment = new SubquerySegment(39, 103, mysqlSelectStatement, "order_id = (SELECT order_id FROM t_order WHERE status = 'SUBMIT')");
        SQLStatementBinderContext sqlStatementBinderContext = new SQLStatementBinderContext(
                createMetaData(), DefaultDatabase.LOGIC_NAME, TypedSPILoader.getService(DatabaseType.class, "FIXTURE"), Collections.emptySet());
        ColumnSegment boundNameColumn = new ColumnSegment(7, 13, new IdentifierValue("user_id"));
        boundNameColumn.setColumnBoundInfo(new ColumnSegmentBoundInfo(
                new IdentifierValue(DefaultDatabase.LOGIC_NAME), new IdentifierValue(DefaultDatabase.LOGIC_NAME), new IdentifierValue("t_order_item"), new IdentifierValue("user_id")));
        sqlStatementBinderContext.getExternalTableBinderContexts().put("t_order_item", new SimpleTableSegmentBinderContext(Collections.singleton(new ColumnProjectionSegment(boundNameColumn))));
        Map<String, TableSegmentBinderContext> outerTableBinderContexts = new LinkedHashMap<>();
        SubquerySegment actual = SubquerySegmentBinder.bind(subquerySegment, sqlStatementBinderContext, outerTableBinderContexts);
        assertNotNull(actual.getSelect());
        assertTrue(actual.getSelect().getFrom().isPresent());
        assertInstanceOf(SimpleTableSegment.class, actual.getSelect().getFrom().get());
        assertThat(((SimpleTableSegment) actual.getSelect().getFrom().get()).getTableName().getIdentifier().getValue(), is("t_order"));
        assertTrue(actual.getSelect().getWhere().isPresent());
        assertInstanceOf(ColumnSegment.class, actual.getSelect().getWhere().get().getExpr());
        assertThat(((ColumnSegment) actual.getSelect().getWhere().get().getExpr()).getIdentifier().getValue(), is("status"));
        assertNotNull(((ColumnSegment) actual.getSelect().getWhere().get().getExpr()).getColumnBoundInfo());
        assertThat(((ColumnSegment) actual.getSelect().getWhere().get().getExpr()).getColumnBoundInfo().getOriginalColumn().getValue(), is("status"));
        assertThat(((ColumnSegment) actual.getSelect().getWhere().get().getExpr()).getColumnBoundInfo().getOriginalTable().getValue(), is("t_order"));
        assertThat(((ColumnSegment) actual.getSelect().getWhere().get().getExpr()).getColumnBoundInfo().getOriginalSchema().getValue(), is(DefaultDatabase.LOGIC_NAME));
        assertThat(((ColumnSegment) actual.getSelect().getWhere().get().getExpr()).getColumnBoundInfo().getOriginalDatabase().getValue(), is(DefaultDatabase.LOGIC_NAME));
        assertNotNull(actual.getSelect().getProjections());
        assertThat(actual.getSelect().getProjections().getProjections().size(), is(1));
        ProjectionSegment column = actual.getSelect().getProjections().getProjections().iterator().next();
        assertInstanceOf(ColumnProjectionSegment.class, column);
        assertThat(((ColumnProjectionSegment) column).getColumn().getIdentifier().getValue(), is("order_id"));
        assertNotNull(((ColumnProjectionSegment) column).getColumn().getColumnBoundInfo());
        assertThat(((ColumnProjectionSegment) column).getColumn().getColumnBoundInfo().getOriginalColumn().getValue(), is("order_id"));
        assertThat(((ColumnProjectionSegment) column).getColumn().getColumnBoundInfo().getOriginalTable().getValue(), is("t_order"));
        assertThat(((ColumnProjectionSegment) column).getColumn().getColumnBoundInfo().getOriginalSchema().getValue(), is(DefaultDatabase.LOGIC_NAME));
        assertThat(((ColumnProjectionSegment) column).getColumn().getColumnBoundInfo().getOriginalDatabase().getValue(), is(DefaultDatabase.LOGIC_NAME));
    }