Commit Graph

32 Commits

Author SHA1 Message Date
Oleks V df8f818b29 chore: Avoid build fails on MinIO rate limits (#20472)
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- Closes #.

## Rationale for this change
Sometimes CI failed because of docker rates limits.
```
thread 'test_s3_url_fallback' (11052) panicked at datafusion-cli/tests/cli_integration.rs:116:13:
Failed to start MinIO container. Ensure Docker is running and accessible: failed to pull the image 'minio/minio:RELEASE.2025-02-28T09-55-16Z', error: Docker responded with status code 500: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
stack backtrace:
```
Example
https://github.com/apache/datafusion/actions/runs/22262073722/job/64401977127
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

## What changes are included in this PR?

Ignore the tests if rates limit hit only

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

## Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
2026-02-23 16:09:01 +00:00
Eren Avsarogullari 4d06c40d8d Improve ExternalSorter ResourcesExhausted Error Message (#20226)
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- Closes #20225.

## Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
When there is not enough memory to continue external sort, either
increasing the `memory limit` or decreasing
`sort_spill_reservation_bytes` need to be applied. It can be useful to
guide the user with clearer error message by highlighting required
configs for the consistency because expected settings are as follows:
```
SET datafusion.runtime.memory_limit = '10G'
SET datafusion.execution.sort_spill_reservation_bytes = 10485760
```
Current:
```
Not enough memory to continue external sort. Consider increasing the memory limit, 
or decreasing sort_spill_reservation_bytes
```
New:
```
Not enough memory to continue external sort. Consider increasing the memory limit config: 
'datafusion.runtime.memory_limit', or decreasing the config: 'datafusion.execution.sort_spill_reservation_bytes'.
```

## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
A new UT case has been added to cover this use-case and it has been
tested locally successfully.

**For updated snapshot files:**
Following integration tests have been successful by DataFusion Test
Pipeline:
```
test test_cli_top_memory_consumers::case_1 ... ok
test test_cli_top_memory_consumers::case_2 ... ok
test test_cli_top_memory_consumers::case_3 ... ok
```
**Ref:**
https://github.com/apache/datafusion/actions/runs/21811797863/job/62925363536?pr=20226

## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
Yes, improving legacy `ExternalSorter` `ResourcesExhausted` Error
Message.

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
2026-02-12 20:27:29 +00:00
Jeffrey Vo 09455f1814 chore: bump testcontainers-modules to 0.14 and remove testcontainers dep (#19620)
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- Supersedes #19010

## Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

We don't actually need the dependency on `testcontainers` per their
README:

> **Note**: you don't need to explicitly depend on `testcontainers` as
it's re-exported dependency of `testcontainers-modules` with aligned
version between these crates.

-
https://github.com/testcontainers/testcontainers-rs-modules-community/blob/331abcc6e61d9d76e5f8e6ec91566ce874d8fc32/README.md

It was causing some version conflict issues when we tried to bump
`testcontainers-modules` so remove it and keep only modules, fixing the
code to use the re-exports.

## What changes are included in this PR?

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

Remove `testcontainers` dependency, amend imports to use re-exports of
`testcontainers-modules`.

Bump `testcontainers-modules` from 0.13 to 0.14.

## Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

CLI test suite compiles and runs. Ran the SLT postgres compat mode
locally successfully:

```sh
datafusion (testcontainers-0.14)$ PG_COMPAT=true PG_URI="postgresql://postgres@127.0.0.1/postgres" cargo test --features=postgres --test sqllogictests
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.19s
     Running bin/sqllogictests.rs (/Users/jeffrey/.cargo_target_cache/debug/deps/sqllogictests-223c346f75c524e2)
Completed 6 test files in 0 seconds 
```

## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

No.

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
2026-01-03 19:31:21 +00:00
kosiew ead8209803 update insta snapshots (#19381)
## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- Closes #19380.

## Rationale for this change

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

Snapshot test passes but the existing value is in a legacy format.

Updated insta snapshots to new format by running 
`cargo insta test --force-update-snapshots`

## What changes are included in this PR?

Snapshots in various directories.

<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

## Are these changes tested?

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
Yes
## Are there any user-facing changes?

<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->

No

<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
No
2025-12-18 17:31:01 +00:00
Tim Saucer 1f26716280 Update 4 crates to rust 2024 edition (#19357)
## Which issue does this PR close?

This addresses part of https://github.com/apache/datafusion/issues/15804
but does not close it.

## Rationale for this change

Now that we are on MSRV 1.88 we can use rust edition 2024, which brings
let chains and other nice features. It also improves `unsafe` checking.
In order to introduce these changes in slower way instead of one massive
PR that is too difficult to manage we are updating a few crates at a
time.

## What changes are included in this PR?

Updates these crates to 2024.

- datafusion-cli
- datafusion-proto
- datafusion-substrait
- datafusion-wasmtest

## Are these changes tested?

Existing unit tests. There are no functional code changes.

## Are there any user-facing changes?

None.

## Note

It is recommended to review with the ignore whitespace setting:
https://github.com/apache/datafusion/pull/19357/files?w=1
2025-12-16 20:04:38 +00:00
Blake Orth d5ea5e9876 Adds DELETE and HEAD instrumentation to CLI (#18206)
## Which issue does this PR close?


This does not fully close, but is an incremental building block
component for:
 - https://github.com/apache/datafusion/issues/17207

The full context of how this code is likely to progress can be seen in
the POC for this effort:
 - https://github.com/apache/datafusion/pull/17266

## Rationale for this change

Further fills out method instrumentation

## What changes are included in this PR?

- Adds instrumentation to head requests in the instrumented object store
- Adds instrumentatin to delete requests in the instrumented object
store
 - Adds tests for new code

## Are these changes tested?

Yes. New unit tests have been added.

## Are there any user-facing changes?

No-ish

##
cc @alamb
2025-10-21 19:30:09 +00:00
Andrew Lamb 5a074ea4c8 Improve datafusion-cli object store profiling summary display (#18085)
## Which issue does this PR close?

- part of https://github.com/apache/datafusion/issues/17207

## Rationale for this change

As suggested by @BlakeOrth in
https://github.com/apache/datafusion/pull/18045#issuecomment-3403692516
here is an attempt to improve the output of datafusion object store
trace profiling:

## What changes are included in this PR?

Update the output format when `\object_store_profiling summary` is set

Current format (on main, before this PR):
```sql
Summaries:
Get
count: 2
duration min: 0.024603s
duration max: 0.031946s
duration avg: 0.028274s
size min: 8 B
size max: 34322 B
size avg: 17165 B
size sum: 34330 B
```


New format (after this PR):

```sql
DataFusion CLI v50.2.0
> \object_store_profiling summary
ObjectStore Profile mode set to Summary
> select count(*) from 'https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_1.parquet';
+----------+
| count(*) |
+----------+
| 1000000  |
+----------+
1 row(s) fetched.
Elapsed 6.754 seconds.

Object Store Profiling
Instrumented Object Store: instrument_mode: Summary, inner: HttpStore
Summaries:
+-----------+----------+-----------+-----------+-----------+-----------+-------+
| Operation | Metric   | min       | max       | avg       | sum       | count |
+-----------+----------+-----------+-----------+-----------+-----------+-------+
| Get       | duration | 0.031645s | 0.047780s | 0.039713s | 0.079425s | 2     |
| Get       | size     | 8 B       | 34322 B   | 17165 B   | 34330 B   | 2     |
+-----------+----------+-----------+-----------+-----------+-----------+-------+
```



## Are these changes tested?
Yes
## Are there any user-facing changes?
Nicer datafusion-cli output
2025-10-17 21:10:13 +00:00
Blake Orth 3bca1bb6eb Adds Trace and Summary to CLI instrumented stores (#18064)
- Adds the ability for a user to choose a summary only output for an
   instrumented object store when using the CLI
 - The existing "enabled" setting that displays both a summary and a
   detailed usage for each object store call has been renamed to `Trace`
   to improve clarity
 - Adds additional test cases for summary only and modifies existing
   tests to use trace
 - Updates user guide docs to reflect the CLI flag and command line
   changes
2025-10-16 10:38:08 +00:00
Blake Orth ca2585e752 Adds summary output to CLI instrumented object stores (#18045)
* Adds summary output to CLI instrumented object stores
 - Adds a `RequestSummary` type for the instrumented object store to
   display summary statistics about instrumented requests
 - Adds a generic Stats type to track the statistics for the summary
 - Adds tests for the new code
 - Adds a basic summary output to the user-facing display when profiling
   is enabled
 - Adds docs for new and newly exported public items

* - Updates integration test and validation snapshot
2025-10-14 21:26:25 +00:00
Blake Orth a1acf775a9 Adds instrumentation to get requests for datafusion-cli (#18016)
* Adds instrumentation to get requests for datafusion-cli
 - Adds request instrumentation to GET operations when using the
   InstrumentedObjectStore in datafusion-cli
 - Adds RequestDetails type to store and format details about
   instrumented requests
 - Adds tests for new functionality

* Add cli-integration test

* Verify the contents of the reqest

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2025-10-11 13:13:40 +00:00
Andy Grove a9d04606b4 minor: Include consumer name in OOM message (#17870)
* include consumer name in oom message

* update more tests

* more test updates
2025-10-02 05:15:48 +00:00
Jensen 528ed60bcd Improved experience when remote object store URL does not end in / (#17364)
* Improved experience when remote object store URL does not end in /

* refactor

* fix code style

* fix

* fix

* Simplify implementation, add more tests

* tweak

* Add comments

* fix and test non existing

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2025-09-06 06:37:33 -04:00
Ruihang Xia 1c86ec7f52 chore: fix typos (#17135)
Co-authored-by: Piotr Findeisen <piotr.findeisen@gmail.com>
2025-08-27 14:14:40 -07:00
Zhen Wang 1756692218 feat: Track peak value in tracked consumer (#17327)
* feat: Track peak value in tracked consumer

* fmt

* fix test
2025-08-26 20:03:14 +08:00
Jeffrey Vo 8c58f532a1 Configure cli test that requires backtrace to be optional (#17236)
* Configure cli test that requires backtrace to be optional

* Fix format
2025-08-20 11:21:15 +08:00
Yongting You 420a862faa Fix: Show backtrace for ArrowError (#17204)
* fix backtrace for ArrowError

* Update datafusion-cli/tests/cli_integration.rs

* fix tests
2025-08-17 16:58:01 +08:00
Piotr Findeisen 43718d5fff Differentiate 0-row and 1-row EmptyRelation in EXPLAIN (#17145)
* Differentiate 0-row and 1-row EmptyRelation in EXPLAIN

The `LogicalPlan::EmptyRelation` can produce no rows or exactly 1 null
(placeholder) row of the requested schema. When viewing EXPLAIN output
of a LogicalPlan it's good to know which one is the case.

* empty: re-run CI
2025-08-13 01:11:05 -07:00
Geetansh Juneja fe45258c61 add filter to handle backtrace (#16752)
* add filter to handle backtrace

* change filter

* update snapshots

* change backtrace block regex
2025-07-15 20:25:45 +01:00
Dmitrii Blaginin e1a1889229 Auto start testcontainers for datafusion-cli (#16644) 2025-07-14 21:27:08 +01:00
Liam Bao 3649dc80ce datafusion-cli: Use correct S3 region if it is not specified (#16502)
* datafusion-cli: Use correct S3 region if it is not specified

* Simplify the retry logic
2025-06-26 11:39:49 -04:00
ding-young cb45f1f9cc add top-memory-consumers option in cli (#16081)
add snapshot tests for memory exhaustion
2025-05-22 14:25:36 +08:00
Hamir Mahal c74faee425 style: simplify some strings for readability (#15999)
* style: simplify some strings for readability

* fix: formatting in `datafusion/` directory

* refactor: replace long `format!` string

* refactor: replace `format!` with `assert_eq!`

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2025-05-15 15:42:55 -04:00
Dmitrii Blaginin f40e0db161 Add FormatOptions to Config (#15793)
* Add `FormatOptions` to Config

* Fix `output_with_header`

* Add cli test

* Add `to_string`

* Prettify

* Prettify

* Preserve the initial `NULL` logic

* Cleanup

* Remove `lt` as no longer needed

* Format assert

* Fix sqllogictest

* Fix tests

* Set formatting params for dates / times

* Lowercase `duration_format`

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2025-05-02 18:55:41 +01:00
Andrew Lamb 7850cef6ef Change default EXPLAIN format in datafusion-cli to tree format (#15427)
* Change default explain plan to `tree`

* Add tests

* remove unecessary changes

* more unecessary changes

* Move test cases

* Respect environment variable for explain plan

* Fix format

* fmt

---------

Co-authored-by: blaginin <dmitrii@blaginin.me>
2025-03-31 10:09:08 -04:00
Dmitrii Blaginin 51f0833dfe Add insta / snapshot testing to CLI & set up AWS mock (#13672)
* Do not normalize values

* Fix tests & update docs

* Prettier

* Lowercase config params

* Add snap to CLI & set up AWS mock

* Refactor tests

* Unify transform and parse

* Fix tests

* Setup CLI

* Show minio output

* Format Cargo.toml

* Do not hardcode AWS params

* Test options parsing

* Add allow http

* Fix aws build

* Fix ip

* Remove slash ☠️

* Format cargo toml

* Remove integration_setup.bash

* Update docs

* Do not hardcode test names

* Relock cargo

* Remove aws sdk and set up minio in-place

* Nit: Add missing ready local to the docs

* Fix backslash test

* Add missing backslash

* put integration scripts in a separate folder

* Move s3 tests from extended to rust flow

* Reorganise the docs

* Prettier

* Do not use rust container to get docker

* Add missing protobuf

* revert change to extended.yml

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2025-03-11 10:57:44 -04:00
Andrew Lamb 382e2327ec Revert Datafusion-cli: Redesign the datafusion-cli execution and print, make it totally streaming printing without memory overhead (#14948)
* Revert "Fix: New Datafusion-cli streaming printing way should handle corner case for only one small batch which lines are less than max_rows (#14921)"

This reverts commit 463ef3b8bc.

* Revert "Datafusion-cli: Redesign the datafusion-cli execution and print, make it totally streaming printing without memory overhead (#14877)"

This reverts commit 53fc94f22f.
2025-03-01 11:53:13 +08:00
Lordworms cf2b7e6054 Do not unescape backslashes in datafusion-cli (#14844)
* correctly treat backslash in datafusion-cli

* Remove all cli unescaping

* remove unnessasary check

* refine test

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2025-02-28 07:24:39 -05:00
Qi Zhu 463ef3b8bc Fix: New Datafusion-cli streaming printing way should handle corner case for only one small batch which lines are less than max_rows (#14921)
* BUG: fix datafusion-cli missing case with only one batch and smaller than max_rows size

* Fix

* Add test case
2025-02-28 15:19:39 +08:00
tison f05458678b build(deps): upgrade sqlparser to 0.47.0 (#10392)
* build(deps): upgrade sqlparser to 0.46.0

Signed-off-by: tison <wander4096@gmail.com>

* function and cast fixups

* catchup refactors

Signed-off-by: tison <wander4096@gmail.com>

* try migrate json expr

Signed-off-by: tison <wander4096@gmail.com>

* Update for changes in sqlparser

* Update dependencies

* handle zero argument form

* fmt

* fixup more

Signed-off-by: tison <wander4096@gmail.com>

* fixup more

Signed-off-by: tison <wander4096@gmail.com>

* try use jmhain's branch

Signed-off-by: tison <wander4096@gmail.com>

* fix compile FunctionArgumentClause exhausted

Signed-off-by: tison <wander4096@gmail.com>

* fix compile set multi vars

Signed-off-by: tison <wander4096@gmail.com>

* fix compile new string values

Signed-off-by: tison <wander4096@gmail.com>

* fix compile set multi vars

Signed-off-by: tison <wander4096@gmail.com>

* fix compile Subscript

Signed-off-by: tison <wander4096@gmail.com>

* cargo fmt

Signed-off-by: tison <wander4096@gmail.com>

* revert workaround on values

Signed-off-by: tison <wander4096@gmail.com>

* Rework field access

* update lock

* fix doc

* try catchup new sqlparser version

Signed-off-by: tison <wander4096@gmail.com>

* fixup timezone expr

Signed-off-by: tison <wander4096@gmail.com>

* fixup params

Signed-off-by: tison <wander4096@gmail.com>

* lock

Signed-off-by: tison <wander4096@gmail.com>

* Update to sqlparser 0.47.0

* Update rust stack size on windows

* Revert "Update rust stack size on windows"

This reverts commit b5743d55a3992880a8d5c6f359c28aa4fa17c98a.

* Add test + support for `$$` function definition

* Disable failing windows CI test

* fmt

* simplify test

* fmt

---------

Signed-off-by: tison <wander4096@gmail.com>
Co-authored-by: Joey Hain <hain.joseph@gmail.com>
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2024-06-06 16:37:16 -04:00
comphead e23d34bae6 Support SHOW ALL VERBOSE to show settings description (#7735)
* Expand SHOW ALL stmt to show settings description

* cli tests

* comments
2023-10-07 07:00:53 -04:00
Niwaka 1901d6fd41 feat: allow datafusion-cli to accept multiple statements (#7138)
* feat: allow cli to accept multiple statements

* add empty line between results

* use current context dialect

* move empty line to print_timing_info
2023-08-03 08:44:15 -04:00
r.4ntix 7d3cae0699 feat: add -c option to pass the SQL query directly as an argument on datafusion-cli (#6765)
* feat: add `-c option` to pass the SQL query directly as an argument on datafusion-cli

* feat: add integration tests of datafusion-cli

* chore: exclude test data files of datafusion-cli from RAT check
2023-06-26 16:27:58 -04:00