Skip to content

Conversation

@tchow-zlai
Copy link
Collaborator

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

Summary

  • Build out support for StagingQuery in BatchNodeRunner
  • skipFirstHole is no longer used.
  • followup is to get rid of unfilledRanges

Checklist

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

Summary by CodeRabbit

  • New Features

    • Added support for a new node content type, allowing staging queries to be run as part of batch processing.
  • Improvements

    • Enhanced logging for better visibility during batch runs.
    • Improved process exit handling to ensure clear success or failure status after completion.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

The BatchNodeRunner was updated to support the STAGING_QUERY node type. This includes adding a runStagingQuery method, enhanced logging, updated dispatch in run, and extending loadNodeContent to extract metadata from stagingQuery configurations.

Changes

File(s) Change Summary
spark/.../BatchNodeRunner.scala Added STAGING_QUERY node type support: new runStagingQuery method, updated run dispatch, and enhanced loadNodeContent to handle staging query metadata.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BatchNodeRunner
    participant StagingQuery

    User->>BatchNodeRunner: main(args)
    BatchNodeRunner->>BatchNodeRunner: loadNodeContent(confPath)
    BatchNodeRunner->>BatchNodeRunner: run(metadata, content, range, tableUtils)
    alt content is STAGING_QUERY
        BatchNodeRunner->>BatchNodeRunner: runStagingQuery(metaData, stagingQuery, range, tableUtils)
        BatchNodeRunner->>StagingQuery: computeStagingQuery(params)
    else content is MONOLITH_JOIN
        BatchNodeRunner->>BatchNodeRunner: runMonolithJoin(...)
    end
    BatchNodeRunner->>User: System.exit(0/1)
Loading

Possibly related issues

  • zipline-ai/platform#109: Implements STAGING_QUERY node type handling in BatchNodeRunner, matching this PR’s main feature.

Possibly related PRs

Suggested reviewers

  • nikhil-zlai
  • varant-zlai
  • david-zlai
  • piyush-zlai
  • chewy-zlai

Poem

A node runner now learns a new trick,
With staging queries handled quick.
Logging each step, it won’t miss a beat,
Exits on cue, its task is complete.
From monoliths to staging, the journey’s begun—
BatchNodeRunner’s work is never done!
🚀


📜 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 ada8156 and 9317474.

📒 Files selected for processing (1)
  • spark/src/main/scala/ai/chronon/spark/batch/BatchNodeRunner.scala (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • spark/src/main/scala/ai/chronon/spark/batch/BatchNodeRunner.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). (9)
  • GitHub Check: batch_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: spark_tests
  • GitHub Check: streaming_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: join_tests
  • GitHub Check: groupby_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: enforce_triggered_workflows

🪧 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 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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f69c21 and ada8156.

📒 Files selected for processing (1)
  • spark/src/main/scala/ai/chronon/spark/batch/BatchNodeRunner.scala (3 hunks)
⏰ 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). (9)
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: analyzer_tests
  • GitHub Check: streaming_tests
  • GitHub Check: join_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: groupby_tests
  • GitHub Check: spark_tests
  • GitHub Check: batch_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (6)
spark/src/main/scala/ai/chronon/spark/batch/BatchNodeRunner.scala (6)

5-5: LGTM: Import addition looks correct.

The StagingQueryNode import is properly added to support the new functionality.


42-42: LGTM: Helpful logging addition.

The logging message provides good visibility into the batch runner execution.


45-45: LGTM: Consistent logging pattern.

The logging message follows the same pattern as the new staging query logging.


49-50: LGTM: Proper case handling for new node type.

The new STAGING_QUERY case is correctly implemented and follows the existing pattern.


122-122: LGTM: Consistent metadata extraction pattern.

The STAGING_QUERY case follows the same pattern as MONOLITH_JOIN for metadata extraction.


145-145: LGTM: Proper JVM exit status.

The explicit System.exit(0) ensures proper exit code for successful completion.

Comment on lines +56 to +79
private def runStagingQuery(metaData: MetaData,
stagingQuery: StagingQueryNode,
range: PartitionRange,
tableUtils: TableUtils): Unit = {
require(stagingQuery.isSetStagingQuery, "StagingQueryNode must have a stagingQuery set")
logger.info(s"Running staging query for '${metaData.name}'")
val stagingQueryConf = stagingQuery.stagingQuery
val sq = new StagingQuery(stagingQueryConf, range.end, tableUtils)
sq.computeStagingQuery(
stepDays = Option(metaData.executionInfo.stepDays),
enableAutoExpand = Some(true),
overrideStartPartition = Option(range.start),
forceOverwrite = true
)

logger.info(s"Successfully completed staging query for '${metaData.name}'")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify StagingQuery class import and consider parameterizing hardcoded values.

The method implementation looks correct but has potential issues:

  1. StagingQuery class is used but not imported
  2. Hardcoded values like enableAutoExpand = Some(true) and forceOverwrite = true reduce flexibility

Consider making the hardcoded parameters configurable through the staging query configuration.


🏁 Script executed:

#!/bin/bash
# Check if StagingQuery class is imported or available
rg -A 5 "import.*StagingQuery" 
rg -A 5 "class StagingQuery"

Length of output: 12056


Add missing import & parameterize staging query flags

  • In spark/src/main/scala/ai/chronon/spark/batch/BatchNodeRunner.scala, add:
    + import ai.chronon.spark.batch.StagingQuery
  • Replace hardcoded flags in sq.computeStagingQuery with values driven by your staging‐query config (e.g. expose autoExpand: Option[Boolean] and forceOverwrite: Option[Boolean] on StagingQueryNode or in metaData.executionInfo).

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In spark/src/main/scala/ai/chronon/spark/batch/BatchNodeRunner.scala around
lines 56 to 72, add the missing import for the staging query flags or
configuration classes used in computeStagingQuery. Replace the hardcoded values
for enableAutoExpand and forceOverwrite in the sq.computeStagingQuery call by
reading these flags from the staging query configuration, such as adding
optional parameters like autoExpand and forceOverwrite to StagingQueryNode or
metaData.executionInfo, and pass those values instead of the fixed Some(true)
and true literals.

@tchow-zlai tchow-zlai force-pushed the tchow/batch-node-runner-working branch from ada8156 to 711e137 Compare July 14, 2025 22:04
@tchow-zlai tchow-zlai merged commit 0d7a223 into main Jul 14, 2025
17 of 19 checks passed
@tchow-zlai tchow-zlai deleted the tchow/batch-node-runner-working branch July 14, 2025 23:03
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.

3 participants