Fix error 3140 'Invalid JSON text' when inserting MAP literal '{1:NULL}'
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 342
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 53
Description
Description
When inserting a MAP literal '{1:NULL}' (with NULL in uppercase), the operation fails with error 3140: "Invalid JSON text".
Actual Behavior:
The INSERT statement fails.
Expected Behavior:
The INSERT statement should succeed, similar to the lowercase null literal ('{1:null}') which works correctly.
Steps to Reproduce
- Access the machine.
- Navigate to the directory:
/obdata/data/AndroidTest/ob_opensource_test/tools/deploy - Set up the test environment and run the specific mysqltest case using the following commands:
export OCEANBASE_HOME=/obdata/data/AndroidTest/ob_opensource_test/
cd ${OCEANBASE_HOME}/tools/deploy
source activate_obd.sh
export OBD_SEEKDB_STATUS_FALLBACK_TCP=1
obd test mysqltest test_env --mysqltest-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/mysqltest --obclient-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/obclient --init-only --init-sql-dir=${OCEANBASE_HOME}/tools/deploy --init-sql-files='init.sql,init_user.sql|root@sys|test'
obd test mysqltest test_env --mysqltest-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/mysqltest --obclient-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/obclient --disable-reboot --test-set=map.map_keys_mysql
- The issue can be reproduced with the following SQL statements:
USE test;
DROP TABLE IF EXISTS t4;
CREATE TABLE t4 (
id INT NOT NULL AUTO_INCREMENT,
m MAP(INT, INT[])
);
INSERT INTO t4(m) VALUES ('{1:[1],2:[2],3:[3]}');
INSERT INTO t4(m) VALUES ('{1:NULL}'); -- This line fails with error 3140.
-- Lowercase 'null' works correctly.
INSERT INTO t4(m) VALUES ('{1:null}');
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in /obdata/data/AndroidTest/ob_opensource_test/tools/deploy and run the mysqltest case map.map_keys_mysql with the provided setup commands. Compare the INSERT statements using uppercase NULL and lowercase null, then trace the MAP literal handling reached by that test. Done means '{1:NULL}' inserts successfully without error 3140 while the existing lowercase case continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100