QuestionQ160

Data Store Management

A data engineer creates an AWS Glue Data Catalog table by using an AWS Glue crawler named Orders. The data engineer needs to add these new partitions:

  • s3://transactions/orders/order_date=2023-01-01
  • s3://transactions/orders/order_date=2023-01-02

The data engineer must update the metadata to include the new partitions in the table without scanning every folder and file in the table location.

Which data definition language (DDL) statement should the data engineer use in Amazon Athena?

  • A ALTER TABLE Orders ADD PARTITION(order_date=’2023-01-01’) LOCATION ‘s3://transactions/orders/order_date=2023-01-01’;ALTER TABLE Orders ADD PARTITION(order_date=’2023-01-02’) LOCATION ‘s3://transactions/orders/order_date=2023-01-02’;
  • B MSCK REPAIR TABLE Orders;
  • C REPAIR TABLE Orders;
  • D ALTER TABLE Orders MODIFY PARTITION(order_date=’2023-01-01’) LOCATION ‘s3://transactions/orders/2023-01-01’;ALTER TABLE Orders MODIFY PARTITION(order_date=’2023-01-02’) LOCATION ‘s3://transactions/orders/2023-01-02’;
Explanation

ALTER TABLE ADD PARTITION directly creates the specified partition metadata in the AWS Glue Data Catalog and associates each partition with its S3 location. This registers the two known partitions without using a discovery operation that scans the table location. MSCK REPAIR TABLE discovers Hive-style partitions by scanning the table's S3 location, so it does not meet the no-scan requirement.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!