Thalweg · API reference ← Main docs

make_decode_avro_decimal_udf

Function make_decode_avro_decimal_udf 

Source
pub fn make_decode_avro_decimal_udf() -> ScalarUDF
Expand description

decode_avro_decimal(binary_col, precision, scale) — decode Avro variable-length big-endian two’s-complement decimal into Arrow Decimal128.

Accepts Binary/LargeBinary, FixedSizeBinary, or a base64 Utf8/ LargeUtf8 string (for bytes values a JSON-intermediate decode path stringified — JSON has no binary type; see decode-codec-learnings §6), sign-extends to i128 (preserving negatives), and returns Decimal128 with precision and scale taken from the literal Int64 SQL arguments. The output type follows the literal precision/scale via [ScalarUDFImpl::return_field_from_args], so the promised type always matches the runtime array; invalid precision/scale is rejected at plan time, and a Utf8 value that is not valid base64 is a loud execution error.