What users observe
More null values appear when Enforce Schema is enabled.
Why this happens
Enforce Schema uses strict casting:
-
Excel formatting is ignored
-
Values must match the defined type exactly
-
Invalid casts are converted to
null
Inference, by contrast:
-
Samples data
-
Selects a type that fits observed values
-
Is more permissive
Example
If schema defines INTEGER:
-
100→ valid -
100.5→null -
ABC→null
Why this is correct
Strict casting prevents:
-
Hidden data corruption
-
Type drift across files
-
Unexpected runtime errors
Recommendation
Use Enforce Schema when correctness matters more than convenience.