1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Spark SQL in Python

Exercise

Practice logging 2

The following code is executed on startup:

import logging
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG,
                    format='%(levelname)s - %(message)s')

In the lesson we learned that Spark operations that trigger an action must be logged with care to avoid stealth loss of compute resources. You will now practice identifying logging statements that trigger an action on a dataframe or table.

A dataframe text_df is available. This dataframe is registered as a table called table1.

Instructions

100 XP
  • Several log statements are provided. All of them are initially commented out. Uncomment the five statements that do not trigger an action on text_df.