fudianchn commented on PR #39613:
URL: https://github.com/apache/shardingsphere/pull/39613#issuecomment-5619777656

   The coexistence semantics is defined and implemented in fec19243.
   
   Decision: the expanded-projection view is used only when the count mismatch 
is fully explained by the derived columns the rewrite appends, i.e. after 
removing those derived columns (matched by the DerivedColumn patterns, 
case-insensitively for lowercase-folding backends) the returned metadata still 
names the expanded projections. A derived alias alone no longer proves the 
absence of drift.
   
   When drift and appended derived columns occur together, the returned 
metadata is authoritative for the client-facing columns and the derived columns 
are hidden from it: the newly added user column is delivered with its own label 
and index, the derived alias stays invisible. The decision and the 
hidden-column view are shared by JDBC ResultSetMetaData, the proxy query 
headers and COM_STMT_PREPARE, which all go through 
ShardingSphereResultSetMetaData / ShardingSphereResultSetUtils.
   
   Tests: coexistence cases for the label map, the metadata and the prepare 
resolver, all red on the previous head (the label map returned {col1=1, col2=2} 
instead of {col1=1, added_col=2, col2=3}); a rename case where the non-derived 
counts match but the names differ, still detected as drift; a guard that a 
derived-looking genuine column stays visible when the statement has no derived 
projections. jdbc 1237, proxy-backend-core 583, proxy-frontend-mysql 200, 
spotless and checkstyle pass.
   
   The alternative of rejecting this state and requiring a metadata refresh is 
not implemented: it would turn a currently silently-wrong result into a query 
failure, which looked like a larger behavior decision. Happy to rework in that 
direction if you prefer it.
   


-- 
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]

Reply via email to