Quantcast
Channel: How can I change column types in Spark SQL's DataFrame? - Stack Overflow
Viewing all articles
Browse latest Browse all 24

Answer by Tejasvi Sharma for How can I change column types in Spark SQL's DataFrame?

$
0
0

One can change data type of a column by using cast in spark sql.table name is table and it has two columns only column1 and column2 and column1 data type is to be changed.ex-spark.sql("select cast(column1 as Double) column1NewName,column2 from table")In the place of double write your data type.


Viewing all articles
Browse latest Browse all 24

Trending Articles