-
Notifications
You must be signed in to change notification settings - Fork 8
Add GBU planner + tests #883
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
Conversation
WalkthroughThe changes remove the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LocalRunner
participant GroupByUploadPlanner
participant ConfPlan
User->>LocalRunner: Run with "groupby_uploads" confType
LocalRunner->>GroupByUploadPlanner: Create planner for each GroupBy config
GroupByUploadPlanner->>GroupByUploadPlanner: buildPlan()
GroupByUploadPlanner->>ConfPlan: Create ConfPlan with upload node
ConfPlan-->>LocalRunner: Return plan
LocalRunner-->>User: Print plan
sequenceDiagram
participant BatchRunner
participant NodeContent
participant GroupByUploadNode
participant GroupByUpload
BatchRunner->>NodeContent: loadNodeContent("group_by_upload")
NodeContent->>GroupByUploadNode: Wrap GroupBy config
BatchRunner->>BatchRunner: runGroupByUpload()
BatchRunner->>GroupByUpload: run upload with config and partition
BatchRunner-->>User: Log success
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (15)
🔇 Additional comments (10)
|
There was a problem hiding this 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
🧹 Nitpick comments (1)
api/src/main/scala/ai/chronon/api/planner/LocalRunner.scala (1)
69-71: Update error message to include new conf type.Error message still lists old supported types.
- s"Unsupported conf type: $confType. Supported types are: joins, staging_queries." + s"Unsupported conf type: $confType. Supported types are: joins, staging_queries, groupby_uploads."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
api/src/main/scala/ai/chronon/api/planner/GroupByPlanner.scala(0 hunks)api/src/main/scala/ai/chronon/api/planner/GroupByUploadPlanner.scala(1 hunks)api/src/main/scala/ai/chronon/api/planner/LocalRunner.scala(3 hunks)api/src/test/scala/ai/chronon/api/test/planner/GroupByUploadPlannerTest.scala(1 hunks)
💤 Files with no reviewable changes (1)
- api/src/main/scala/ai/chronon/api/planner/GroupByPlanner.scala
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: cloud_gcp_tests
- GitHub Check: service_commons_tests
- GitHub Check: cloud_aws_tests
- GitHub Check: online_tests
- GitHub Check: api_tests
- GitHub Check: service_tests
- GitHub Check: fetcher_tests
- GitHub Check: flink_tests
- GitHub Check: batch_tests
- GitHub Check: aggregator_tests
- GitHub Check: scala_compile_fmt_fix
🔇 Additional comments (14)
api/src/main/scala/ai/chronon/api/planner/LocalRunner.scala (3)
4-4: LGTM on import additions.The new imports support the added functionality correctly.
39-42: Usage comment is clear and helpful.Good documentation for running the tool.
64-67: New groupby_uploads case implemented correctly.The implementation follows the same pattern as existing cases.
api/src/main/scala/ai/chronon/api/planner/GroupByUploadPlanner.scala (5)
1-9: Well-structured class definition.Good use of case class and proper inheritance.
11-13: Clean dependency extraction and constants.Good separation of concerns.
15-19: Smart execution info erasure.Prevents heavy data duplication as intended.
21-25: Proper semantic groupBy creation.Correctly removes metadata for semantic hashing.
27-33: Upload node creation looks correct.Proper metadata layering and node construction.
api/src/test/scala/ai/chronon/api/test/planner/GroupByUploadPlannerTest.scala (6)
14-33: Excellent validation helper method.Comprehensive checks for plan structure and contents.
35-51: Good integration test with real configs.Tests against actual configuration files.
53-63: Clean unit test with programmatic GroupBy.Good validation of terminal node naming.
65-84: Important semantic hash consistency test.Verifies metadata exclusion from semantic hashing.
86-105: Thorough executionInfo semantic hash test.Confirms execution environment changes don't affect semantics.
108-122: Well-designed test helper method.Clean GroupBy construction for testing.
| override def buildPlan: ConfPlan = { | ||
| val terminalNodeNames = Map( | ||
| ai.chronon.planner.Mode.DEPLOY -> uploadNode.metaData.name | ||
| ) | ||
| val confPlan = new ConfPlan() | ||
| .setNodes(List(uploadNode).asJava) | ||
| .setTerminalNodeNames(terminalNodeNames.asJava) | ||
| confPlan.setNodes(List(uploadNode).asJava) | ||
| confPlan | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate nodes assignment.
Line 42 redundantly sets nodes after line 40.
val confPlan = new ConfPlan()
.setNodes(List(uploadNode).asJava)
.setTerminalNodeNames(terminalNodeNames.asJava)
- confPlan.setNodes(List(uploadNode).asJava)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| override def buildPlan: ConfPlan = { | |
| val terminalNodeNames = Map( | |
| ai.chronon.planner.Mode.DEPLOY -> uploadNode.metaData.name | |
| ) | |
| val confPlan = new ConfPlan() | |
| .setNodes(List(uploadNode).asJava) | |
| .setTerminalNodeNames(terminalNodeNames.asJava) | |
| confPlan.setNodes(List(uploadNode).asJava) | |
| confPlan | |
| } | |
| override def buildPlan: ConfPlan = { | |
| val terminalNodeNames = Map( | |
| ai.chronon.planner.Mode.DEPLOY -> uploadNode.metaData.name | |
| ) | |
| val confPlan = new ConfPlan() | |
| .setNodes(List(uploadNode).asJava) | |
| .setTerminalNodeNames(terminalNodeNames.asJava) | |
| confPlan | |
| } |
🤖 Prompt for AI Agents
In api/src/main/scala/ai/chronon/api/planner/GroupByUploadPlanner.scala between
lines 35 and 44, the method buildPlan sets the nodes on confPlan twice, once at
line 40 and again at line 42. Remove the redundant call at line 42 to avoid
unnecessary duplication and keep only the first setNodes invocation.
| case class GroupByUploadPlanner(groupBy: GroupBy)(implicit outputPartitionSpec: PartitionSpec) | ||
| extends Planner[GroupBy](groupBy)(outputPartitionSpec) { | ||
|
|
||
| private def tableDeps: Seq[TableDependency] = TableDependencies.fromGroupBy(groupBy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of this one is that the GBU would have a dependency on the groupby's output table, whereas this function is generating the dependencies of the groupby job itself (which would be the source tables). So there might need to be new logic here to produce the groupby output table as a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No the GBU doesn't depend on the GroupBy backfill output table. GBU does indeed only depend on the src tables so I think we should be fine here if we're depending on the src tables..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see it ! Thanks for clarifying.
Summary
A stab at adding the GBU Planner based on some existing ones.
Checklist
Summary by CodeRabbit