Comment puis-je abandonner toutes les partitions à la fois dans la ruche?

Ruche version 1.1

J'ai une ruche externe le tableau ci-dessous

 CREATE EXTERNAL TABLE `schedule_events`(
  `schedule_id` string COMMENT 'from deserializer',
  `service_key` string COMMENT 'from deserializer',
  `event_start_date_time` string COMMENT 'from deserializer',
  `event_id` string COMMENT 'from deserializer',
  `event_type` string COMMENT 'from deserializer',
  `transitional_key` string COMMENT 'from deserializer',
  `created_date_time` string COMMENT 'from deserializer',
  `bus_date` string COMMENT 'from deserializer')
    PARTITIONED BY (
                    `year` string,
                    `month` string,
                    `day` string)
   ROW FORMAT SERDE
   'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
   STORED AS INPUTFORMAT
   'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
   OUTPUTFORMAT
   'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
   LOCATION
   'hdfs://nameservice1/hadoop/raw/omega/scheduled_events'
  TBLPROPERTIES (
    'avro.schema.url'='hdfs:////hadoop/raw/omega/schema/schedule_events.avsc',
   'transient_lastDdlTime'='1505742141')

Maintenant à déposer une partition en particulier, je peux exécuter une commande ALTER comme ci-dessous

 ALTER TABLE schedule_events DROP IF EXISTS PARTITION  (year='2016',month='06',day='01')
 Dropped the partition year=2016/month=06/day=01

 hive> show partitions schedule_events;
 OK
 year=2017/month=09/day=01
 year=2017/month=09/day=02
 year=2017/month=09/day=03
 year=2017/month=09/day=04
 year=2017/month=09/day=05

Mais ce tableau est d'avoir de nombreuses partitions

Comment puis-je abandonner toutes les partitions existantes à la fois? Je voudrais supprimer toutes les partitions existantes à la fois? Est-ce possible?

Essayez ALTER TABLE schedule_events DROP IF EXISTS PARTITION (year is not null)
Je ne pense pas que cela fonctionnerait. Votre requête ALTER TABLE schedule_events DROP IF EXISTS PARTITION (year is not null) serait de vérifier si une partition year is not null existe, ce qui est faux.

OriginalL'auteur Surender Raja | 2017-09-19