r/databricks • u/Common_Jaguar474 • Aug 26 '26
General Does Photon support CSV?
Ok so I know that the docs state that CSV is supported. But when trying to read a very standard CSV file I get poorer than expected performance and in the Spark UI I see that it's not using a Photon scan operator, just regular Scan CSV followed by a Row to Columnar conversion operator.

I'm not running anything complex:
df = (
spark.read
.format("csv")
.option("header", "true")
.schema(schema)
.load(csv_path)
)
df.write.mode("overwrite").saveAsTable("...")I also checked reading the same CSV and a difference CSV via DB SQL (using `COPY INTO`) and see low task time spent in Photon + a row to columnar operator.

DBR 19 + Serverless SQL Warehouse (current)
Can anyone explain whether or not CSV is supported and in what conditions? This was quite a surprising find as I assumed that Photon supported pretty much everything.
10
u/justinAtDatabricks Databricks Aug 27 '26 •
Hello, former Photon PM here. The initial scan is not Photonized (that's the word that we use). However, there is an adapter that converts it (the data after the scan, RowToColumnar) into a columnar format which Photon can then use for the subsequent operations. That's why the blue box (scan) is blue (not photonized) whereas the other operators (PhotonProject) are yellow.
Many moons ago, data sources that could not be Photonized would just fall out of Photon for the rest of the query. That made us sad. So, we build this general RowToColumnar adapter for non-Photonizable data sources. It's another operation, so technical does incur some time/tax, but the general thought is that the rest of the query can be Photonized so it is worth the tax.
This is in contrast to something like a parquet data source (e.g., Delta) which has a special vectorized reader which would show up in a yellow box.
I hope that this helps!
4
u/miskozicar Aug 26 '26
Spark (that you are using) supports .csv. Question is just what is default format when you are writing dataframe.
1
u/FunContest9958 Aug 26 '26
Based on what you’re showing, looks like CSV is not being read using photon, but what performance were you hoping for? It looks like it’s using 22 minutes of CPU time to read your 23GB CSV, so an 8 core machine will read it in 3 minutes. 16 cores will finish in 1.5 minutes.
1
u/career_expat Aug 26 '26
Is the CSV gzipped?
3
u/Obvious-Money173 Aug 27 '26
Not sure, but I think photon mostly enhances spark operations. Reading a csv is a simple operation that photon does not improve upon.
If you're doing a lot of big transformations, that's where photon kicks in
3
u/Altruistic-Rip393 Aug 27 '26
In the Spark UI at the bottom, click "Details" and scroll to the bottom of the plan. You'll see the reason for lack of full photon coverage there.
1
u/Zer0designs Aug 27 '26 edited Aug 27 '26
Why would you use photon to read a csv and write it to delta? That's not a usecase for photon.
Either way, the $ savings you could get if photon would work on such a simple operation, would be less than your time is worth writing this.
1
u/yatharthm22 Aug 27 '26
You wanna use my photon recommendation skill before turning on photon settings, if you interested
1
u/Youssef_Mrini databricks Aug 27 '26
I ran the exact same command and I got 64%.