【发布时间】:2020-07-24 18:26:26
【问题描述】:
我有一个 hive 表,其中包含数据,并且它在基于 Year.Now 的分区列上分区。现在每天都会将数据加载到这个 hive 表中。我没有选择每天进行 msck 修复。我的分区是基于年份的。如果没有添加新分区,我是否需要在每日加载后进行 msck 修复。我在下面尝试过
val data = Seq(Row("1","2020-05-11 15:17:57.188","2020"))
val schemaOrig = List( StructField("key",StringType,true)
,StructField("txn_ts",StringType,true)
,StructField("txn_dt",StringType,true))
val sourceDf = spark.createDataFrame(spark.sparkContext.parallelize(data),StructType(schemaOrig))
sourceDf.write.mode("overwrite").partitionBy("txn_dt").avro("/test_a")
HIVE 外部表
create external table test_a(
key string,
txn_ts string
)
partitioned by (txn_dt string)
stored as avro
location '/test_a';
msck repair table test_a;
select * from test_a;
【问题讨论】:
标签: hive apache-spark-sql hiveql