You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/06 14:28:13 UTC

[GitHub] [flink] matriv opened a new pull request, #19379: [FLINK-27089][table-planner] Fix bug with TRY_CAST in batch mode

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

   ## What is the purpose of the change
   
   When in batch mode, the `getMonotonicity()` method of a function is
   called, to determine possible optimisations. For `TRY_CAST` the
   implementation needs to call `getOperandType(1)` to get the target (also
   the function's return) type of the cast. This fails as for `CAST` and
   `TRY_CAST` at this point we have only one operand.
   
   `CAST` solves this in Calcite code, more specifically in
   `RexCallBinding#create()` where in case the `kind` of the function is
   `CAST`, a special `RexCastCallBinding` instance is created which stores
   the return (target) type and returns it when `getOperandType(1)` is
   called.
   
   For `TRY_CAST` we don't have access to the stack to do something
   similar, and we cannot set the kind of `TRY_CAST` to `CAST` (currently,
   it's `OTHER_FUNCTION`, as this will allow the calcite stack to apply
   rules and optimisations to the `TRY_CAST` call and at some point
   convert it to a regular `CAST` call, thus breaking the functionality
   of `TRY_CAST` (return null instead of failing).
   
   As a solution to the problem, we simply don't implement the
   `getMonotonicity()` method for `TRY_CAST`, lossing possible
   optmisations.
   
   ## Brief change log
   
     - Disable monotonicity for `TRY_CAST`
     - Add tests
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - Added tests in `CalcITCase` which uses batch mode
     - Added some additional tests to `ScalarOperatorsTest` for completeness (these don't cover the bug fix)
   
   ## 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**
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #19379: [FLINK-27089][table-planner] Fix bug with TRY_CAST in batch mode

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #19379:
URL: https://github.com/apache/flink/pull/19379#issuecomment-1090342847

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "acae7ee55bdd35a48a5d3054402c1e60da18ca44",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "acae7ee55bdd35a48a5d3054402c1e60da18ca44",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * acae7ee55bdd35a48a5d3054402c1e60da18ca44 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] matriv commented on pull request #19379: [FLINK-27089][table-planner] Fix bug with TRY_CAST in batch mode

Posted by GitBox <gi...@apache.org>.
matriv commented on PR #19379:
URL: https://github.com/apache/flink/pull/19379#issuecomment-1091405641

   Needs to be backported to `1.15` as well


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] twalthr closed pull request #19379: [FLINK-27089][table-planner] Fix bug with TRY_CAST in batch mode

Posted by GitBox <gi...@apache.org>.
twalthr closed pull request #19379: [FLINK-27089][table-planner] Fix bug with TRY_CAST in batch mode
URL: https://github.com/apache/flink/pull/19379


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org