2

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.

Phil
  • 598
  • 1
  • 9
  • 21

1 Answers1

0

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.

leftjoin
  • 36,950
  • 8
  • 57
  • 116
  • I have tried that, get the same error -> ALTER TABLE table_name RECOVER PARTITIONS; 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). Not running in EMR though, system in on-prem – Phil Mar 13 '20 at 09:54