Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- val finalResult = hiveContext.sql("""SELECT * from """ + temptableName + """)
- if (finalResult.count() > 0) {
- finalResult.foreach { row =>
- RealtimeUtil.loadStreamProperties("TestFlow.properties")
- val tag1 = row.getAs("new_val1").asInstanceOf[String]
- val tag2 = row.getAs("new_val2").asInstanceOf[String]
- val string = """This is a template string with some value
- "-Name":"TAG1", "#text":"****",
- "-Name":"TAG2", "#text":"****"
- """
- val string2 = string
- .replace(""""-Name":"TAG1", "#text":"****"""", """"-Name":"TAG1", "#text":"""" + new_val1 +""")
- .replace(""""-Name":"TAG2", "#text":"****"""", """"-Name":"TAG2", "#text":"""" + new_val2 +""")
- hiveContext.sql("""insert into table testdb.final_table values ("""" + string2 + ")"""
- \above statement failing with NPE
- val someDF = Seq((1, string2)).toDF("seq", "value").coalesce(1).select("value").write.format("text").mode("append").save("/tmp/output")
- \above statement failing with NPE
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement