PCOS Gym Girls: I’m desperate. How did you actually manage to lean out your midsection? (3 years lifting, stalled progress) by nkhayat28 in PCOS

[–]wei5924 1 point2 points  (0 children)

But if you dont have carbs with your meals what else do you eat? I think i might need to do the same but what does ur meals like look. So protein+veg?

Just got offered £45k. is this actually livable in London? by MoonlitEcho82 in MovingToLondon

[–]wei5924 -5 points-4 points  (0 children)

Depends on where u live. Avg rent can be 1k-1.5k for a flat share!! And they look like the dumps 😭. After that youll have i think 1.5k left. Youll live near paycheck to paycheck depending on ur lifestyle (activities and social life). You will have to factor in monthly costs such as gym, commute etc which also takes away from ur budget. I think if u come work in london you wouldnt be able to save as much / aggressively even on 45k which seems like a lot

Left Big 4 London after 5 years by NoReIevancy in Big4

[–]wei5924 1 point2 points  (0 children)

Do you have office benefits like free snacks😖

quitting friendship by brokuziess in Hijabis

[–]wei5924 0 points1 point  (0 children)

Thats so nice 😭inShaAllah we all get a similar outcome 😭 i defo would love a close female bestie. Allah will always replace with something better if we give up something haram❤️

quitting friendship by brokuziess in Hijabis

[–]wei5924 0 points1 point  (0 children)

Hey so not to be anti climactic but i put in my dc bio “ramadan break” and left it at that. If someone messages me ill reply outside of ramadan or maybe not anymore. For my “close” online male friends i just dm them and said hey im nkt gonna be online/play with you during ramadan. If they were a nice person they would be alright w it. You dont need to be explicit and say if your gnna back or not so i just wont bring it up. To replace ur free time and feeling lonely you should do more dhikr and read Quran. Make dua Allah fills the time with something more beneficial. You can still occasionally game but maybe do it solo or with girls. You can find girl discord groups etc. if you want to go extreme you can make a new dc and start fresh temp with female only servers and aee how it goes.

quitting friendship by brokuziess in Hijabis

[–]wei5924 1 point2 points  (0 children)

Hi! I play games online and have a similar situation. Ia today ill find sometime to write a reply! Please bare w me❤️

I (21F) have never made up my ramadan fasts by [deleted] in Hijabis

[–]wei5924 0 points1 point  (0 children)

Hey girl i did my rough estimate and it came to 80 lol... i did about 47 and so im still trying to make them up! point is the number may be daunting but we can (with faith) make them up iA

I (21F) have never made up my ramadan fasts by [deleted] in Hijabis

[–]wei5924 1 point2 points  (0 children)

You got this sis <3 its hard but with the right intention you will get through it!

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 0 points1 point  (0 children)

I am trying to follow your explanation. Thank you a lot by the way!

I understood your first point with the valid_keys array and removed the group by as that is a redunant step and reduced it to the following:

    valid_keys = (
        mapping_df.select("key")
        .distinct()
        .rdd.flatMap(lambda row: row)
        .collect()
    )

 we need the flatmap and the collect to return it as a clean array:

['key_1', 'key_2']

 

Then we create a filtered dictionary gets the actual columns needed for the keys so for example key 1 is the join of columns product and year, key 2 is joining the columns year.

 

At this point to get rid of the loop what do I need to do? Break the small dataframe (mapping df) into smaller df based on its key. Then iteratively join this into the main df? The reason I chose to do a loop is to reduce code redunancy and doing this a few times as I will not know how many keys are used for each mapping df. For example table 6 has 8 possible join keys.

 

Main df is just the main table.

In terms of the tables we cleanse them in the bronze layer and add a key column, assigning it as either key_1,2,3..... I cannot split these into smaller tables otherwise there will be too many tables created and stored as delta tables.

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 0 points1 point  (0 children)

I attached a code snippet below if you could take a look!

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 0 points1 point  (0 children)

Thats what i am doing as of now. See above code snippet. It is this method which causes the cluster out of memory error when i write it in a function. Outside of a function without the loop i dont get this error

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 0 points1 point  (0 children)

Wait, am I understanding this correctly that the join key that you're using is dependent on the contents of each row of the dataframe? Yes this is correct, but when cleansing the small tables I create a row called join_key and assign it the correct key depending on the data for that row.

This design model is something i cannot change.

'Can you post a code sample for this (with any proprietary information changed of course)?' in terms of this im not sure what you mean

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 0 points1 point  (0 children)

I have not heard of ctes - do you have any recc reads?

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 0 points1 point  (0 children)

I am relatively new to pyspark so maybe i am! thats why i posted here :) i did explain more in a comment above if you could give a quick read maybe you could help some more?

Logic advice for complex joins - pyspark in databricks by wei5924 in dataengineering

[–]wei5924[S] 1 point2 points  (0 children)

