शुरू करेंमुफ़्त में शुरू करें

ब्रॉडकास्ट vs नॉर्मल जॉइन्स की तुलना

आपने दो तरह के joins बनाए हैं: normal और broadcasted. अब आपके मैनेजर यह जानना चाहते हैं कि Spark optimizations का उपयोग करने से परफॉर्मेंस में कितना सुधार हुआ. अगर नतीजे अच्छे रहे, तो आपको ज़रूरत के अनुसार Spark सेटअप को और ट्यून करने का मौका दिया जाएगा.

आपके पास उपयोग के लिए DataFrames normal_df और broadcast_df उपलब्ध हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

PySpark के साथ डेटा क्लीनिंग

पाठ्यक्रम देखें

अभ्यास निर्देश

  • normal DataFrame पर .count() चलाएँ.
  • broadcasted DataFrame पर .count() चलाएँ.
  • दोनों DataFrames के count और duration प्रिंट करें, और किसी भी अंतर को नोट करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

start_time = time.time()
# Count the number of rows in the normal DataFrame
normal_count = ____
normal_duration = time.time() - start_time

start_time = time.time()
# Count the number of rows in the broadcast DataFrame
broadcast_count = ____
broadcast_duration = time.time() - start_time

# Print the counts and the duration of the tests
print("Normal count:\t\t%d\tduration: %f" % (normal_count, normal_duration))
print("Broadcast count:\t%d\tduration: %f" % (broadcast_count, broadcast_duration))
कोड संपादित करें और चलाएँ