[ 
https://issues.apache.org/jira/browse/BEAM-9379?focusedWorklogId=609952&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-609952
 ]

ASF GitHub Bot logged work on BEAM-9379:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Jun/21 21:33
            Start Date: 10/Jun/21 21:33
    Worklog Time Spent: 10m 
      Work Description: ibzib commented on pull request #14729:
URL: https://github.com/apache/beam/pull/14729#issuecomment-859089547


   > Cannot cast "byte[]" to "ByteString"
   
   Seems to be because of this commit: 
https://github.com/apache/calcite/commit/dae53ef7917c46f6d5593477b2ef81b16427c541#diff-2095e662d66d6c1b2851915fa0d73934c3a847550545396835e02d88a9f5e2daR2858-R2871
   
   Calcite 1.24+ casts UDF return values to their expected Java types. 
Calcite's default 
[`JavaTypeFactoryImpl`](https://github.com/apache/calcite/blob/8213277dc3e4e1ea0ddb64f7df9b34bf73305e3d/core/src/main/java/org/apache/calcite/jdbc/JavaTypeFactoryImpl.java#L215-L217)
 maps `VARBINARY` to `ByteString`. We can fix it by overriding this mapping to 
return `byte[]` instead.
   
   By the way, 
`org.apache.beam.sdk.extensions.sql.zetasql.ZetaSqlJavaUdfTest.testNullArgumentIsNotTypeChecked`
 tests for bad behavior, so having it fail is actually a good thing. I'm 
guessing the casts added in that same commit fixed the bug (late type checking) 
it was testing for. So we can just update the test to reflect that.
   
   I committed fixes for these issues to my branch: 
https://github.com/ibzib/beam/commits/updatecalcite-udf-types


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

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 609952)
    Time Spent: 16h 50m  (was: 16h 40m)

> Upgrade to Calcite 1.26.0
> -------------------------
>
>                 Key: BEAM-9379
>                 URL: https://issues.apache.org/jira/browse/BEAM-9379
>             Project: Beam
>          Issue Type: Task
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Andrew Pilloud
>            Priority: P2
>          Time Spent: 16h 50m
>  Remaining Estimate: 0h
>
> Upgrade to Calcite 1.22.0 after it gets released (expected by end of Feb 
> 2020).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to