Skip to content

Conversation

@tchow-zlai
Copy link
Collaborator

@tchow-zlai tchow-zlai commented Jul 30, 2025

Summary

  • output table partitions are no longer configurable for the user. We'll follow up this PR with one that deprecates the spark confs as well.

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Added support for specifying a partition format when defining table dependencies.
  • Bug Fixes

    • Ensured partition interval is consistently set to 1 day for table dependencies.
  • Refactor

    • Removed the partition column parameter from staging query creation, simplifying the process for users.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 30, 2025

Walkthrough

The TableDependency dataclass now includes an optional partition_format field, and its to_thrift method sets both this field and a fixed 1-day partition interval. The partition_column parameter was removed from the StagingQuery function and the corresponding Thrift struct, with affected field numbering updated. The Scala builder method for StagingQuery was also updated to remove the partitionColumn parameter.

Changes

Cohort / File(s) Change Summary
TableDependency & StagingQuery Python API
api/python/ai/chronon/staging_query.py
Added partition_format to TableDependency, updated to_thrift to set partitionFormat and fixed 1-day interval, removed partition_column from StagingQuery signature and usage.
Thrift API Struct Update
api/thrift/api.thrift
Removed partitionColumn from StagingQuery struct; renumbered engineType and tableDependencies fields.
Scala Builder Update
api/src/main/scala/ai/chronon/api/Builders.scala
Removed partitionColumn parameter and related setter call from StagingQuery.apply method.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant StagingQuery
    participant TableDependency
    participant Thrift

    Caller->>StagingQuery: Call without partition_column
    StagingQuery->>TableDependency: Use TableDependency (with partition_format)
    TableDependency->>Thrift: to_thrift() (sets partitionFormat, 1-day interval)
    StagingQuery->>Thrift: Construct StagingQuery (no partitionColumn)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • varant-zlai
  • chewy-zlai
  • david-zlai

Poem

Partition columns take their bow,
A format joins the show for now.
One-day windows, thrift anew,
Table dependencies marching through.
Old fields renumber, code refined—
In Chronon's world, the stars aligned!
✨🗂️

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3043f2e and b4ab157.

📒 Files selected for processing (1)
  • api/src/main/scala/ai/chronon/api/Builders.scala (0 hunks)
💤 Files with no reviewable changes (1)
  • api/src/main/scala/ai/chronon/api/Builders.scala
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: cloud_aws_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: groupby_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: join_tests
  • GitHub Check: service_tests
  • GitHub Check: service_commons_tests
  • GitHub Check: online_tests
  • GitHub Check: api_tests
  • GitHub Check: streaming_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: flink_tests
  • GitHub Check: python_tests
  • GitHub Check: batch_tests
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tchow/sq-partition

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
api/python/ai/chronon/staging_query.py (1)

81-81: Remove orphaned documentation.

Documentation references removed partition_column parameter.

-    :type partition_column: str
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 926eb2d and 3043f2e.

📒 Files selected for processing (2)
  • api/python/ai/chronon/staging_query.py (2 hunks)
  • api/thrift/api.thrift (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: tchow-zlai
PR: zipline-ai/chronon#192
File: spark/src/main/scala/ai/chronon/spark/GroupBy.scala:296-299
Timestamp: 2025-01-09T17:57:34.451Z
Learning: In Spark SQL date handling:
- date_format() converts dates to strings (used for partition columns which need string format)
- to_date() converts strings to DateType (used when date operations are needed)
These are opposites and should not be standardized to use the same function.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: cloud_aws_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: service_commons_tests
  • GitHub Check: service_tests
  • GitHub Check: api_tests
  • GitHub Check: groupby_tests
  • GitHub Check: online_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: python_tests
  • GitHub Check: flink_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: streaming_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: join_tests
  • GitHub Check: spark_tests
  • GitHub Check: batch_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (3)
api/python/ai/chronon/staging_query.py (3)

22-22: LGTM on partition_format addition.

New field properly supports the evolution away from partition_column.


34-35: LGTM on to_thrift updates.

Correctly includes new partition_format field and sets fixed 1-day interval.


139-144: Remove partition_column suggestion: TableDependency owns and uses partition_column correctly

The StagingQuery builder never accepted a top-level partition_column; it’s provided per-dependency via TableDependency, which is passed into both create_airflow_dependency and to_thrift(). No change needed.

Likely an incorrect or invalid review comment.

Comment on lines +87 to +89
5: optional EngineType engineType

7: optional list<common.TableDependency> tableDependencies
6: optional list<common.TableDependency> tableDependencies
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Field removal breaks backward compatibility.

Removing partitionColumn field and renumbering subsequent fields will break existing Thrift clients. Consider deprecating the field first before removal.

🤖 Prompt for AI Agents
In api/thrift/api.thrift around lines 87 to 89, the removal of the
partitionColumn field and renumbering of subsequent fields breaks backward
compatibility with existing Thrift clients. To fix this, do not remove the
partitionColumn field immediately; instead, mark it as deprecated in the Thrift
IDL to maintain compatibility. Keep the original field numbering intact and
avoid renumbering other fields to prevent breaking existing clients.

@tchow-zlai tchow-zlai merged commit a31e07b into main Jul 31, 2025
34 of 38 checks passed
@tchow-zlai tchow-zlai deleted the tchow/sq-partition branch July 31, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants