Skip to content

Conversation

@varant-zlai
Copy link
Collaborator

@varant-zlai varant-zlai commented Jan 28, 2025

Summary

Cherry picking oss 906 to memoize and reuse time range

Checklist

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

Summary by CodeRabbit

  • New Features

    • Introduced a new property for computing the time range of DataFrames.
  • Refactor

    • Updated time range calculation method in DataFrame operations.
    • Renamed and modified internal methods for improved clarity and consistency.
    • Streamlined DataFrame statistics handling in join operations.
  • Technical Improvements

    • Updated method signatures to enhance code readability and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2025

Walkthrough

The pull request introduces modifications to the Spark extensions and join processing, focusing on time range calculations and DataFrame statistics handling. The primary changes involve renaming the timeRange method to calculateTimeRange in the Extensions.scala file and updating how DataFrame statistics are processed in JoinBase.scala. These modifications aim to clarify and streamline the time range computation and DataFrame management logic.

Changes

File Change Summary
spark/src/main/scala/ai/chronon/spark/Extensions.scala - Renamed timeRange method to calculateTimeRange
- Added lazy timeRange val to DfWithStats case class
spark/src/main/scala/ai/chronon/spark/GroupBy.scala - Updated time range retrieval from queriesDf.timeRange to queriesDf.calculateTimeRange
spark/src/main/scala/ai/chronon/spark/JoinBase.scala - Replaced leftDf with statsDf
- Updated filtering and row counting logic

Possibly related PRs

  • Summary upload #50: The changes in this PR involve the SummaryUploader class, which interacts with DataFrames, similar to the DfWithStats case class in the main PR that computes a time range based on a DataFrame.
  • feat: support dataproc federated bigquery catalog #128: This PR modifies the GroupBy class, specifically changing how the time range is accessed from queriesDf.timeRange to queriesDf.calculateTimeRange, which relates to the renaming of the timeRange method in the main PR.
  • chore: separate column predicates from partition filters #149: This PR also modifies the GroupBy class, which is relevant as it deals with DataFrame queries and could be impacted by the changes made in the main PR regarding time range calculations.

Suggested reviewers

  • nikhil-zlai
  • piyush-zlai

Poem

🕰️ Time ranges dance, methods rename,
Scala's grace in each refrain,
DataFrame stats, a gentle flow,
Code evolves, and wisdom grows!
🚀 Refactoring's sweet embrace 🌟

Warning

Review ran into problems

🔥 Problems

GitHub Actions: Resource not accessible by integration - https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository.

Please grant the required permissions to the CodeRabbit GitHub App under the organization or repository settings.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 5cbbdb6 and be3f5e4.

📒 Files selected for processing (1)
  • spark/src/main/scala/ai/chronon/spark/JoinBase.scala (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • spark/src/main/scala/ai/chronon/spark/JoinBase.scala
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: table_utils_delta_format_spark_tests
  • GitHub Check: join_spark_tests
  • GitHub Check: other_spark_tests
  • GitHub Check: mutation_spark_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: fetcher_spark_tests

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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: 0

🧹 Nitpick comments (1)
spark/src/main/scala/ai/chronon/spark/Extensions.scala (1)

Line range hint 111-117: Consider adding ScalaDoc for the calculateTimeRange method.

The renaming improves clarity. Consider adding documentation to explain the timestamp requirements and return value.

+  /**
+   * Calculates the time range of the DataFrame based on its timestamp column.
+   * @return TimeRange containing the start and end timestamps
+   * @throws AssertionError if the timestamp column is not of type Long
+   */
   def calculateTimeRange: TimeRange = {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 01a2f70 and 5cbbdb6.

📒 Files selected for processing (3)
  • spark/src/main/scala/ai/chronon/spark/Extensions.scala (2 hunks)
  • spark/src/main/scala/ai/chronon/spark/GroupBy.scala (1 hunks)
  • spark/src/main/scala/ai/chronon/spark/JoinBase.scala (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: table_utils_delta_format_spark_tests
  • GitHub Check: other_spark_tests
  • GitHub Check: mutation_spark_tests
  • GitHub Check: join_spark_tests
  • GitHub Check: fetcher_spark_tests
  • GitHub Check: scala_compile_fmt_fix
🔇 Additional comments (4)
spark/src/main/scala/ai/chronon/spark/Extensions.scala (1)

74-75: LGTM! Good use of lazy evaluation.

The lazy val ensures the time range is computed only when needed.

spark/src/main/scala/ai/chronon/spark/JoinBase.scala (2)

236-238: LGTM! Better variable naming.

Renaming to statsDf better reflects the variable's purpose and type.


261-264: LGTM! Good logging practice.

Appropriate use of the new timeRange property with helpful debug logging.

spark/src/main/scala/ai/chronon/spark/GroupBy.scala (1)

299-299: LGTM! Consistent method usage.

Correctly updated to use the renamed calculateTimeRange method.

@varant-zlai varant-zlai merged commit 8807a3b into main Jan 28, 2025
10 checks passed
@varant-zlai varant-zlai deleted the vz--cherry-pick-memoized-time-ranges branch January 28, 2025 22:20
nikhil-zlai pushed a commit that referenced this pull request Feb 4, 2025
## Summary

Cherry picking oss 906 to memoize and reuse time range

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new property for computing the time range of DataFrames.

- **Refactor**
	- Updated time range calculation method in DataFrame operations.
- Renamed and modified internal methods for improved clarity and
consistency.
	- Streamlined DataFrame statistics handling in join operations.

- **Technical Improvements**
- Updated method signatures to enhance code readability and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ezvz <[email protected]>
Co-authored-by: Thomas Chow <[email protected]>
@coderabbitai coderabbitai bot mentioned this pull request Feb 6, 2025
4 tasks
kumar-zlai pushed a commit that referenced this pull request Apr 25, 2025
## Summary

Cherry picking oss 906 to memoize and reuse time range

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new property for computing the time range of DataFrames.

- **Refactor**
	- Updated time range calculation method in DataFrame operations.
- Renamed and modified internal methods for improved clarity and
consistency.
	- Streamlined DataFrame statistics handling in join operations.

- **Technical Improvements**
- Updated method signatures to enhance code readability and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ezvz <[email protected]>
Co-authored-by: Thomas Chow <[email protected]>
kumar-zlai pushed a commit that referenced this pull request Apr 29, 2025
## Summary

Cherry picking oss 906 to memoize and reuse time range

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new property for computing the time range of DataFrames.

- **Refactor**
	- Updated time range calculation method in DataFrame operations.
- Renamed and modified internal methods for improved clarity and
consistency.
	- Streamlined DataFrame statistics handling in join operations.

- **Technical Improvements**
- Updated method signatures to enhance code readability and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ezvz <[email protected]>
Co-authored-by: Thomas Chow <[email protected]>
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary

Cherry picking oss 906 to memoize and reuse time range

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new property for computing the time range of DataFrames.

- **Refactor**
	- Updated time range calculation method in DataFrame operations.
- Renamed and modified internal methods for improved clarity and
consistency.
	- Streamlined DataFrame statistics handling in join operations.

- **Technical Improvements**
- Updated method signatures to enhance code readability and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ezvz <[email protected]>
Co-authored-by: Thomas Chow <[email protected]>
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary

Cherry picking oss 906 to memoize and reuse time range

## Checklist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new property for computing the time range of DataFrames.

- **Refactor**
	- Updated time range calculation method in DataFrame operations.
- Renamed and modified internal methods for improved clarity and
consistency.
	- Streamlined DataFrame statistics handling in join operations.

- **Technical Improvements**
- Updated method signatures to enhance code readability and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ezvz <[email protected]>
Co-authored-by: Thomas Chow <[email protected]>
chewy-zlai pushed a commit that referenced this pull request May 16, 2025
## Summary

Cherry piour clientsing oss 906 to memoize and reuse time range

## Cheour clientslist
- [ ] Added Unit Tests
- [ ] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new property for computing the time range of DataFrames.

- **Refactor**
	- Updated time range calculation method in DataFrame operations.
- Renamed and modified internal methods for improved clarity and
consistency.
	- Streamlined DataFrame statistics handling in join operations.

- **Technical Improvements**
- Updated method signatures to enhance code readability and
maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: ezvz <[email protected]>
Co-authored-by: Thomas Chow <[email protected]>
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