minhasav opened a new pull request, #30240:
URL: https://github.com/apache/flink/pull/30240

   ## What is the purpose of the change
   
   `WindowCodeGenerator.asLong` reads the size and slide of a batch `TUMBLE` or 
`HOP` window with `extractValue(expr, classOf[JLong]).get()`. A window restored 
from a compiled plan holds a `Duration`, not a `Long`. `ValueLiteralExpression` 
converts a `Long` to a `Duration` but not the other way around, so 
`Optional.get()` throws `NoSuchElementException: No value present`.
   
   The streaming window nodes already read the same literal with 
`AggregateUtil.toDuration`. This change does the same for the batch code 
generator.
   
   The batch window nodes cannot be written to or loaded from a compiled plan 
yet (see FLINK-36721 and FLINK-36722), so this is not reachable from SQL on 
master today. It is needed before those nodes can be annotated.
   
   ## Brief change log
   
     - `WindowCodeGenerator.asLong` reads the literal with 
`AggregateUtil.toDuration(...).toMillis`. It accepts both the `Long` of a 
freshly planned query and the `Duration` of a restored plan.
     - Add `WindowCodeGeneratorTest` with one test for each form.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `WindowCodeGeneratorTest` (2 tests). Without the change, 
`testWindowIntervalOfLoadedCompiledPlan` fails on master with 
`NoSuchElementException` in `asLong`. With it, both pass.
     - The existing `*GroupWindow*` plan tests and ITCases in 
`flink-table-planner` (343 tests) pass.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Sonnet 5.5)
   


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