multiprocessio / dsq

Commandline tool for running SQL queries against JSON, CSV, Excel, Parquet, and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The result is wrong when I loading a JSON file with path specified

xwjdsh opened this issue · comments

Describe the bug and expected behavior
The result is wrong when I loading a JSON file with path specified.

Reproduction steps

~ cat test.json
{
  "data": {
    "data1": [
      {"id": 1, "name": "Corah"},
      {"id": 3, "name": "Minh"}
    ],
    "data2": [
      {"id": 2, "name": "Corah"},
      {"id": 4, "name": "Minh"}
    ]
  },
  "total": 2
}

~ ./dsq --pretty test.json 'SELECT * FROM {"data.data2"} ORDER BY id DESC'
+----+-------+
| id | name  |
+----+-------+
|  3 | Minh  |
|  1 | Corah |
+----+-------+
(2 rows)

The expected result should be,

+----+-------+
| id | name  |
+----+-------+
|  4 | Minh  |
|  2 | Corah |
+----+-------+
(2 rows)

Versions

  • OS: macOS 12.3.1
  • Shell: zsh
  • dsq version: 0.22.0