Grouping of partitioned dataframes

0

I have a large dataset (table) with >1e9 records (rows) in Glue. The tables are partitioned by column A, which is a n-letters subtring of column B. For example:

A (partition key)B...
abcabc123......
abcabc123......
abcabc456......
abcabc456......
abcabc456......
abcabc789......
abcabc789......
.........
xyzxyz123......
xyzxyz123......
xyzxyz123......
xyzxyz456......
xyzxyz456......
xyzxyz456......
xyzxyz789......
xyzxyz789......

There are >1e6 possible different values of column B and correspondingly significantly less for column A (maybe 1e3). Now I need to group records/rows by column B and the assumption is that it could be advantageous if the table was partitioned by column A, as it would be sufficient to load dataframes from single partitions for grouping instead of running the operation on the entire table. (Partitioning by column B would lead to unreasonably large numbers partitions.) Is my assumption right? How would I tell my Glue job the link between column A and B and profit from the partitioning?

Alternatively I could handle the 1e3 dataframes (one for each partition) separately in my Glue job and merge them lateron. But this looks a bit complicated to me.

This question is a follow-up question to https://repost.aws/questions/QUwxdl4EwTQcKBuL8MKCU0EQ/are-partitions-advantageous-for-groupby-operations-in-glue-jobs.

1 Answer
0

Hello,

Partitioning by column A could be advantageous in your use case and then groupBy column B in order to limit the number of partitions. You can create a dynamic frame and refer to partitions in it with predicate pushdown. Do you want to create multiple dynamic frames for multiple partitions and then combine them using join operator ? If you have any sample code you are using on a sample dataset, please share it with us on a support case and we can assist you by getting on a screen-share.

AWS
SUPPORT ENGINEER
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions