Files
elianddb e8167be7df Fix JSON path parsing for unnecessarily quoted field names
Fixes dolthub/dolt#9556

The issue was in dolt's JSON path parser where unnecessarily quoted
simple field names like $."a" were being rejected, despite MySQL
accepting them. This caused compatibility issues with Django's
compile_json_path() function which always quotes keys.

Changes:
- Fixed lexer in json_location.go to properly handle quoted field names
- Adjusted token position when encountering opening quotes
- Corrected empty string detection logic for quoted keys
- Added comprehensive tests matching the customer's use case

The fix ensures MySQL compatibility for:
- $.a (unquoted field names)
- $."a" (unnecessarily quoted simple field names)
- $."a key" (necessarily quoted field names with spaces)
- $."a"."b" (nested quoted field names)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 17:08:09 +00:00
..
2024-09-13 09:23:32 -07:00
2025-07-08 11:45:19 -07:00
2025-01-06 11:22:25 -08:00
2023-12-01 11:10:55 -08:00
2025-04-10 11:26:41 -07:00
2023-10-17 13:40:02 -07:00
2025-03-07 12:12:24 -08:00
2025-07-14 14:26:43 -07:00
2024-02-27 18:11:37 -08:00
2025-06-02 16:01:32 -07:00
2025-06-24 14:07:32 -07:00
2025-07-10 09:55:16 -07:00
2025-01-06 11:22:25 -08:00
2025-04-16 13:42:34 -07:00
2025-07-10 16:54:03 -07:00
2024-12-02 12:07:36 -08:00
2025-05-28 09:11:45 -07:00
2025-06-09 12:07:23 -07:00
2024-03-27 16:54:46 -07:00
2025-05-28 12:45:28 -07:00
2025-07-07 10:01:35 -07:00
2024-07-26 15:08:02 -07:00
2024-09-10 16:49:02 -07:00
2025-07-09 15:21:00 -07:00
fix
2024-02-06 23:12:14 -08:00
2025-03-19 03:48:45 +10:00
2023-10-31 15:43:05 -07:00
2023-11-29 18:43:36 -08:00
2025-05-22 13:00:41 -07:00
2025-06-10 10:59:52 -07:00
2025-06-23 10:50:33 -07:00
2025-07-17 17:30:15 +00:00

BATS - Bash Automated Testing System

BATS is used to integration test dolt. Our BATS tests started as a humble suite of integration tests. Over two years of development the suite has grown to over 1,000 tests. When we find a customer facing bug in the dolt command line or SQL implementation, we cover it with a BATS test. These tests are run on every dolt PR on Mac, Windows, and Linux using GitHub Actions.

These tests are also useful documentation. If you are wondering how a certain command or feature works in practice, using grep to find the appropriate BATS test can give you some simple examples of happy path and error case behavior.

The naming conventions for the test files have evolved over time. Generally, the files are named after the feature the file intends to test. However, some of the early tests are named after the schema of the table they implement ie. 1pk5col-ints.bats. These files were implemented to reuse setup and teardown logic. This scheme was quickly abandoned but the legacy remains.

If you find a bug in dolt, we would love a skipped bats test PR in addition to a GitHub issue.

Running for yourself

  1. Install bats.
npm install -g bats
  1. Install dolt and its utilities.
cd go/cmd/dolt && go install . && cd -
cd go/store/cmd/noms && go install . && cd -
cd go/utils/remotesrv && go install . && cd -
  1. Make sure you have python3 installed.

This came with my Mac Developer Tools and was on my PATH.

  1. pip install mysql-connector-python, pip install pyarrow and pip install pandas

I also needed this specific version on the python mysql.connector. pip install mysql.connector mostly worked but caused some SSL errors.

pip3 install mysql-connector-python
pip3 install pyarrow
pip3 install pandas
  1. Install parquet and its dependencies

I used Homebrew on Mac to install parquet. You also need to install hadoop and set PARQUET_RUNTIME_JAR to get bats to work. Here's what I ended up running.

brew install parquet-cli
brew install hadoop
export PARQUET_RUNTIME_JAR=/opt/homebrew/opt/parquet-cli/libexec/parquet-cli-1.12.3-runtime.jar
  1. Go to the directory with the bats tests and run:
bats . 

This will run all the tests. Specify a particular .bats file to run only those tests.

Here Docs

BATS tests in Dolt make extensive use of Here Docs. Common patterns include piping SQL scripts to dolt sql:

    dolt sql <<SQL
CREATE TABLE my_table (pk int PRIMARY KEY);
SQL

And creating data files for import:

    cat <<DELIM > data.csv
pk,c1,c2
1,1,1
2,2,2
DELIM
    dolt table import -c -pk=pk my_table data.csv

Skipped BATS

Various tests are skipped as TODOs and/or as documentation of known bugs. Eg:

@test "..." {
    ...
    skip "this test is currently failing because..."
}

Skipped BATS can still be partially useful for testing as they execute normally up to skip statement.

More Information

We published a blog entry on BATS with more information and some useful tips and tricks.