Skip to content

Commit 40aaaab

Browse files
committed
Merge branch 'main' of https://github.com/apache/datafusion into prune_parquet
2 parents 5a2d7d4 + 991fd23 commit 40aaaab

19 files changed

Lines changed: 230 additions & 61 deletions

‎.asf.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ github:
8787
- "check Cargo.toml formatting"
8888
- "check configs.md and ***_functions.md is up-to-date"
8989
- "check example README is up-to-date"
90+
- "Check datafusion crates used in datafusion-examples"
9091
- "Verify MSRV (Min Supported Rust Version)"
9192
# needs to be updated as part of the release process
9293
# .asf.yaml doesn't support wildcard branch protection rules, only exact branch names
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Add the expected target version as a label to a merged PR.
19+
# The "target_version" is automatically updated by the dev/update_datafusion_versions.py script.
20+
21+
name: Release Version Labeler
22+
23+
concurrency:
24+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
25+
cancel-in-progress: true
26+
27+
on:
28+
pull_request_target:
29+
types:
30+
- closed
31+
branches:
32+
- main
33+
34+
jobs:
35+
label:
36+
if: github.event.pull_request.merged == true
37+
runs-on: ubuntu-slim
38+
permissions:
39+
pull-requests: write
40+
steps:
41+
- name: Add the target release version
42+
uses: actions/github-script@v9.0.0
43+
with:
44+
script: |
45+
const labeler = require('./ci/scripts/release_version_labeler.js');
46+
await labeler({ github, context });

‎.github/workflows/rust.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,16 @@ jobs:
897897
run: |
898898
bash ci/scripts/check_examples_docs.sh
899899
900+
# Ensures that the examples only use the main `datafusion` crate and not its subcrates, which are
901+
# already exported by `datafusion` (there are a few exceptions, like `datafusion-proto`).
902+
# See: https://github.com/apache/datafusion/pull/14305
903+
examples-check-datafusion-crates:
904+
name: Check datafusion crates used in datafusion-examples
905+
runs-on: ubuntu-slim
906+
steps:
907+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
908+
- run: python3 ci/scripts/check_examples_datafusion_crates.py
909+
900910
# Verify MSRV for the crates which are directly used by other projects:
901911
# - datafusion
902912
# - datafusion-substrait

‎Cargo.lock‎

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env python3
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
# Checks if datafusion-examples uses `datafusion-...` subcrates unnecessarily, as they are already
20+
# exported by the `datafusion` crate.
21+
22+
import tomllib
23+
import sys
24+
25+
allowed_datafusion_crates = {
26+
"datafusion",
27+
"datafusion-proto",
28+
"datafusion-substrait",
29+
}
30+
31+
crates = set()
32+
with open("datafusion-examples/Cargo.toml", "rb") as f:
33+
cargo = tomllib.load(f)
34+
for section in ("dependencies", "dev-dependencies", "build-dependencies"):
35+
crates.update(
36+
value.get("package", name) if isinstance(value, dict) else name
37+
for name, value in cargo.get(section, {}).items()
38+
)
39+
40+
crates = [
41+
crate for crate in crates if "datafusion" in crate and crate not in allowed_datafusion_crates
42+
]
43+
44+
if len(crates) > 0:
45+
print(
46+
"datafusion-examples should only use the main datafusion crate and not its subcrates.",
47+
file=sys.stderr,
48+
)
49+
print(
50+
f"Please remove the following crates and use `datafusion::...` instead: {crates}.",
51+
file=sys.stderr,
52+
)
53+
54+
sys.exit(1)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
// Used by the release_version_labeler workflow
19+
20+
module.exports = async ({ github, context }) => {
21+
const target_version = 'v56.0.0';
22+
23+
// create label first if not exists
24+
try {
25+
await github.rest.issues.getLabel({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
name: target_version
29+
});
30+
} catch (error) {
31+
if (error.status === 404) {
32+
await github.rest.issues.createLabel({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
name: target_version,
36+
color: '222222'
37+
});
38+
} else {
39+
throw error;
40+
}
41+
}
42+
43+
await github.rest.issues.addLabels({
44+
owner: context.repo.owner,
45+
repo: context.repo.repo,
46+
issue_number: context.payload.pull_request.number,
47+
labels: [target_version]
48+
});
49+
};

