apache-beambeam-sql

How to specify BeamSQL UDF for Numeric Types


I'm trying to add a User Defined Function (UDF) to a SqlTransform in a Beam pipeline, and the SQL parser doesn't seem to understand the function's type. The error i get is:

No match found for function signature IF(<BOOLEAN>, <NUMERIC>, <NUMERIC>)

I've tried defining this for a bunch of different types (Double, Float, Long, Integer), but don't see how i can write this generically in a way that Beam will understand.

Is there some way to give type hints to the UDF, to to write one that handles arbitrary numeric types?


Solution

  • Seems, you should use BigDecimal.

    Here is a similar question: What is the equivalent Data type for Numeric in apache.beam.sdk.schemas.Schema.FieldType