Skip to content

tripathiganesh/Misc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Misc

stringDf is the raw nested json
originalSchema is the schema of the json
nestedDf is the nested dataframe

raw sample Json

{  
    "a":"a1",
    "balances":[  
        {  
            "ba":"ba1",
            "financeAccountRollup":{  
                "fara":"fara1"
            }
        } 
    ],
    "clients":{  
        "cbb":"cbb1"
    }
}

scala> nestedDf.printSchema()
root
 |-- json_data: struct (nullable = true)
 |    |-- a: string (nullable = true)
 |    |-- balances: array (nullable = true)
 |    |    |-- element: struct (containsNull = true)
 |    |    |    |-- ba: string (nullable = true)
 |    |    |    |-- financeAccountRollup: array (nullable = true)
 |    |    |    |    |-- element: struct (containsNull = true)
 |    |    |    |    |    |-- farb: string (nullable = true)
 

scala> nestedDf.dropNestedColumn("json_data.balances.financeAccountRollup.farb").printSchema()
root
|-- json_data: struct (nullable = false)
|    |-- a: string (nullable = true)
|    |-- balances: struct (nullable = false)
|    |    |-- ba: array (nullable = true)
|    |    |    |-- element: string (containsNull = true)
|    |    |-- financeAccountRollup: struct (nullable = false)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages