PySpark to IBIS #7443
-
Hi Team, Let’s assume we have a pyspark dataframe. How easily can I convert pyspark dataframe to an ibis table or dataframe? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
hi @vmsaipreeth, which Spark platform are you using? I think the best way would be to save the data as a table via PySpark, then access that table through alternatively, you could use PyArrow to ingest the data from the PySpark dataframe into an Ibis table |
Beta Was this translation helpful? Give feedback.
-
hi @vmsaipreeth -- do you have an existing Spark session that this DataFrame is attached to? Ibis connects to a Spark Session, so if the DataFrame is a view in that session, you can interact with it that way. It would probably look something like: import ibis
from pyspark.sql import SparkSession
session = SparkSession.builder.appName("my_session").getOrCreate()
existing_spark_df.createOrReplaceTempView("my_df")
con = ibis.pyspark.connect(session)
my_df = con.table("my_df") |
Beta Was this translation helpful? Give feedback.
hi @vmsaipreeth -- do you have an existing Spark session that this DataFrame is attached to?
Ibis connects to a Spark Session, so if the DataFrame is a view in that session, you can interact with it that way. It would probably look something like: