@@ -73,12 +73,6 @@ const ITER_NUM_METRIC_NAME: &str = "iter_num";
73
73
const MERGE_ITER_METRICS_COLLECTOR_NAME_PREFIX : & str = "merge_iter" ;
74
74
const CHAIN_ITER_METRICS_COLLECTOR_NAME_PREFIX : & str = "chain_iter" ;
75
75
76
- /// Check whether it needs to apply merge sorting when reading the table with
77
- /// the `table_options` by the `read_request`.
78
- fn need_merge_sort_streams ( table_options : & TableOptions , read_request : & ReadRequest ) -> bool {
79
- table_options. need_dedup ( ) || read_request. order . is_in_order ( )
80
- }
81
-
82
76
impl Instance {
83
77
/// Read data in multiple time range from table, and return
84
78
/// `read_parallelism` output streams.
@@ -95,7 +89,7 @@ impl Instance {
95
89
let table_options = table_data. table_options ( ) ;
96
90
// Collect metrics.
97
91
table_data. metrics . on_read_request_begin ( ) ;
98
- let need_merge_sort = need_merge_sort_streams ( & table_options, & request ) ;
92
+ let need_merge_sort = table_options. need_dedup ( ) ;
99
93
request. metrics_collector . collect ( Metric :: boolean (
100
94
MERGE_SORT_METRIC_NAME . to_string ( ) ,
101
95
need_merge_sort,
@@ -118,15 +112,10 @@ impl Instance {
118
112
fn build_partitioned_streams (
119
113
& self ,
120
114
request : & ReadRequest ,
121
- mut partitioned_iters : Vec < impl RecordBatchWithKeyIterator + ' static > ,
115
+ partitioned_iters : Vec < impl RecordBatchWithKeyIterator + ' static > ,
122
116
) -> Result < PartitionedStreams > {
123
117
let read_parallelism = request. opts . read_parallelism ;
124
118
125
- if read_parallelism == 1 && request. order . is_in_desc_order ( ) {
126
- // TODO(xikai): it seems this can be avoided.
127
- partitioned_iters. reverse ( ) ;
128
- } ;
129
-
130
119
// Split iterators into `read_parallelism` groups.
131
120
let mut splitted_iters: Vec < _ > = std:: iter:: repeat_with ( Vec :: new)
132
121
. take ( read_parallelism)
@@ -157,7 +146,6 @@ impl Instance {
157
146
let sequence = table_data. last_sequence ( ) ;
158
147
let projected_schema = request. projected_schema . clone ( ) ;
159
148
let sst_read_options = SstReadOptions {
160
- reverse : request. order . is_in_desc_order ( ) ,
161
149
frequency : ReadFrequency :: Frequent ,
162
150
projected_schema : projected_schema. clone ( ) ,
163
151
predicate : request. predicate . clone ( ) ,
@@ -191,7 +179,7 @@ impl Instance {
191
179
store_picker : self . space_store . store_picker ( ) ,
192
180
merge_iter_options : iter_options. clone ( ) ,
193
181
need_dedup : table_options. need_dedup ( ) ,
194
- reverse : request . order . is_in_desc_order ( ) ,
182
+ reverse : false ,
195
183
} ;
196
184
197
185
let merge_iter = MergeBuilder :: new ( merge_config)
@@ -226,11 +214,7 @@ impl Instance {
226
214
) -> Result < Vec < ChainIterator > > {
227
215
let projected_schema = request. projected_schema . clone ( ) ;
228
216
229
- assert ! ( request. order. is_out_of_order( ) ) ;
230
-
231
217
let sst_read_options = SstReadOptions {
232
- // no need to read in order so just read in asc order by default.
233
- reverse : false ,
234
218
frequency : ReadFrequency :: Frequent ,
235
219
projected_schema : projected_schema. clone ( ) ,
236
220
predicate : request. predicate . clone ( ) ,
0 commit comments