github-actions[bot] commented on code in PR #68161:
URL: https://github.com/apache/doris/pull/68161#discussion_r4310039013


##########
fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java:
##########
@@ -225,11 +245,14 @@ private void initReader() throws IOException {
                     : null;
             variantProjections.add(variantProjection);
             if (variantProjection == null) {
-                // The engine may have pruned this complex column down to the 
sub-fields the query touches.
-                // Mirroring that shape with paimon's own types lets 
withReadType push the same projection
-                // through the ROW/ARRAY/MAP readers instead of reading the 
whole column and discarding it.
                 DataType projectedType =
                         PaimonReadTypeProjection.project(tableField.type(), 
types[outputIndex]);
+                // ColumnType retains the logical precision, independently of 
the widened physical read type.
+                resetTimestampPrecision(types[outputIndex], projectedType);
+                currentFields.add(tableField.newType(projectedType));

Review Comment:
   [P1] Use the selected branch's field IDs in the widened read type
   
   For supported fallback schemas main `(pt#0, id#1, ts#3 TIMESTAMP(0))` and 
secondary `(pt#0, id#1, ts#2 TIMESTAMP(0))`, let the secondary retain an ORC 
file written at p9 (main dropped/re-added `ts`). `SELECT id, ts` now routes to 
JNI, but `tableField` still comes from the outer schema, so the widened read 
type requests `ts#3` instead of secondary `ts#2`. The [SDK fallback 
reader](https://github.com/apache/paimon/blob/release-1.4.2/paimon-core/src/main/java/org/apache/paimon/table/FallbackReadFileStoreTable.java#L588-L591)
 forwards that type unchanged, and 
[FormatReaderMapping](https://github.com/apache/paimon/blob/release-1.4.2/paimon-core/src/main/java/org/apache/paimon/utils/FormatReaderMapping.java#L316-L332)
 selects physical fields by ID; the absent field becomes NULL. Even a stored 
whole-second timestamp can therefore become NULL. The new independent-ID FE 
test checks routing without reading the returned values. Translate the actual 
read fields into the selected branch's sche
 ma before widening, preserve the SQL output mapping, and add reader-result 
coverage for both branch orderings. This is separate from the fixed FE 
history-selection guard: routing succeeds, but the selected reader consumes the 
wrong field identity.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to