Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix partitioning on timestamp field with year and month transformations #12443

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tousifanwar11
Copy link

@tousifanwar11 tousifanwar11 commented Mar 3, 2025

Fixes #12442

Add a test case for creating a table partitioned by year and month in TestCreateTable.java.

  • Add testCreateTablePartitionedByYearAndMonth method to verify table creation with PARTITIONED BY (year(completion_date), month(completion_date)).
  • Check that the table is created successfully with the correct schema and partitioning.
  • Ensure the table does not have the default format set.

For more details, open the Copilot Workspace session.

Fixes apache#12442

Add a test case for creating a table partitioned by year and month in `TestCreateTable.java`.

* Add `testCreateTablePartitionedByYearAndMonth` method to verify table creation with `PARTITIONED BY (year(completion_date), month(completion_date))`.
* Check that the table is created successfully with the correct schema and partitioning.
* Ensure the table does not have the default format set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/apache/iceberg/issues/12442?shareId=XXXX-XXXX-XXXX-XXXX).
@github-actions github-actions bot added the spark label Mar 3, 2025
…ations on the same timestamp field and add tests for creating tables with such partitioning.

* **PartitionSpec.java**
  - Update `Builder` class to handle multiple partition transformations on the same timestamp field
  - Add logic to check for redundant partitions and throw an exception if found
  - Modify `checkAndAddPartitionName` method to handle multiple transformations
  - Ensure `build` method validates the new partitioning logic

* **TestCreateTable.java**
  - Add test case for creating a table with `PARTITIONED BY (year(completion_date), month(completion_date))`
  - Verify table creation with correct partitioning
  - Ensure test case covers both singular and plural forms of transformations
@github-actions github-actions bot added the API label Mar 3, 2025
Copy link
Author

@tousifanwar11 tousifanwar11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix syntax

@Fokko
Copy link
Contributor

Fokko commented Mar 3, 2025

@tousifanwar11 Can you provide more context on what you're trying to achieve? The partitioning schemes are redundant:

// When completion_date == 2025-01-03
year(completion_date) => 2025-01-01
month(completion_date) => 2025-01-01

// When completion_date == 2025-05-03
year(completion_date) => 2025-01-01
month(completion_date) => 2025-05-01

The month partitioning also covers for the year partitioning 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants