SandishKumarHN opened a new pull request, #38212: URL: https://github.com/apache/spark/pull/38212
From SandishKumarHN([email protected]) and Mohan Parthasarathy([email protected]) This PR follows main PR https://github.com/apache/spark/pull/37972 The following is an example of how to use from_protobuf and to_protobuf in Pyspark. ```python data = ([Row(key="1", value=Row(age=2, name="Alice", score=109200))]) schema = StructType([StructField("key", StringType(), False), StructField( "value", StructType([ StructField("age", IntegerType(), False), StructField("name", StringType(), False), StructField("score", LongType(), False), ]), False) df = spark.createDataFrame(data, schema) descFilePath = 'connector/protobuf/src/test/resources/protobuf/pyspark_test.desc' messageName = 'SimpleMessage' protobufDf = df.select(to_protobuf(df.value, descFilePath, messageName).alias("protobuf")) protobufDf.collect() df = protobufDf.select(from_protobuf(protobufDf.protobuf, descFilePath, messageName).alias("value")) df.collect() ``` ### ****Tests Covered**** - from_protobuf / to_protobuf (functions.py) -- 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]
