Skip to content

Commit 8f79fc6

Browse files
committed
Merge remote-tracking branch 'upstream/main' into hash_join_batch_size
2 parents c8914a8 + be361fd commit 8f79fc6

File tree

146 files changed

+6600
-3274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+6600
-3274
lines changed

.github/actions/setup-builder/action.yaml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,8 @@ runs:
3838
rustup toolchain install ${{ inputs.rust-version }}
3939
rustup default ${{ inputs.rust-version }}
4040
rustup component add rustfmt
41-
- name: Disable debuginfo generation
42-
# Disable full debug symbol generation to speed up CI build and keep memory down
43-
# "1" means line tables only, which is useful for panic tracebacks.
44-
shell: bash
45-
run: echo "RUSTFLAGS=-C debuginfo=1" >> $GITHUB_ENV
46-
- name: Disable incremental compilation
47-
# Disable incremental compilation to save diskspace (the CI doesn't recompile modified files)
48-
# https://github.com/apache/arrow-datafusion/issues/6676
49-
shell: bash
50-
run: echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
51-
- name: Enable backtraces
52-
shell: bash
53-
run: echo "RUST_BACKTRACE=1" >> $GITHUB_ENV
41+
- name: Configure rust runtime env
42+
uses: ./.github/actions/setup-rust-runtime
5443
- name: Fixup git permissions
5544
# https://github.com/actions/checkout/issues/766
5645
shell: bash
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
name: Prepare Rust Builder for MacOS
19+
description: 'Prepare Rust Build Environment for MacOS'
20+
inputs:
21+
rust-version:
22+
description: 'version of rust to install (e.g. stable)'
23+
required: true
24+
default: 'stable'
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Install protobuf compiler
29+
shell: bash
30+
run: |
31+
mkdir -p $HOME/d/protoc
32+
cd $HOME/d/protoc
33+
export PROTO_ZIP="protoc-21.4-osx-x86_64.zip"
34+
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
35+
unzip $PROTO_ZIP
36+
echo "$HOME/d/protoc/bin" >> $GITHUB_PATH
37+
export PATH=$PATH:$HOME/d/protoc/bin
38+
protoc --version
39+
- name: Setup Rust toolchain
40+
shell: bash
41+
run: |
42+
rustup update stable
43+
rustup toolchain install stable
44+
rustup default stable
45+
rustup component add rustfmt
46+
- name: Configure rust runtime env
47+
uses: ./.github/actions/setup-rust-runtime
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
name: Setup Rust Runtime
19+
description: 'Setup Rust Runtime Environment'
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Run sccache-cache
24+
uses: mozilla-actions/[email protected]
25+
- name: Configure runtime env
26+
shell: bash
27+
# do not produce debug symbols to keep memory usage down
28+
# hardcoding other profile params to avoid profile override values
29+
# More on Cargo profiles https://doc.rust-lang.org/cargo/reference/profiles.html?profile-settings#profile-settings
30+
#
31+
# Set debuginfo=line-tables-only as debuginfo=0 causes immensely slow build
32+
# See for more details: https://github.com/rust-lang/rust/issues/119560
33+
#
34+
# set RUST_MIN_STACK to avoid rust stack overflows on tpc-ds tests
35+
run: |
36+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
37+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
38+
echo "RUST_BACKTRACE=1" >> $GITHUB_ENV
39+
echo "RUST_MIN_STACK=3000000" >> $GITHUB_ENV
40+
echo "RUST_FLAGS=-C debuginfo=line-tables-only -C incremental=false" >> $GITHUB_ENV
41+
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+
name: Prepare Rust Builder for Windows
19+
description: 'Prepare Rust Build Environment for Windows'
20+
inputs:
21+
rust-version:
22+
description: 'version of rust to install (e.g. stable)'
23+
required: true
24+
default: 'stable'
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Install protobuf compiler
29+
shell: bash
30+
run: |
31+
mkdir -p $HOME/d/protoc
32+
cd $HOME/d/protoc
33+
export PROTO_ZIP="protoc-21.4-win64.zip"
34+
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
35+
unzip $PROTO_ZIP
36+
export PATH=$PATH:$HOME/d/protoc/bin
37+
protoc.exe --version
38+
- name: Setup Rust toolchain
39+
shell: bash
40+
run: |
41+
rustup update stable
42+
rustup toolchain install stable
43+
rustup default stable
44+
rustup component add rustfmt
45+
- name: Configure rust runtime env
46+
uses: ./.github/actions/setup-rust-runtime

