RedHatInsights / expandjsonsmt

Kafka Connect SMT to expand JSON field
Apache License 2.0
17 stars 18 forks source link

Fails Validation when validating array data type #17

Open rjenea opened 11 months ago

rjenea commented 11 months ago

Given message contains an array of values the DataType will be inferred based on value if it's in a particular range. This breaks the validation where Data type of array elements are expected to be the same.

To reproduce consider following message {"data": [2146192818, 2146574830, 2147639482]}" Where last value Falls under Int64 range so therefor com.redhat.insights.expandjsonsmt.SchemaParser#getArrayElement throws ""Field is not a homogenous array Int32 x Int64"

Proposed PR is to treat all elements the same dataType if at least one has is in higher range, applicable only for Inte32 and 64 at the moment.