Source:
public StreamableTable build() { final Statistic stat = buildStatistic(); final Table tbl = new ParallelTable() { @Override public Integer parallelismHint() { return parallelismHint; } @Override public int primaryKey() { return primaryKey; } @Override public RelDataType getRowType( RelDataTypeFactory relDataTypeFactory) { RelDataTypeFactory.FieldInfoBuilder b = relDataTypeFactory.builder(); for (FieldType f : fields) { b.add(f.name, f.relDataType); } return b.build(); } @Override public Statistic getStatistic() { return stat != null ? stat : Statistics.of(rows.size(), ImmutableList.<ImmutableBitSet>of()); } @Override public Schema.TableType getJdbcTableType() { return Schema.TableType.STREAM; } @Override public boolean isRolledUp(String s) { return false; } @Override public boolean rolledUpColumnValidInsideAgg(String s, SqlCall sqlCall, SqlNode sqlNode, CalciteConnectionConfig calciteConnectionConfig) { return false; } }; return new ParallelStreamableTable() { @Override public int primaryKey() { return primaryKey; } @Override public Integer parallelismHint() { return parallelismHint; } @Override public Table stream() { return tbl; } @Override public RelDataType getRowType(RelDataTypeFactory relDataTypeFactory) { return tbl.getRowType(relDataTypeFactory); } @Override public Statistic getStatistic() { return tbl.getStatistic(); } @Override public Schema.TableType getJdbcTableType() { return Schema.TableType.STREAM; } @Override public boolean isRolledUp(String s) { return false; } @Override public boolean rolledUpColumnValidInsideAgg(String s, SqlCall sqlCall, SqlNode sqlNode, CalciteConnectionConfig calciteConnectionConfig) { return false; } }; }

Target:
public StreamableTable build() { final Statistic stat = buildStatistic(); final Table tbl = new ParallelTable() { @Override public Integer parallelismHint() { return parallelismHint; } @Override public int primaryKey() { return primaryKey; } @Override public RelDataType getRowType( RelDataTypeFactory relDataTypeFactory) { RelDataTypeFactory.FieldInfoBuilder b = relDataTypeFactory.builder(); for (FieldType f : fields) { b.add(f.name, f.relDataType); } return b.build(); } @Override public Statistic getStatistic() { return stat != null ? stat : Statistics.of(rows.size(), ImmutableList.<ImmutableBitSet>of()); } @Override public Schema.TableType getJdbcTableType() { return Schema.TableType.STREAM; } @Override public boolean isRolledUp(String column) { return false; } @Override public boolean rolledUpColumnValidInsideAgg(String column, SqlCall call, SqlNode parent, CalciteConnectionConfig config) { return false; } }; return new ParallelStreamableTable() { @Override public int primaryKey() { return primaryKey; } @Override public Integer parallelismHint() { return parallelismHint; } @Override public Table stream() { return tbl; } @Override public RelDataType getRowType(RelDataTypeFactory relDataTypeFactory) { return tbl.getRowType(relDataTypeFactory); } @Override public Statistic getStatistic() { return tbl.getStatistic(); } @Override public Schema.TableType getJdbcTableType() { return Schema.TableType.STREAM; } @Override public boolean isRolledUp(String column) { return false; } @Override public boolean rolledUpColumnValidInsideAgg(String column, SqlCall call, SqlNode parent, CalciteConnectionConfig config) { return false; } }; }