apache / apache/spark

[SPARK-57743][SQL] Addition of a partition function in datalake V1 tables

Open
#56,833 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
44k
Forks
29.4k
PR merge metrics
No merged PRs in 30d

Description

### Why this Issue is created?

In my work I've had requirements to create SQLs that run against AWS Glue Data Catalog Tables where they need to get data from the latest partition only.

Something like :-

**SELECT * FROM db.table WHERE partition_col = (SELECT max(partition_col) FROM db.table)**

But the issue with above approach is I've seen that pushdown predicate doesn't always read the metadata only and reads the data itself which shouldn't happen.

In Athena, to solve this the query can be written as :-

**SELECT * FROM db.table WHERE partition_col = (SELECT max(partition_col) FROM "db"."table$partitions")**

But there isn't a similar approach in Spark for V1 tables and the only way is using SHOW PARTITIONS but it doesn't work as a subquery.

### Issue: https://issues.apache.org/jira/browse/SPARK-57743

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by tracing the SHOW PARTITIONS entry point and the V1 table partition-metadata path, then clarify how a partition function should work in a subquery. Done means supporting latest-partition queries against AWS Glue Data Catalog tables without reading the underlying data.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, sql
Domain
data, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.