0

I ran the following query in Hive and it successfully updated the column value in the table: select id, regexp_replace(full_name,'A','C') from table

But when I ran the same query from Spark SQL, it did not update the actual records

hiveContext.sql("select id, regexp_replace(full_name,'A','C') from table")

but when I do a hiveContext.sql("select id, regexp_replace(full_name,'A','C') from table").show() -- it displays A replaced with C successfully ... only in the display and not in the actual table

I tried to assign the result to another variable

val vFullName = hiveContext.sql("select id, regexp_replace(full_name,'A','C') from table") 

and then

vFullName.show() -- it displays the original values without replacement

How do I get the value replaced in the table from SparkSQL?

Kaushik Nayak
  • 30,772
  • 5
  • 32
  • 45
Neha
  • 153
  • 3
  • 18

0 Answers0