Caideyipi commented on PR #17871: URL: https://github.com/apache/iotdb/pull/17871#issuecomment-6850697738
## Independent re-review - Reviewed SHA: `32f25d9cedd8af43529c3c0ea26487b2b7344c6a`. - Fixed comparison baseline: `cca1dbbde6d0dffa38495c92c92a48b2626d2f99`. - Final local SHA, confirmed source-branch SHA, and confirmed PR-head SHA: `8c37cb0e5e083759420ae840558064b500db35ab`. - Source: `Caideyipi/iotdb:fix/library-udf-edge-cases`. The source and PR heads matched the reviewed SHA immediately before the update; the push used an explicit expected-SHA lease and was a fast-forward. The PR is confirmed **Draft**. ### Finding and fix **P2 — Subnormal Histogram widths misclassify exact bucket boundaries** ([reviewed UDTFHistogram.java:90](https://github.com/apache/iotdb/blob/32f25d9cedd8af43529c3c0ea26487b2b7344c6a/library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFHistogram.java#L90)). With `min=0`, `max=22*Double.MIN_VALUE`, and `count=22`, an input of `15*Double.MIN_VALUE` enters bucket 14 instead of bucket 15: `(15.0/22)*22` rounds to `14.999999999999998`. This changes the reported histogram counts. Commit `8c37cb0e5e083759420ae840558064b500db35ab` computes the subnormal-width bucket index from exact binary-double values using an integral decimal quotient and clamps endpoints before indexing. The new regression enumerates representable points in positive and negative subnormal ranges, including widths rounded to a nonzero subnormal and widths underflowing to zero; expected bucket counts use an independent integer oracle. The regression reproduced the failure before the production fix. ### Review coverage and resource costs The review covered the complete fixed-base diff and relevant context, including MAD merge/null handling and INT64 extremes; sampled Row reuse and INT64 precision; DWT levels; Histogram/MinMax extremes; Spline timestamps, coordinates, endpoints, duplicates and test doubles; AR/DTW validation; moving-average overflow and compensated-sum recovery; LOF valid-window tests; and DTW history, cross-partition/interleaved/reverse/multilevel merges, deferred rebuild, serialization, continued input and repeated output. No further in-scope actionable issue was confirmed in this round. For DTW, with N retained input points, R matches and pattern length p, static inspection gives O(N+R+p) retained state and `9 + 16N + 20R` serialized bytes. A merge copies retained input, with ordinary map insertion cost O(M log(N+M)) for M source points, and defers DTW replay. Dirty finalization costs approximately O(N*p^2), with O(p) scratch space; multilevel merges repeatedly copy inputs. These are static costs, not measured performance results. ### Validation - The new regression failed on the reviewed implementation before the fix (one failure, no errors or skips). - Local offline `clean test -pl library-udf -am`: **143 tests, zero failures, errors or skips**. Required IoTDB dependencies were rebuilt from clean source, with both local and remote build caches disabled. All newly added tests ran locally. - Chinese-profile offline clean source-reactor `test-compile`, Spotless apply, lifecycle Checkstyle and `git diff --check` passed. - Local verification used the previously established fallback for blocked remote Maven plugin downloads. No full-project build or performance benchmark was run. CI was neither awaited nor polled. This round found and fixed a behavioral issue, so the PR remains **Draft** pending a complete independent re-review in a fresh session. No second review round was started in this session. -- 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]
