Skip to content

Commit 00222a4

Browse files
authored
Pass in type explicitly for initial-default (#2296)
# Rationale for this change I noticed we just passed in the value, without setting the type explicitly. By default, PyArrow will for example upscale 1 to an int64 field, while the column is of type int32 in the table. # Are these changes tested? # Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent 8042d82 commit 00222a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ def struct(
18051805
elif field.initial_default is None:
18061806
field_arrays.append(pa.nulls(len(struct_array), type=arrow_type))
18071807
else:
1808-
field_arrays.append(pa.repeat(field.initial_default, len(struct_array)))
1808+
field_arrays.append(pa.repeat(pa.scalar(field.initial_default, type=arrow_type), len(struct_array)))
18091809
fields.append(self._construct_field(field, arrow_type))
18101810
else:
18111811
raise ResolveError(f"Field is required, and could not be found in the file: {field}")

0 commit comments

Comments
 (0)