.github/workflows/rust.yml

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,9 @@ jobs:
9696
- name: Setup Rust toolchain
9797
uses: ./.github/actions/setup-builder
9898
with:
99-
rust-version: stable
99+
rust-version: stable
100100
- name: Run tests (excluding doctests)
101101
run: cargo test --lib --tests --bins --features avro,json,backtrace
102-
env:
103-
# do not produce debug symbols to keep memory usage down
104-
# hardcoding other profile params to avoid profile override values
105-
# More on Cargo profiles https://doc.rust-lang.org/cargo/reference/profiles.html?profile-settings#profile-settings
106-
RUSTFLAGS: "-C debuginfo=0 -C opt-level=0 -C incremental=false -C codegen-units=256"
107-
RUST_BACKTRACE: "1"
108-
# avoid rust stack overflows on tpc-ds tests
109-
RUST_MINSTACK: "3000000"
110102
- name: Verify Working Directory Clean
111103
run: git diff --exit-code
112104

@@ -284,80 +276,31 @@ jobs:
284276
- uses: actions/checkout@v4
285277
with:
286278
submodules: true
287-
- name: Install protobuf compiler
288-
shell: bash
289-
run: |
290-
mkdir -p $HOME/d/protoc
291-
cd $HOME/d/protoc
292-
export PROTO_ZIP="protoc-21.4-win64.zip"
293-
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
294-
unzip $PROTO_ZIP
295-
export PATH=$PATH:$HOME/d/protoc/bin
296-
protoc.exe --version
297-
# TODO: this won't cache anything, which is expensive. Setup this action
298-
# with a OS-dependent path.
299279
- name: Setup Rust toolchain
300-
run: |
301-
rustup update stable
302-
rustup toolchain install stable
303-
rustup default stable
304-
rustup component add rustfmt
280+
uses: ./.github/actions/setup-windows-builder
305281
- name: Run tests (excluding doctests)
306282
shell: bash
307283
run: |
308284
export PATH=$PATH:$HOME/d/protoc/bin
309285
cargo test --lib --tests --bins --features avro,json,backtrace
310286
cd datafusion-cli
311287
cargo test --lib --tests --bins --all-features
312-
env:
313-
# do not produce debug symbols to keep memory usage down
314-
# use higher optimization level to overcome Windows rust slowness for tpc-ds
315-
# and speed builds: https://github.com/apache/arrow-datafusion/issues/8696
316-
# Cargo profile docs https://doc.rust-lang.org/cargo/reference/profiles.html?profile-settings#profile-settings
317-
RUSTFLAGS: "-C debuginfo=0 -C opt-level=1 -C target-feature=+crt-static -C incremental=false -C codegen-units=256"
318-
RUST_BACKTRACE: "1"
319-
# avoid rust stack overflows on tpc-ds tests
320-
RUST_MINSTACK: "3000000"
288+
321289
macos:
322-
name: cargo test (mac)
290+
name: cargo test (macos)
323291
runs-on: macos-latest
324292
steps:
325293
- uses: actions/checkout@v4
326294
with:
327-
submodules: true
328-
- name: Install protobuf compiler
329-
shell: bash
330-
run: |
331-
mkdir -p $HOME/d/protoc
332-
cd $HOME/d/protoc
333-
export PROTO_ZIP="protoc-21.4-osx-x86_64.zip"
334-
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.4/$PROTO_ZIP
335-
unzip $PROTO_ZIP
336-
echo "$HOME/d/protoc/bin" >> $GITHUB_PATH
337-
export PATH=$PATH:$HOME/d/protoc/bin
338-
protoc --version
339-
# TODO: this won't cache anything, which is expensive. Setup this action
340-
# with a OS-dependent path.
295+
submodules: true
341296
- name: Setup Rust toolchain
342-
run: |
343-
rustup update stable
344-
rustup toolchain install stable
345-
rustup default stable
346-
rustup component add rustfmt
297+
uses: ./.github/actions/setup-macos-builder
347298
- name: Run tests (excluding doctests)
348299
shell: bash
349300
run: |
350301
cargo test --lib --tests --bins --features avro,json,backtrace
351302
cd datafusion-cli
352-
cargo test --lib --tests --bins --all-features
353-
env:
354-
# do not produce debug symbols to keep memory usage down
355-
# hardcoding other profile params to avoid profile override values
356-
# More on Cargo profiles https://doc.rust-lang.org/cargo/reference/profiles.html?profile-settings#profile-settings
357-
RUSTFLAGS: "-C debuginfo=0 -C opt-level=0 -C incremental=false -C codegen-units=256"
358-
RUST_BACKTRACE: "1"
359-
# avoid rust stack overflows on tpc-ds tests
360-
RUST_MINSTACK: "3000000"
303+
cargo test --lib --tests --bins --all-features
361304
362305
test-datafusion-pyarrow:
363306
name: cargo test pyarrow (amd64)

