### What problem does this PR solve?
Issue Number: None
Problem Summary:
`JSON_SEARCH` builds the returned JSON path by concatenating each object
key as a bare member leg (`.key`), only double-quoting the leg when the
key contains whitespace. When the key itself contains a character that
`JsonbPath`'s parser treats as structural when unquoted — `.`, `[`, a
leading `*`, or an empty key — the emitted path does not parse back into
the same single leg, so feeding the result into
`JSON_EXTRACT`/`JSON_SEARCH` again resolves to a different value (or
fails to parse).
For example:
```sql
JSON_SEARCH('{"a.b":"hit","a":{"b":"miss"}}', 'one', 'hit')
-- returns $.a.b, which JSON_EXTRACT parses as a -> b and resolves to "miss" instead of "hit"
```
The fix makes `leg_info::to_string` double-quote a member leg whenever
the unquoted form would not read back as the same leg (mirroring
`JsonbPath`'s own unquoted-leg grammar: empty key, leading `*`, or
containing whitespace/`.`/`[`), and adds a few supporting changes so the
rest of the path code treats a quoted literal key consistently with a
parsed wildcard:
- A new `leg_info::is_wildcard` flag, set only by the parser for an
unquoted `*` / `[*]` leg, distinguishes a real wildcard from the literal
key `"*"`. `to_string` and `findValue` both switch to this flag instead
of comparing leg bytes, since a quoted `"*"` leg has the same bytes as a
wildcard leg.
- `$.""` (an explicit empty key) is accepted by the parser and can be
looked up; `ObjectVal::search` no longer treats an empty key length as
"not found", and the internal lookup distinguishes an explicit empty key
from an object entry that is stored by numeric key id (which also has
key length 0).
- `JsonbValue::contains` looks up a key-id-encoded right-hand key by id
instead of by name, for the same reason.
- `JSON_SET`/`JSON_INSERT` no longer write a member-style leg into an
array (matching MySQL); previously the leg's default array index (0)
would overwrite or append to the array.
- A pre-existing formatting issue where a wildcard array leg (`[*]`) was
printed back as `[0]` is fixed alongside, since it shares the same root
cause (no explicit wildcard marker).
### Release note
`JSON_SEARCH` now quotes a returned path segment whenever the key
contains `.`, `[`, starts with `*`, or is empty, so the result can be
parsed again by `JSON_EXTRACT`/`JSON_SEARCH`/`JSON_SET`/etc. As a side
effect, `$.""` is now a valid path for an explicit empty key, a quoted
`"*"` key is treated as a literal key instead of a wildcard, and
`JSON_SET`/`JSON_INSERT` no longer modify an array when the path's last
segment is a member (non-array-index) leg.
### Check List (For Author)
- Test
- [x] Unit Test
- [x] Regression test
- Behavior changed:
- [x] Yes. See Release note above.
- Does this need documentation?
- [ ] No.
🌍 Read this in other language
English • العربية • বাংলা • Deutsch • Español • فارسی • Français • हिन्दी • Bahasa Indonesia • Italiano • 日本語 • 한국어 • Polski • Português • Română • Русский • Slovenščina • ไทย • Türkçe • Українська • Tiếng Việt • 简体中文 • 繁體中文
Apache Doris is an open-source, real-time analytics and search database built on MPP architecture. It provides fast SQL analytics, lakehouse query acceleration, and hybrid search across structured, text, and vector data.
Explore the official website for the latest product overview, use cases, ecosystem updates, blogs, and user stories. For version updates, see all release notes.
📈 Use Cases
| Use Case | What it provides |
|---|---|
| Customer-Facing Analytics | Ship sub-second interactive analytics to external users. |
| Data Warehousing | Build one real-time warehouse across business domains. |
| Observability | Analyze high-throughput logs, events, and metrics with SQL. |
| Doris for AI | Use vector, text, JSON, and structured search in one SQL engine. |
🚀 Core Capabilities
Apache Doris is built around three core capabilities. The website is the source of truth for detailed product descriptions and examples.
| Capability | What it provides |
|---|---|
| Real-Time Analytics | Streaming ingestion, incremental transformation, and sub-second queries under high concurrency. |
| Lakehouse Analytics | Fast SQL analytics over open table formats such as Iceberg, Delta Lake, and Hudi. |
| Hybrid Search | SQL-native analytics across JSON, full-text, and vector data for AI and search workloads. |
🔌 Ecosystem
Doris sits at the center of the modern data stack. It connects upstream databases, streaming systems, and lakehouse storage with downstream BI, AI, analytics, and observability tools.
For the latest ecosystem coverage, visit the official website and the connection and integration documentation.
👣 Get Started
🧱 Architecture
Apache Doris supports both compute-storage coupled and compute-storage decoupled deployments. In decoupled mode, stateless compute groups run over shared object storage, so you can scale compute on demand and isolate workloads.
Learn more in the deployment guide and deployment mode guide.
📣 Project Updates
| Resource | What it provides |
|---|---|
| Community Report | Weekly updates on community activity, merged PRs, contributors, and feature progress. |
| Roadmap 2026 | The 2026 planning discussion for AI and hybrid search, query engine, storage, and data lake work. |
🧩 Components
Doris provides connectors and tools for common data engineering workflows.
- Doris Flink Connector
- Doris Spark Connector
- Doris Kafka Connector
- Doris Stream Loader
- Doris Kubernetes Operator
👨👩👧👦 Users
Apache Doris is used in production by thousands of companies worldwide across internet services, finance, retail, logistics, manufacturing, energy, telecommunications, AI, and other industries.
🙌 Contributors
Apache Doris graduated from the Apache Incubator and became an Apache Top-Level Project in June 2022. Thanks to all community contributors who help build Doris.
🌈 Community and Support
💬 Contact Us
🧰 Links
- Apache Doris official website: doris.apache.org
- X: @doris_apache
- Medium: @ApacheDoris
📜 License
Note
Some licenses of the third-party dependencies are not compatible with Apache 2.0 License. So you need to disable some Doris features to comply with Apache 2.0 License. For details, refer to the
thirdparty/LICENSE.txt

