Fix SQL execution error 4016 that disappears with NO_EXPAND hint
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.9k
- Forks
- 339
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 52
Description
Description
A SQL query fails with error code 4016. The error disappears when the NO_EXPAND hint is added to the query.
Customer version: 4.4.2 bp0
Environment
- Version: 4.4.2 bp0
Steps to Reproduce
- Execute the SQL query (the specific query text is shown in the attached images).
- Observe the query fails with error 4016.
- Add the
NO_EXPANDhint to the same query. - Observe the query executes successfully without error.
The table structure is provided in the attached images.
Impact
Not specified.
Additional Information
- The issue was reported during an L3QA on-call shift.
- The original title indicates the issue is present in the master branch and is targeted for the 4.4.x_release branch.
- Several images were attached to the original report showing the error, the successful execution with the hint, and the relevant table structures. These image URLs are:
https://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/05d287cd-6e1a-4b3d-98bf-4913db738324_image.pnghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/8d1efe7a-608e-4a19-be7b-6b17db101d08_image.pnghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/0fec5905-8706-40a0-81ee-bf1b5d3d37ca_image.jpeghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/1e1e2595-44f5-4701-a6ed-c61cd3001f21_image.jpeghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/c4670ec5-dde5-4c31-be1c-d737bb65191a_image.jpeghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/03a5141f-7a05-46d9-af97-c002280cb796_image.jpeghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/31d596af-8c77-4646-9e5c-2a328f4bfbe1_image.jpeghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/1758b922-bbba-41f3-9291-c4d6f5e351b3_image.jpeghttps://obworkorder.oss-cn-beijing.aliyuncs.com/prod/2026/03/11/e23344a6-07bd-4fca-9cae-a95bf5757041_image.jpeg
Note: The following fields from the original report were not filled in:
- Recent upgrade timeline
- Detailed version/observer -V command result
- Detailed reproduction steps/initial analysis
- Connection information/problem cluster
- Related changes/changes before the problem occurred
- Relevant logs or initial analysis attachments
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 with the attached images to recover the SQL query, table structure, error 4016, and the version 4.4.2 bp0 environment. Reproduce the failure with and without the NO_EXPAND hint, then trace the database execution path responsible for the differing behavior. Done means the query no longer fails with error 4016 without requiring NO_EXPAND.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100