‎datafusion-examples/Cargo.toml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,19 @@ workspace = true
3838
[dependencies]
3939
arrow = { workspace = true }
4040
arrow-schema = { workspace = true }
41+
# note: only use the main datafusion crate for examples
4142
datafusion = { workspace = true, default-features = true, features = ["parquet_encryption"] }
42-
datafusion-common = { workspace = true }
4343
nom = "8.0.0"
4444
tempfile = { workspace = true }
4545
tokio = { workspace = true, features = ["rt-multi-thread", "parking_lot", "fs"] }
4646

4747
[dev-dependencies]
4848
arrow-flight = { workspace = true }
4949
async-trait = { workspace = true }
50+
base64 = "0.23.0"
5051
bytes = { workspace = true }
5152
dashmap = { workspace = true }
52-
# note only use main datafusion crate for examples
53-
base64 = "0.23.0"
54-
datafusion-expr = { workspace = true }
55-
datafusion-physical-expr-adapter = { workspace = true }
5653
datafusion-proto = { workspace = true, features = ["parquet"] }
57-
datafusion-sql = { workspace = true }
5854
env_logger = { workspace = true }
5955
futures = { workspace = true }
6056
insta = { workspace = true }

‎datafusion-examples/examples/custom_data_source/adapter_serialization.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ use datafusion::execution::context::SessionContext;
5050
use datafusion::execution::object_store::ObjectStoreUrl;
5151
use datafusion::parquet::arrow::ArrowWriter;
5252
use datafusion::physical_expr::PhysicalExpr;
53-
use datafusion::physical_plan::ExecutionPlan;
54-
use datafusion::prelude::SessionConfig;
55-
use datafusion_physical_expr_adapter::{
53+
use datafusion::physical_expr_adapter::{
5654
DefaultPhysicalExprAdapterFactory, PhysicalExprAdapter, PhysicalExprAdapterFactory,
5755
};
56+
use datafusion::physical_plan::ExecutionPlan;
57+
use datafusion::prelude::SessionConfig;
5858
use datafusion_proto::bytes::{
5959
physical_plan_from_bytes_with_proto_converter,
6060
physical_plan_to_bytes_with_proto_converter,

‎datafusion-examples/examples/custom_data_source/custom_file_casts.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ use datafusion::execution::object_store::ObjectStoreUrl;
3434
use datafusion::parquet::arrow::ArrowWriter;
3535
use datafusion::physical_expr::PhysicalExpr;
3636
use datafusion::physical_expr::expressions::CastExpr;
37-
use datafusion::prelude::SessionConfig;
38-
use datafusion_physical_expr_adapter::{
37+
use datafusion::physical_expr_adapter::{
3938
DefaultPhysicalExprAdapterFactory, PhysicalExprAdapter, PhysicalExprAdapterFactory,
4039
};
40+
use datafusion::prelude::SessionConfig;
4141
use object_store::memory::InMemory;
4242
use object_store::path::Path;
4343
use object_store::{ObjectStore, ObjectStoreExt, PutPayload};

‎datafusion-examples/examples/custom_data_source/default_column_values.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ use datafusion::logical_expr::{Expr, TableProviderFilterPushDown, TableType};
3838
use datafusion::parquet::arrow::ArrowWriter;
3939
use datafusion::parquet::file::properties::WriterProperties;
4040
use datafusion::physical_expr::PhysicalExpr;
41-
use datafusion::physical_plan::ExecutionPlan;
42-
use datafusion::prelude::{SessionConfig, lit};
43-
use datafusion_physical_expr_adapter::{
41+
use datafusion::physical_expr_adapter::{
4442
DefaultPhysicalExprAdapterFactory, PhysicalExprAdapter, PhysicalExprAdapterFactory,
4543
replace_columns_with_literals,
4644
};
45+
use datafusion::physical_plan::ExecutionPlan;
46+
use datafusion::prelude::{SessionConfig, lit};
4747
use futures::StreamExt;
4848
use object_store::memory::InMemory;
4949
use object_store::path::Path;

0 commit comments

Comments
 (0)