@@ -157,6 +157,34 @@ def test_big_decimal():
157157 np .array ([0. , 777.2 , 751.6 , 345.1 , 644.1 ])).all ()
158158
159159
160+ def test_byte_array_decimal ():
161+ """Test decimal data stored as variable-length BYTE_ARRAY."""
162+ schema = pt .SchemaElement (
163+ type = pt .Type .BYTE_ARRAY , # Variable length (not FIXED_LEN)
164+ name = "test" ,
165+ converted_type = pt .ConvertedType .DECIMAL ,
166+ scale = 4 ,
167+ precision = 19
168+ )
169+ # Create DECIMAL values as variable-length byte arrays
170+ # Stored as: value * 10^scale
171+ # $0.00 -> 0 * 10^4 = 0 -> b'\x00'
172+ # $606.00 -> 606 * 10^4 = 6060000 -> b'\x5c\x77\xe0'
173+ # $280.00 -> 280 * 10^4 = 2800000 -> b'\x2a\xb9\x80'
174+ # $625.00 -> 625 * 10^4 = 6250000 -> b'\x5f\x5e\x10'
175+ data = np .array ([
176+ b'\x00 ' , # 0
177+ b'\x5c \x77 \xe0 ' , # 6,060,000 (3 bytes)
178+ b'\x2a \xb9 \x80 ' , # 2,800,000 (3 bytes)
179+ b'\x5f \x5e \x10 ' , # 6,250,000 (3 bytes)
180+ ], dtype = object )
181+
182+ result = convert (data , schema )
183+ expected = np .array ([0.0 , 606.0 , 280.0 , 625.0 ])
184+
185+ assert np .allclose (result , expected ), \
186+ f"Expected { expected } , got { result } "
187+
160188def test_tz_nonstring (tmpdir ):
161189 # https://github.com/dask/fastparquet/issues/578
162190 import uuid
0 commit comments