forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove python docs (they're added to the python project in PR#)
fix some links and docs fix docker build for datafusion-cli and update docs improve left nav link naming for clarity consolidated the documentation for the CLI into one page per issue apache#1352 fix the CSV schema inference in datafusion-cli docs per apache#3001
- Loading branch information
1 parent
c179102
commit 86cd179
Showing
26 changed files
with
280 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
.git | ||
**target | ||
**/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,4 @@ | |
# under the License. | ||
|
||
build | ||
source/python/generated | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<!--- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
|
||
# DataFusion Command-line | ||
|
||
The Arrow DataFusion CLI is a command-line interactive SQL utility that allows | ||
queries to be executed against CSV, Json, Parquet, and Avro files. It embeds the DataFusion library | ||
in a command line utility and is a convenient way to try DataFusion with your own data sources. | ||
|
||
## Installation | ||
### Via Cargo | ||
|
||
If you already have the Rust toolchain installed, the easiest way to install DataFusion CLI is to install it via cargo: | ||
|
||
``` | ||
cargo install datafusion-cli | ||
``` | ||
|
||
Or you can build from source, taking the latest code from master: | ||
|
||
``` | ||
git clone https://github.com/apache/arrow-datafusion && cd arrow-datafusion\datafusion-cli | ||
cargo install --path . | ||
``` | ||
|
||
### Via Docker | ||
|
||
If you don't have the Rust toolchain installed, but you do have Docker, you can build DataFusion CLI inside Docker. | ||
There is no officially published Docker image for the DataFusion CLI, so it is necessary to build from source | ||
instead. | ||
|
||
Use the following commands to clone this repository and build a Docker image containing the CLI tool. | ||
|
||
``` | ||
git clone https://github.com/apache/arrow-datafusion && cd arrow-datafusion | ||
docker build -f datafusion-cli/Dockerfile . --tag datafusion-cli | ||
docker run -it -v $(your_data_location):/data datafusion-cli | ||
``` | ||
|
||
### Via Homebrew (on MacOS) | ||
|
||
DataFusion CLI can also be installed via Homebrew (on MacOS). Install it as any other pre-built software like this: | ||
|
||
``` | ||
brew install datafusion | ||
# ==> Downloading https://ghcr.io/v2/homebrew/core/datafusion/manifests/5.0.0 | ||
# ######################################################################## 100.0% | ||
# ==> Downloading https://ghcr.io/v2/homebrew/core/datafusion/blobs/sha256:9ecc8a01be47ceb9a53b39976696afa87c0a8 | ||
# ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:9ecc8a01be47ceb9a53b39976 | ||
# ######################################################################## 100.0% | ||
# ==> Pouring datafusion--5.0.0.big_sur.bottle.tar.gz | ||
# 🍺 /usr/local/Cellar/datafusion/5.0.0: 9 files, 17.4MB | ||
datafusion-cli | ||
``` | ||
|
||
## Usage | ||
|
||
``` | ||
Apache Arrow <dev@arrow.apache.org> | ||
Command Line Client for DataFusion query engine. | ||
USAGE: | ||
datafusion-cli [OPTIONS] | ||
OPTIONS: | ||
-c, --batch-size <BATCH_SIZE> The batch size of each query, or use DataFusion default | ||
-f, --file <FILE>... Execute commands from file(s), then exit | ||
--format <FORMAT> [default: table] [possible values: csv, tsv, table, json, | ||
nd-json] | ||
-h, --help Print help information | ||
-p, --data-path <DATA_PATH> Path to your data, default to current directory | ||
-q, --quiet Reduce printing other than the results and work quietly | ||
-r, --rc <RC>... Run the provided files on startup instead of ~/.datafusionrc | ||
-V, --version Print version information | ||
``` | ||
|
||
Type `\q` to exit the CLI. | ||
|
||
|
||
### Registering Parquet Data Sources | ||
|
||
Parquet data sources can be registered by executing a `CREATE EXTERNAL TABLE` SQL statement. It is not necessary to provide schema information for Parquet files. | ||
|
||
```sql | ||
CREATE EXTERNAL TABLE taxi | ||
STORED AS PARQUET | ||
LOCATION '/mnt/nyctaxi/tripdata.parquet'; | ||
``` | ||
|
||
### Registering CSV Data Sources | ||
|
||
CSV data sources can be registered by executing a `CREATE EXTERNAL TABLE` SQL statement. It is necessary to provide schema information for CSV files since DataFusion does not automatically infer the schema when using SQL to query CSV files. | ||
|
||
```sql | ||
CREATE EXTERNAL TABLE test ( | ||
c1 VARCHAR NOT NULL, | ||
c2 INT NOT NULL, | ||
c3 SMALLINT NOT NULL, | ||
c4 SMALLINT NOT NULL, | ||
c5 INT NOT NULL, | ||
c6 BIGINT NOT NULL, | ||
c7 SMALLINT NOT NULL, | ||
c8 INT NOT NULL, | ||
c9 BIGINT NOT NULL, | ||
c10 VARCHAR NOT NULL, | ||
c11 FLOAT NOT NULL, | ||
c12 DOUBLE NOT NULL, | ||
c13 VARCHAR NOT NULL | ||
) | ||
STORED AS CSV | ||
WITH HEADER ROW | ||
LOCATION '/path/to/aggregate_test_100.csv'; | ||
``` | ||
|
||
## CLI Commands | ||
|
||
Available commands inside DataFusion CLI are: | ||
|
||
| Command | Description | | ||
|:-----------------------|-------------------------------------| | ||
| `\q` | quit | | ||
| `\?` | help | | ||
| `\d` | list tables | | ||
| `\d table_name` | describe table | | ||
| `\quiet <true/false>` | enable/disable quiet mode | | ||
| `\h` | list available commands | | ||
| `\h function` | get help for specific command | | ||
| `\pset [NAME [VALUE]]` | set option (eg: `\pset format csv`) | | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.