2
votes

I have created an external Hive table based on a partitioned Parquet file in S3 using a statement similar to this:

CREATE EXTERNAL TABLE default.person
(
    first_name STRING,
    last_name STRING
)
PARTITIONED BY (age INT)
STORED AS parquet
LOCATION 's3a://default/person.parquet'"  

The table is created and running DESCRIBE TABLE default.person shows:

+--------------------------+------------+----------+--+
|         col_name         | data_type  | comment  |
+--------------------------+------------+----------+--+
| first_name               | string     | NULL     |
| last_name                | string     | NULL     |
| # Partition Information  |            |          |
| # col_name               | data_type  | comment  |
| age                      | int        | NULL     |
+--------------------------+------------+----------+--+

However when I query the table with Beeline it returns zero records. I think I need to refresh the partition info in the Hive Metastore.

So I run MSCK REPAIR TABLE default.person but it fails with this error:

Error: java.lang.NoSuchMethodException: org.apache.hadoop.hive.ql.metadata.Hive.alterTable(java.lang.String, org.apache.hadoop.hive.ql.metadata.Table) (state=,code=0)

Am I on the right path, and why might this error be occurring ?

Hive version is 2.3.6.

1

1 Answers

0
votes

The equivalent command on Amazon Elastic MapReduce (EMR)'s version of Hive is:

ALTER TABLE table_name RECOVER PARTITIONS;

See Recover Partitions manual for more details.