Skip to content

Commit

Permalink
feat(README.md):添加struct和diff命令的文档说明
Browse files Browse the repository at this point in the history
fix(README.md):修正命令示例中的参数格式
  • Loading branch information
jimyag committed Nov 2, 2024
1 parent 525ff50 commit b74f8ce
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Supported reading from: http/https URL, local file, s3/s3a URL
- footer: Print the Parquet file footer in json format
- meta: Pretty Print a Parquet file's metadata
- schema: Pretty print the Avro schema for a file
- struct: Print the Go struct for a file
- diff: Diff two Parquet files schema

## Install

Expand All @@ -27,7 +29,7 @@ parquet-tools -h
pretty print the Avro schema for a file

``` bash
parquet-tools meta -f https://github.com/jimyag/parquet-tools/raw/main/testdata/v0.7.1.parquet
parquet-tools meta https://github.com/jimyag/parquet-tools/raw/main/testdata/v0.7.1.parquet
+-------------------------+------------------------------------------+
| KEY | VALUE |
+-------------------------+------------------------------------------+
Expand Down Expand Up @@ -187,7 +189,7 @@ required group field_id=-1 schema {
read from http or https

``` bash
parquet-tools schema -f https://github.com/jimyag/parquet-tools/raw/main/testdata/v0.7.1.parquet
parquet-tools schema https://github.com/jimyag/parquet-tools/raw/main/testdata/v0.7.1.parquet
required group field_id=-1 schema {
optional double field_id=-1 carat;
optional byte_array field_id=-1 cut (String);
Expand All @@ -203,10 +205,35 @@ required group field_id=-1 schema {
}
```

print the Go struct for a file

```bash
parquet-tools struct https://github.com/jimyag/parquet-tools/raw/main/testdata/v0.7.1.parquet
type schema struct {
Carat any `parquet:"carat"`
Cut string `parquet:"cut"`
Color string `parquet:"color"`
Clarity string `parquet:"clarity"`
Depth any `parquet:"depth"`
Table any `parquet:"table"`
Price any `parquet:"price"`
X any `parquet:"x"`
Y any `parquet:"y"`
Z any `parquet:"z"`
IndexLevel0 any `parquet:"__index_level_0__"`
}
```

diff two Parquet files schema

```bash
parquet-tools diff v0.7.1.parquet v0.7.2.parquet
```

read from local file

``` bash
parquet-tools schema -f v0.7.1.parquet
parquet-tools schema v0.7.1.parquet
required group field_id=-1 schema {
optional double field_id=-1 carat;
optional byte_array field_id=-1 cut (String);
Expand Down Expand Up @@ -235,7 +262,7 @@ force_path_style = true
```

``` bash
parquet-tools schema -f s3://jimyag/parquet-tools/testdata/v0.7.1.parquet -c s3.toml
parquet-tools schema s3://jimyag/parquet-tools/testdata/v0.7.1.parquet --s3-config s3.toml
required group field_id=-1 schema {
optional double field_id=-1 carat;
optional byte_array field_id=-1 cut (String);
Expand Down

0 comments on commit b74f8ce

Please sign in to comment.