Skip to content

Conversation

@tchow-zlai
Copy link
Collaborator

@tchow-zlai tchow-zlai commented Jun 24, 2025

Summary

Checklist

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

Summary by CodeRabbit

  • Refactor
    • Improved the logic for deriving table dependencies from joins, resulting in a more streamlined and maintainable approach.
  • Tests
    • Enhanced test coverage by specifying event sources in join scenarios for more precise validation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 24, 2025

Walkthrough

The fromJoin method in TableDependencies.scala was refactored to delegate dependency extraction to fromGroupBy, fromSource, and fromTable, removing explicit logic for window and partition offset calculations and data model checks. The control flow is now more modular and compositional.

Changes

File Change Summary
api/src/main/scala/ai/chronon/api/planner/TableDependencies.scala Refactored fromJoin to extract dependencies via fromGroupBy, fromSource, and fromTable; removed manual window/partition logic and model checks.
api/src/test/scala/ai/chronon/api/test/planner/MonolithJoinPlannerTest.scala Added explicit left field initialization in Join instances using event sources in multiple tests; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant TableDependencies
    participant Join
    participant GroupBy
    participant Source

    Caller->>TableDependencies: fromJoin(join)
    TableDependencies->>Join: access joinParts, left, bootstrapParts
    loop For each joinPart
        TableDependencies->>GroupBy: fromGroupBy(joinPart.groupBy)
    end
    TableDependencies->>Source: fromSource(join.left)
    loop For each bootstrapPart
        TableDependencies->>Source: fromTable(bootstrapPart)
    end
    TableDependencies-->>Caller: return all dependencies
Loading

Possibly related PRs

Suggested reviewers

  • nikhil-zlai
  • varant-zlai

Poem

Refactored code, dependencies align,
From manual checks to methods divine.
GroupBy and Source now take the stage,
Simpler logic, a cleaner page.
JoinParts assemble, bootstrap too—
TableDependencies, streamlined for you! 🎉🐇


📜 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 1e7e469 and 91c2bb0.

📒 Files selected for processing (2)
  • api/src/main/scala/ai/chronon/api/planner/TableDependencies.scala (2 hunks)
  • api/src/test/scala/ai/chronon/api/test/planner/MonolithJoinPlannerTest.scala (8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (15)
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: streaming_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: service_commons_tests
  • GitHub Check: groupby_tests
  • GitHub Check: cloud_aws_tests
  • GitHub Check: api_tests
  • GitHub Check: online_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: flink_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: spark_tests
  • GitHub Check: service_tests
  • GitHub Check: batch_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (4)
api/src/main/scala/ai/chronon/api/planner/TableDependencies.scala (2)

7-8: LGTM on new imports.

Required for the refactored fromJoin implementation.


23-29: ```shell
#!/bin/bash

Locate Join definition

rg -n 'case class Join' -C3 api/src/main/scala/ai/chronon/api

Locate joinParts and bootstrapParts declarations

rg -n 'joinParts' -n 'bootstrapParts' -C3 api/src/main/scala/ai/chronon/api


</details>
<details>
<summary>api/src/test/scala/ai/chronon/api/test/planner/MonolithJoinPlannerTest.scala (2)</summary>

`13-13`: **LGTM on new import.**

Required for the explicit `left` source definitions.

---

`66-66`: **Consistent test updates align with refactored dependency logic.**

All tests now explicitly define the join's left source, ensuring the refactored `fromJoin` method is properly exercised.



Also applies to: 73-73, 89-89, 106-106, 113-113, 133-133, 143-143, 174-174, 196-196, 203-203

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAM3gADy4ASSIMfH9ILxUSXyF8eCwlbmRMeiFsRFDKjyIKfGxuACFZABoskljcRAaKBhJ2gXx8btwqbmjIAHc0ZAcBZnUaejkw2A8avlwGWHwpsAA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NB7uiKHQ6x0LljgnBujwmc2BLjJOjTsGa8RkGcGaHhpRcy3NJAwUW2b1a1LAtyTUNoOzIllCY3YIdIHr1iLIY+IdKS6knKjbOrYSCo2ahQFelBVY9XSKiS99J/Ag3aFUAE0I0CyFKtIS5iii6iDwJXQoy4NxlAbu0VMW5qBs0aNE2eOHzz1FHF9K2SiYpZkwOIBDsx7qICPjdZ0oSlmbyaUGA1zxCwZuiT+ScZJZgh0Ezq1sQ4jwnnMSbGgmYpDrh6L4jw6zCjvuvVsNKTbcD5TvoUZW7QpgIE7KTRqzVKh1tVCe0RNxExGHMFG2pIkGlcuaZq7I2q+6dPlT07cfT/wqqGTIkZBgpXkGNSFAwGEDBcQRrhAShFhIkRFGJdgXAqDSQTVSeSChmIqDUCpDi6kStYSnOoAA+hcRA/X/BChIHq2g/WFpfTUhpUrABmNAJB5sAAZYi0AAKwfDQAAJhWxtlbLwADsR23gMB2ztjb6MdsCCOx8Bgbw3hbb9AwWgAA2BgG3Zs9YgJAD4JAjskAACxvbeCQFbAh5uPZW/N9bm23hA6O7QKHbwXgvA+GdlbiOVskA+LQIHbxvulc+Od1QOO3s7eWxD1HaAVsPflAIN7OOgexA27EWHW5/v/Y24T4rpWyIDaGyNpqPkJv9ZwrNoAA== -->

<!-- internal state end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=zipline-ai/chronon&utm_content=891):

- 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](https://www.coderabbit.ai/contact-us/support) 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](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@tchow-zlai tchow-zlai changed the title fromJoin fix: Ignore label join deps and just use groupBy, leftsource, bootstrap Jun 24, 2025
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: 0

🧹 Nitpick comments (1)
api/src/main/scala/ai/chronon/api/planner/TableDependencies.scala (1)

27-27: Simplify bootstrap parts conversion.

The array conversion is unnecessarily complex.

-      scala.Option(join.bootstrapParts.toScala.toArray[BootstrapPart]).getOrElse(Array.empty[BootstrapPart])
+      Option(join.bootstrapParts).map(_.asScala.toSeq).getOrElse(Seq.empty)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae30fd and 1e7e469.

📒 Files selected for processing (1)
  • api/src/main/scala/ai/chronon/api/planner/TableDependencies.scala (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: online_tests
  • GitHub Check: cloud_aws_tests
  • GitHub Check: api_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: service_commons_tests
  • GitHub Check: service_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: flink_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (2)
api/src/main/scala/ai/chronon/api/planner/TableDependencies.scala (2)

7-8: New imports look appropriate.

Required for the refactored fromJoin implementation.


23-29: Verify the labelParts → joinParts change.

The refactor delegates nicely to existing methods, but switching from join.labelParts to join.joinParts could change behavior significantly.

#!/bin/bash
# Verify usage of labelParts vs joinParts in the codebase
rg -A 3 -B 3 "labelParts|joinParts" --type scala

@tchow-zlai tchow-zlai force-pushed the tchow/monolith-deps branch from 1e7e469 to 91c2bb0 Compare June 24, 2025 21:06
@tchow-zlai tchow-zlai merged commit 9ef0ba9 into main Jun 24, 2025
25 of 27 checks passed
@tchow-zlai tchow-zlai deleted the tchow/monolith-deps branch June 24, 2025 21:22
@coderabbitai coderabbitai bot mentioned this pull request Jun 25, 2025
4 tasks
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.

5 participants