sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java
/**
   * Override the contexts of all subqueries of a particular datasource.
   */
Override the contexts of all subqueries of a particular datasource.
Override the contexts of all subqueries of a particular datasource .
private static DataSource recursivelyOverrideContext(final DataSource dataSource, final Map<String, Object> context)
  {
    if (dataSource instanceof QueryDataSource) {
      final Query subquery = ((QueryDataSource) dataSource).getQuery();
      return new QueryDataSource(recursivelyOverrideContext(subquery, context));
    } else {
      return dataSource.withChildren(
          dataSource.getChildren()
                    .stream()
                    .map(ds -> recursivelyOverrideContext(ds, context))
                    .collect(Collectors.toList())
      );
    }
  }
private static DataSource recursivelyOverrideContext ( final DataSource dataSource , final Map < String , Object > context ) { if ( dataSource instanceof QueryDataSource ) { final Query subquery = ( ( QueryDataSource ) dataSource ) . getQuery ( ) ; return new QueryDataSource ( recursivelyOverrideContext ( subquery , context ) ) ; } else { return dataSource . withChildren ( dataSource . getChildren ( ) . stream ( ) . map ( ds -> recursivelyOverrideContext ( ds , context ) ) . collect ( Collectors . toList ( ) ) ) ; } }
Override the contexts of all subqueries of a particular datasource.
Override the contexts of all subqueries of a particular datasource .