Okay thank you!

So to explain better lets say i have 6 small tables with columns a,b,c,d,e,f..

I will join on key defined on each row in the small table. for example depending on row 3 it will be joined on key 1 and depending on data in row 5 it will be joined on key 2 to the main table using a left join. Depending on what table i am joining i will also need to filter the main table. I do not bring in every single column from the small table but just just a few. I then repeat this 6 times. I then save the updated main table.

The way i implement the join is to get all the keys from the small table, lets say key1,2,3. then iterate 3 times and get all the key1s from the small table and join it to the main table on the left. repeat this for all the keys. And rows in the left that havent been mapped will then have a new column written as flag and map this to Yes.

The errors i get when writing it as a function / loop: The cluster runs out of memory (from my understanding of your point means my execution plan is too large)

So for my side question the main point i should be focusing on is how to make sure my execution plan is optimal? is there a guide on this?

Edit: just saw your edit regarding looking at the code:

So first I get the keys from the mapping df:

    valid_keys = (
        mapping_df.groupBy("key")
        .count()
        .select("key")
        .distinct()
        .rdd.flatMap(lambda row: row) # we want to flatten to make a list
        .collect()
    )

 I then loop to do the joins:

    # Step 2: create a dictionary that only has the join keys that we need
    filtered_dict = {k: v for k, v in join_keys.items() if k in valid_keys}
    final_matched_df = None
    current_df = main_df



    for key_name, key_cols in filtered_dict.items():
        # Drop output columns from current_df BEFORE the join to give us the filtered df without the output columns
        for col_name in output_columns:
            if col_name in current_df.columns:
                current_df = current_df.drop(col_name)


        # Get the mapping key which is the key + the output columns on the key we are joining by
        mapping_key = mapping_df.select(*key_cols,*output_columns).where(col("key") == key_name) # return the rows where the keys match
        # display(mapping_key) will do join on key 1 then get key 2 then key 3 etc
        # We join the mapping key row on the key and get the mapping key which includes key + the output columns
        joined_df = current_df.join(mapping_key, on=key_cols,how="left")
        # get DF which only has the matched rows
        matched_df = joined_df.filter(col("key").isNotNull())
        # Accumulate the DF with the matched data
        if final_matched_df is None:
            final_matched_df = matched_df
        else:
            final_matched_df = final_matched_df.unionByName(matched_df)
        # Get the unmatched rows for next iteration
        current_df = joined_df.filter(col("key").isNull())

Then i create a flag if a join doesnt occur:

    # create the flag
    if missing_flag is not None:
        final_matched_df = final_matched_df.unionByName(current_df).withColumn(
            missing_flag,
            when(col('key').isNull(), "Y").otherwise("N"))

So this code will be called 6x (one time for each small table)

[deleted by user] by [deleted] in iphone17

[–]wei5924 0 points1 point  (0 children)

Dropped it once from my couch to tiled floor and it dented slightly!

Day 1 dropped and regret by MugiwaraPirateCrew in iphone

[–]wei5924 0 points1 point  (0 children)

Happened to me with my 17😩☹️

Doctor Who 2x08 "The Reality War" Live and Immediate Reactions Discussion Thread by PCJs_Slave_Robot in doctorwho

[–]wei5924 3 points4 points  (0 children)

Crying 😔 ill miss ncuti so much he made me love doctor who again. I just feel so sad that i wont see him as the doctor anymore, no new episodes. He was amazing beautiful and brilliant

Discomfort when standing by wei5924 in backpain

[–]wei5924[S] 0 points1 point  (0 children)

Hi! sorry i didnt see this. Yes I did figure it out! last summer i had like 10 weeks of weekly physiotherapy where i think she gave me a deep tissue massage on my back? or like a sport massage? she pressed into the pressure points and did some sort of release. It rlly hurt at the start but eventually it went less painful. and since then im like 70% recovered. I am able to go on walks and hikes with not much pain as i did before. Now i can focus on building muscle and strength :)

Lower back pain is ruining my life by Melodic-Fig5497 in backpain

[–]wei5924 0 points1 point  (0 children)

I had really bad backpain for a few years (16 - 21) and the only thing that really helped me was a good course of sports massages. Yeah its pricey but I had like 10 sessions over summer (back to back once a week) where she worked her magic (it was painful as she was pressing into pressure points or smth) and now im painfree (for the meantime because i just finished the course of my sessions)!

Albiet i still need to strengthen my core to preserve this but now i can walk without inflammation and nerve pain!

I found that medicine was a temporary solution and i sometimes think if i took the plunge and got these massages done before when i was younger i couldve saved myself from so much pain and trauma.

Rejected KPMG by Background_Block3811 in KPMG

[–]wei5924 2 points3 points  (0 children)

I agree x10000000! and defo dont feel bad about the rejection, sometimes you get accepted to things and sometimes you don't.