From d9c4cb7cfaabac05a84bff49f95bc69853c17b3a Mon Sep 17 00:00:00 2001 From: Matthew Powers Date: Sat, 7 Oct 2023 15:28:57 -0400 Subject: [PATCH] Remove flatten array functionality that's broken --- tests/test_functions.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/tests/test_functions.py b/tests/test_functions.py index b1766f46..43790702 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -429,16 +429,11 @@ def test_flatten_dataframe(spark): 1, "John", {"age": 30, "gender": "M", "address": {"city": "New York", "state": "NY"}}, - [ - {"type": "home", "number": "555-1234"}, - {"type": "work", "number": "555-5678"}, - ], ), ( 2, "Jane", {"age": 25, "gender": "F", "address": {"city": "San Francisco", "state": "CA"}}, - [{"type": "home", "number": "555-4321"}], ), ] schema = StructType( @@ -465,28 +460,14 @@ def test_flatten_dataframe(spark): ), True, ), - StructField( - "phone_numbers", - ArrayType( - StructType( - [ - StructField("type", StringType(), True), - StructField("number", StringType(), True), - ] - ), - True, - ), - True, - ), ] ) df = spark.createDataFrame(data, schema) # Define expected output expected_data = [ - (1, "John", 30, "M", "New York", "NY", "home", "555-1234"), - (1, "John", 30, "M", "New York", "NY", "work", "555-5678"), - (2, "Jane", 25, "F", "San Francisco", "CA", "home", "555-4321"), + (1, "John", 30, "M", "New York", "NY"), + (2, "Jane", 25, "F", "San Francisco", "CA"), ] expected_schema = StructType( [ @@ -496,8 +477,6 @@ def test_flatten_dataframe(spark): StructField("details:gender", StringType(), True), StructField("details:address:city", StringType(), True), StructField("details:address:state", StringType(), True), - StructField("phone:numbers:type", StringType(), True), - StructField("phone:numbers:number", StringType(), True), ] ) expected_df = spark.createDataFrame(expected_data, expected_schema)