File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed
Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -267,20 +267,17 @@ def validate_parents_are_structs(field_id: int) -> None:
267267 continue
268268
269269 if not isinstance (field .transform , VoidTransform ):
270- if not is_source_column_in_schema :
270+ if source_field := schema_fields .get (field .source_id ):
271+ source_type = source_field .field_type
272+ if not source_type .is_primitive :
273+ raise ValidationError (f"Cannot partition by non-primitive source field: { source_type } " )
274+ if not field .transform .can_transform (source_type ):
275+ raise ValidationError (f"Invalid source type { source_type } for transform: { field .transform } " )
276+ # The only valid parent types for a PartitionField are StructTypes. This must be checked recursively
277+ validate_parents_are_structs (field .source_id )
278+ else :
271279 raise ValidationError (f"Cannot find source column for partition field: { field } " )
272280
273- source_type = schema .find_type (field .source_id )
274-
275- if not source_type .is_primitive :
276- raise ValidationError (f"Cannot partition by non-primitive source field: { source_type } " )
277-
278- if not field .transform .can_transform (source_type ):
279- raise ValidationError (f"Invalid source type { source_type } for transform: { field .transform } " )
280-
281- # The only valid parent types for a PartitionField are StructTypes. This must be checked recursively
282- validate_parents_are_structs (field .source_id )
283-
284281
285282UNPARTITIONED_PARTITION_SPEC = PartitionSpec (spec_id = 0 )
286283
You can’t perform that action at this time.
0 commit comments