Try to search your question here, if you can't find : Ask Any Question Now ?

How to SparkSQL load csv with header on FROM statement

HomeCategory: stackoverflowHow to SparkSQL load csv with header on FROM statement
Avatarpushpa asked 5 months ago

Spark SQL FROM statement can be specified file path and format.
but, header ignored when load csv.
can use header for column name?

~ > cat test.csv
a,b,c
1,2,3
4,5,6
scala> spark.sql("SELECT * FROM csv.`test.csv`").show()
19/06/12 23:44:40 WARN ObjectStore: Failed to get database csv, returning NoSuchObjectException
+---+---+---+
|_c0|_c1|_c2|
+---+---+---+
|  a|  b|  c|
|  1|  2|  3|
|  4|  5|  6|
+---+---+---+

I want to.

+---+---+---+
|  a|  b|  c|
+---+---+---+
|  1|  2|  3|
|  4|  5|  6|
+---+---+---+
1 Answers
Best Answer
AvatarArben answered 5 months ago
Your Answer

12 + 19 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com