LuciferYang commented on issue #67995:
URL: https://github.com/apache/doris/issues/67995#issuecomment-5675964046

   The statistics path is reachable for the version column, and not for binlog 
TSO. Traced, still static.
   
   `max(__DORIS_VERSION_COL__)` on a unique-key table returns `0` when 
`enable_pushdown_minmax_on_unique` is on (it defaults to false, 
`SessionVariable.java:2379-2381`). The chain: 
`AggregateStrategies.pushdownMinMaxOnUniqueTable` -> 
`checkWhetherPushDownMinMax` 
(`fe/fe-core/src/main/java/org/apache/doris/nereids/rules/implementation/AggregateStrategies.java:487-528`),
 which checks only that the original column exists and that its type is not 
complex/HLL/bitmap, with no visibility check and no synthetic-column check, 
unlike the generic path at `:729-742`; then `TPushAggOp.MINMAX`; then on BE 
`use_statistics_iterator` (`be/src/storage/segment/segment.cpp:506-521`) and 
`segment_zone_maps_can_answer_agg`, which skips only the commit-TSO ordinal and 
disqualifies only on `pass_all`, so a `[0, 0]` summary is judged usable; then 
`VStatisticsIterator::next_batch` 
(`be/src/storage/iterator/vgeneric_iterators.cpp:63-93`) and 
`ColumnReader::next_batch_of_zone_map` (`be/src/storage/segment/colum
 n_reader.cpp:711-732`), which report the placeholder. 
`SegmentIterator::_replace_version_col_if_needed` never runs on that path.
   
   `__DORIS_BINLOG_TSO__` is safe here. It exists only in the row-binlog index 
schema 
(`fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java:2506`), 
reachable only through `RowBinlogTableWrapper`, which reports `DUP_KEYS`, so 
the unique-table rule cannot fire; the generic rule then excludes it explicitly 
through `RowBinlogTableWrapper.isRowBinlogSyntheticColumn` 
(`AggregateStrategies.java:729-734`).
   
   One shape note for the fix: adding `version_ordinal()` next to the 
commit-TSO ordinal in `segment_zone_maps_can_answer_agg` would be wrong, 
because `continue` there means "do not disqualify this column". The gate has to 
set `*usable = false` when the read schema carries a substituted column, or 
produce the effective summary for it.
   
   Not verified: no cluster run of the SQL above, and the merge-on-read variant 
of the BE path is not fully traced.
   


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