You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/06/10 21:33:21 UTC

[GitHub] [beam] ibzib commented on pull request #14729: [WIP][BEAM-9379] Update calcite to 1.26

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:
users@infra.apache.org