terrymanu commented on PR #39131: URL: https://github.com/apache/shardingsphere/pull/39131#issuecomment-5261332405
The finding is retained, and the proposal needs one more design revision before implementation. Your understanding of the root cause and the split result-shape contract is correct. I also agree that `ResultSet#getObject(String)`, `ResultSetMetaData`, and Proxy headers should consume one authoritative result-shape decision. However, `boundWithCompleteProjections` should not be derived directly from whether [`SQLBindEngine.isNeedBind()`](https://github.com/apache/shardingsphere/blob/d912eb7944f20d3dafd3275d60347b5241b5a5d6/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/SQLBindEngine.java#L56-L84) returned true. A hinted query with only explicit projections skips binding but still has a complete user-visible projection list. `SelectStatementContext` is also constructed outside `SQLBindEngine`, so a flag owned only by that engine would not reliably describe the context state. Likewise, filtering physical metadata with [`DerivedColumn.isDerivedColumnName(...)`](https://github.com/apache/shardingsphere/blob/d912eb7944f20d3dafd3275d60347b5241b5a5d6/infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/projection/DerivedColumn.java#L55-L67) is still name-based inference. It matches reserved prefixes and cannot by itself prove that a physical column was internally generated. Any resolver that hides columns must also preserve the mapping from each visible column index to its physical result-set index. Please revise the proposal around the semantic state that actually matters: whether a shorthand projection remains unexpanded. `ProjectionsContext` is the closest existing owner because it already contains the shorthand projection’s actual columns and the expanded projections. Then define a runtime result-shape mapping that combines this semantic state with physical metadata and explicit knowledge of internally generated projections. Before implementation, please cover at least these cases in the design and tests: 1. Data-source hint with an unexpanded shorthand projection. 2. Data-source hint with only explicit, already-complete projections. 3. Normal rewriting with internal derived columns. 4. Equal column counts but different labels. 5. Consistent labels, counts, and indexes across `ResultSet`, `ResultSetMetaData`, and Proxy headers. Please update the design proposal first; no code change is needed until this ownership and mapping contract is agreed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
