Skip to content

Commit 0284a29

Browse files
committed
feat: optimize minor issues (apache#1496)
## Rationale Related with apache#1466 ## Detailed Changes 1. Make execution_props an arguments to logical2physical. 2. Make scan_batch_size NonZeroUsize ## Test Plan Manual test
1 parent fe6121f commit 0284a29

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

src/analytic_engine/src/manifest/details.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ pub struct Options {
376376
pub scan_timeout: ReadableDuration,
377377

378378
/// Batch size to read manifest entries
379-
// TODO: use NonZeroUsize
380-
pub scan_batch_size: usize,
379+
pub scan_batch_size: NonZeroUsize,
381380

382381
/// Timeout to store manifest entries
383382
pub store_timeout: ReadableDuration,
@@ -388,7 +387,7 @@ impl Default for Options {
388387
Self {
389388
snapshot_every_n_updates: NonZeroUsize::new(100).unwrap(),
390389
scan_timeout: ReadableDuration::secs(5),
391-
scan_batch_size: 100,
390+
scan_batch_size: NonZeroUsize::new(100).unwrap(),
392391
store_timeout: ReadableDuration::secs(5),
393392
}
394393
}
@@ -690,7 +689,7 @@ impl MetaUpdateLogStore for WalBasedLogStore {
690689
async fn scan(&self, start: ReadBoundary) -> Result<Self::Iter> {
691690
let ctx = ReadContext {
692691
timeout: self.opts.scan_timeout.0,
693-
batch_size: self.opts.scan_batch_size,
692+
batch_size: self.opts.scan_batch_size.into(),
694693
};
695694

696695
let read_req = ReadRequest {

src/components/parquet_ext/src/prune/min_max.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ fn filter_row_groups_inner(
5959
row_groups: &[RowGroupMetaData],
6060
) -> Vec<bool> {
6161
let mut results = vec![true; row_groups.len()];
62+
let execution_props = ExecutionProps::new();
6263
for expr in exprs {
63-
match logical2physical(expr, &schema)
64+
match logical2physical(expr, &schema, &execution_props)
6465
.and_then(|physical_expr| PruningPredicate::try_new(physical_expr, schema.clone()))
6566
{
6667
Ok(pruning_predicate) => {
@@ -86,12 +87,15 @@ fn filter_row_groups_inner(
8687
results
8788
}
8889

89-
fn logical2physical(expr: &Expr, schema: &ArrowSchema) -> DataFusionResult<Arc<dyn PhysicalExpr>> {
90-
schema.clone().to_dfschema().and_then(|df_schema| {
91-
// TODO: props should be an argument
92-
let execution_props = ExecutionProps::new();
93-
create_physical_expr(expr, &df_schema, schema, &execution_props)
94-
})
90+
fn logical2physical(
91+
expr: &Expr,
92+
schema: &ArrowSchema,
93+
execution_props: &ExecutionProps,
94+
) -> DataFusionResult<Arc<dyn PhysicalExpr>> {
95+
schema
96+
.clone()
97+
.to_dfschema()
98+
.and_then(|df_schema| create_physical_expr(expr, &df_schema, schema, execution_props))
9599
}
96100

97101
fn build_row_group_predicate(

src/components/tracing_util/src/logging.rs

-4
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ pub fn init_tracing_with_file(config: &Config, node_addr: &str, rotation: Rotati
126126
.with_span_events(FmtSpan::ENTER | FmtSpan::CLOSE);
127127

128128
let subscriber = Registry::default().with(f_layer);
129-
// TODO: subscriber.with(layer1) has the different type with
130-
// subscriber.with(layer1).with(layer2)...
131-
// So left some duplicated codes here. Maybe we can use marco to simplify
132-
// it.
133129
match &config.console {
134130
Some(console) => {
135131
let console_addr = format!("{}:{}", node_addr, console.port);

src/table_engine/src/partition/rule/key.rs

-2
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ fn expand_partition_keys_group<'a>(
237237
for filter_idx in group {
238238
let filter = &filters[*filter_idx];
239239
let datums = match &filter.condition {
240-
// Only `Eq` is supported now.
241-
// TODO: to support `In`'s extracting.
242240
PartitionCondition::Eq(datum) => vec![datum.as_view()],
243241
PartitionCondition::In(datums) => datums.iter().map(Datum::as_view).collect_vec(),
244242
_ => {

0 commit comments

Comments
 (0)