Can I load the files based on the data in my table as variable without iterating through each row?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2024 08:49 AM
Hi,
I have created this table which contains the data that I need for my source path and target table.
source_path: /data/customer/sid={sid}/abc=1/attr_provider={attr_prov}/source_data_provider_code={src_prov}/
So basically, the value of each row are connected so I don't need to iterate all over them anymore. I wan to load only the files that are in the folder that is greater than my max(key). These is the sample structure of my storage:
For this example, using the first row of my table, my code should only load the files from folder10023 & folder10054.
Is there any way not to iterate through each rows of the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 08:11 AM
Hi @zll_0091, To efficiently load only the necessary files without manually iterating through each row of your table, you can use Spark's DataFrame operations. First, read your table into a DataFrame and determine the maximum key value. Then, filter the folders based on this key and load the files from the filtered folders. This approach avoids manual row iteration and streamlines the file-loading process.