Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2025 10:59 PM
To make type widening work in your current setup, you can try the following modifications:
- Add the
mergeSchemaoption to your read operation:snapshot_load_df = ( spark.readStream .format("cloudFiles") .option("cloudFiles.format", "json") .option("cloudFiles.inferColumnTypes", False) .option("cloudFiles.includeExistingFiles", True) .option("pathGlobFilter", "*.json.gz") .option("mergeSchema", "true") # Add this line .schema(spark_schema) .load(f"abfss://YYY@{adl_name}.dfs.core.windows.net/Snapshot/{source_system_name}/{table_name}") # ... rest of the code )