[英]Create hive Views using scala /spark
How do I create multiple table views in Hive programmatically using spark and scala? 如何使用Spark和Scala在Hive中以编程方式创建多个表视图?
Since SPARK 2: 从SPARK 2开始:
spark.sql("create or replace view viewSO as select f1.orig as f1_orig, f2.orig as f2_orig, f2.dest as f2_dest from facts f1, facts f2 ")
spark.table("viewSO").printSchema
root
|-- f1_orig: string (nullable = true)
|-- f2_orig: string (nullable = true)
|-- f2_dest: string (nullable = true)
I would do it in Hive, Impala, but anyway. 我会在Hive,Impala中这样做,但是无论如何。
And: 和:
spark.sql("drop view viewSO")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.