datafusion-cli/src/exec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ use url::Url;
5151
/// run and execute SQL statements and commands, against a context with the given print options
5252
pub async fn exec_from_commands(
5353
ctx: &mut SessionContext,
54-
print_options: &PrintOptions,
5554
commands: Vec<String>,
55+
print_options: &PrintOptions,
5656
) {
5757
for sql in commands {
5858
match exec_and_print(ctx, print_options, sql).await {
@@ -105,8 +105,8 @@ pub async fn exec_from_lines(
105105
}
106106

107107
pub async fn exec_from_files(
108-
files: Vec<String>,
109108
ctx: &mut SessionContext,
109+
files: Vec<String>,
110110
print_options: &PrintOptions,
111111
) {
112112
let files = files

datafusion-cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub async fn main() -> Result<()> {
216216

217217
if commands.is_empty() && files.is_empty() {
218218
if !rc.is_empty() {
219-
exec::exec_from_files(rc, &mut ctx, &print_options).await
219+
exec::exec_from_files(&mut ctx, rc, &print_options).await
220220
}
221221
// TODO maybe we can have thiserror for cli but for now let's keep it simple
222222
return exec::exec_from_repl(&mut ctx, &mut print_options)
@@ -225,11 +225,11 @@ pub async fn main() -> Result<()> {
225225
}
226226

227227
if !files.is_empty() {
228-
exec::exec_from_files(files, &mut ctx, &print_options).await;
228+
exec::exec_from_files(&mut ctx, files, &print_options).await;
229229
}
230230

231231
if !commands.is_empty() {
232-
exec::exec_from_commands(&mut ctx, &print_options, commands).await;
232+
exec::exec_from_commands(&mut ctx, commands, &print_options).await;
233233
}
234234

235235
Ok(())

datafusion-cli/src/print_options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ impl PrintOptions {
141141
let mut row_count = 0_usize;
142142
let mut with_header = true;
143143

144-
while let Some(Ok(batch)) = stream.next().await {
144+
while let Some(maybe_batch) = stream.next().await {
145+
let batch = maybe_batch?;
145146
row_count += batch.num_rows();
146147
self.format.print_batches(
147148
&mut writer,

datafusion-examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ cargo run --example csv_sql
6262
- [`simple_udf.rs`](examples/simple_udf.rs): Define and invoke a User Defined Scalar Function (UDF)
6363
- [`advanced_udf.rs`](examples/advanced_udf.rs): Define and invoke a more complicated User Defined Scalar Function (UDF)
6464
- [`simple_udaf.rs`](examples/simple_udaf.rs): Define and invoke a User Defined Aggregate Function (UDAF)
65+
- [`advanced_udaf.rs`](examples/advanced_udaf.rs): Define and invoke a more complicated User Defined Aggregate Function (UDAF)
6566
- [`simple_udfw.rs`](examples/simple_udwf.rs): Define and invoke a User Defined Window Function (UDWF)
6667
- [`advanced_udwf.rs`](examples/advanced_udwf.rs): Define and invoke a more complicated User Defined Window Function (UDWF)
6768

0 commit comments

Comments
 (0)