Trying to write a Hive query in Scala/Spark, which looks like this
val myQuery = "create table myTable(col1 STRING, col2 STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' location 'path/from/to' as select * myHiveTable"
I'm getting an error from my use of '\t'
value unary_+ is not a member of String
What's the proper way to handle this character in Scala?
If you use single double quotes
"
then escaped characters are interpreted according to their meaning, i.e.\t
becomes a tab and\n
becomes a new line. Example:If you use tripple double quotes
"""
Scala will leave the string as it is. Example:I believe Spark expects to see
\t
as text value (2 chars) rather than as a value of tab (U+0009).