Skip to content

Commit 051719c

Browse files
committed
Address PR review feedback
- Fix rustfmt formatting issues - Remove unused imports (TableReference, DFSchema) in test module - Change pub fields to pub(crate) with public accessors: - SQLFederationProvider.executor - SQLFederationPlanner.executor - FederatedPlanNode.plan, FederatedPlanNode.planner - Pin arduino/setup-protoc to commit hash (v3.0.0)
1 parent 40b6319 commit 051719c

6 files changed

Lines changed: 31 additions & 24 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fetch-depth: 0
2121
submodules: recursive
2222
- uses: dtolnay/rust-toolchain@nightly
23-
- uses: arduino/setup-protoc@v3
23+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
2424
with:
2525
repo-token: ${{ secrets.GITHUB_TOKEN }}
2626
- run: cargo rustdoc -p datafusion-federation -- --cfg docsrs

.github/workflows/integration-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: dtolnay/rust-toolchain@stable
2222

2323
- name: Setup protoc
24-
uses: arduino/setup-protoc@v3
24+
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
2525
with:
2626
repo-token: ${{ secrets.GITHUB_TOKEN }}
2727

.github/workflows/release_plz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fetch-depth: 0
2323
- name: Install Rust toolchain
2424
uses: dtolnay/rust-toolchain@stable
25-
- uses: arduino/setup-protoc@v3
25+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
2626
with:
2727
repo-token: ${{ secrets.GITHUB_TOKEN }}
2828
- name: Run release-plz

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fetch-depth: 0
1717
submodules: recursive
1818
- uses: dtolnay/rust-toolchain@stable
19-
- uses: arduino/setup-protoc@v3
19+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
2020
with:
2121
repo-token: ${{ secrets.GITHUB_TOKEN }}
2222
- run: cargo check --all-features
@@ -30,7 +30,7 @@ jobs:
3030
fetch-depth: 0
3131
submodules: recursive
3232
- uses: dtolnay/rust-toolchain@stable
33-
- uses: arduino/setup-protoc@v3
33+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
3434
with:
3535
repo-token: ${{ secrets.GITHUB_TOKEN }}
3636
- run: cargo test --all-features
@@ -56,7 +56,7 @@ jobs:
5656
- uses: dtolnay/rust-toolchain@stable
5757
with:
5858
components: clippy
59-
- uses: arduino/setup-protoc@v3
59+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
6060
with:
6161
repo-token: ${{ secrets.GITHUB_TOKEN }}
6262
- run: cargo clippy -- -D warnings
@@ -70,7 +70,7 @@ jobs:
7070
fetch-depth: 0
7171
submodules: recursive
7272
- uses: dtolnay/rust-toolchain@stable
73-
- uses: arduino/setup-protoc@v3
73+
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
7474
with:
7575
repo-token: ${{ secrets.GITHUB_TOKEN }}
7676
- run: cargo build --all --all-features

datafusion-federation/src/plan_node.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use datafusion::{
1616
};
1717

1818
pub struct FederatedPlanNode {
19-
pub plan: LogicalPlan,
20-
pub planner: Arc<dyn FederationPlanner>,
19+
pub(crate) plan: LogicalPlan,
20+
pub(crate) planner: Arc<dyn FederationPlanner>,
2121
}
2222

