This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql.types import StructType | |
# get field name from schema (recursive for getting nested values) | |
def get_schema_field_name(field, parent=None): | |
if type(field.dataType) == StructType: | |
if parent == None: | |
prt = field.name | |
else: | |
prt = parent+"."+field.name # using dot notation | |
res = [] |