ayushi-agarwal commented on PR #8320:
URL:
https://github.com/apache/incubator-gluten/pull/8320#issuecomment-2572966401
val jsonData = Seq(
"""{"platformId": "IPHONE", "userId": "123", "sessionId": "abc"}""",
"""{"platformId": "ANDROID", "userId": "456", "sessionId": "def"}""",
"""{"platformId": "IPHONE", "userId": "789", "sessionId": "ghi"}"""
)
val df =
spark.createDataFrame(jsonData.map(Tuple1(_))).toDF("json_column")
df.printSchema()
df.write.mode("overwrite").parquet("output/json_parquet_data")
val parquetDF = spark.read.parquet("output/json_parquet_data")
val r2 = parquetDF.collect()
r2.foreach(println)
val schema = new StructType().add("platformId",
StringType).add("userId", StringType).add("sessionId", StringType)
val filteredDF = parquetDF.withColumn("parsed_json",
from_json(col("json_column"), schema)).select("parsed_json")
val result = filteredDF.collect()
This prints null result when offloaded.
@zhli1142015 Are structs not supported? Shall we add a check to not offload
for struct types?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]