2323
impl FederatedPlanNode {
@@ -28,6 +28,10 @@ impl FederatedPlanNode {
2828
pub fn plan(&self) -> &LogicalPlan {
2929
&self.plan
3030
}
31+
32+
pub fn planner(&self) -> &Arc<dyn FederationPlanner> {
33+
&self.planner
34+
}
3135
}
3236

3337
impl Debug for FederatedPlanNode {

datafusion-federation/src/sql/mod.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ use analyzer::{collect_known_rewrites, RewriteTableScanAnalyzer};
1212
use ast_analyzer::RewriteMultiTableReference;
1313
use async_trait::async_trait;
1414
use datafusion::{
15-
common::DFSchema,
1615
arrow::datatypes::{Schema, SchemaRef},
17-
common::{
18-
tree_node::TreeNode,
19-
Statistics,
20-
},
16+
common::DFSchema,
17+
common::{tree_node::TreeNode, Statistics},
2118
config::ConfigOptions,
2219
error::{DataFusionError, Result},
2320
execution::{context::SessionState, TaskContext},
@@ -37,11 +34,11 @@ use datafusion::{
3734
};
3835
use optimizer::{OptimizeProjectionsFederation, PushDownFilterFederation};
3936

37+
pub use ast_analyzer::{AstAnalyzer, AstAnalyzerRule};
4038
pub use executor::{LogicalOptimizer, SQLExecutor, SQLExecutorRef, SqlQueryRewriter};
4139
pub use schema::{MultiSchemaProvider, SQLSchemaProvider};
4240
pub use table::{RemoteTable, SQLTable, SQLTableSource};
4341
pub use table_reference::{MultiPartTableReference, RemoteTableRef};
44-
pub use ast_analyzer::{AstAnalyzer, AstAnalyzerRule};
4542

4643
use crate::{
4744
get_table_source, schema_cast, FederatedPlanNode, FederationAnalyzerForLogicalPlan,
@@ -61,7 +58,7 @@ pub fn federation_analyzer_rule() -> FederationAnalyzerRule {
6158
#[derive(Debug)]
6259
pub struct SQLFederationProvider {
6360
analyzer: Arc<Analyzer>,
64-
pub executor: Arc<dyn SQLExecutor>,
61+
pub(crate) executor: Arc<dyn SQLExecutor>,
6562
}
6663

6764
impl SQLFederationProvider {
@@ -73,6 +70,10 @@ impl SQLFederationProvider {
7370
executor,
7471
}
7572
}
73+
74+
pub fn executor(&self) -> &Arc<dyn SQLExecutor> {
75+
&self.executor
76+
}
7677
}
7778

7879
impl FederationProvider for SQLFederationProvider {
@@ -134,13 +135,17 @@ impl AnalyzerRule for SQLFederationAnalyzerRule {
134135

135136
#[derive(Debug)]
136137
pub struct SQLFederationPlanner {
137-
pub executor: Arc<dyn SQLExecutor>,
138+
pub(crate) executor: Arc<dyn SQLExecutor>,
138139
}
139140

140141
impl SQLFederationPlanner {
141142
pub fn new(executor: Arc<dyn SQLExecutor>) -> Self {
142143
Self { executor }
143144
}
145+
146+
pub fn executor(&self) -> &Arc<dyn SQLExecutor> {
147+
&self.executor
148+
}
144149
}
145150

146151
#[async_trait]
@@ -323,11 +328,11 @@ impl DisplayAs for VirtualExecutionPlan {
323328
write!(f, " base_sql={statement}")?;
324329
}
325330

326-
let (logical_optimizers, ast_analyzers, _sql_query_rewriters) = match gather_analyzers(&plan)
327-
{
328-
Ok(analyzers) => analyzers,
329-
Err(_) => return Ok(()),
330-
};
331+
let (logical_optimizers, ast_analyzers, _sql_query_rewriters) =
332+
match gather_analyzers(&plan) {
333+
Ok(analyzers) => analyzers,
334+
Err(_) => return Ok(()),
335+
};
331336

332337
let old_plan = plan.clone();
333338

@@ -471,9 +476,7 @@ mod tests {
471476
use datafusion::prelude::Expr;
472477
use datafusion::sql::unparser::dialect::Dialect;
473478
use datafusion::sql::unparser::{self};
474-
use datafusion::sql::TableReference;
475479
use datafusion::{
476-
common::DFSchema,
477480
arrow::datatypes::{DataType, Field},
478481
datasource::TableProvider,
479482
execution::context::SessionContext,

0 commit comments

Comments
 (0)