Skip to content

refactor: fetcher sub package + kill old stats in fetcher #423

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

Merged
merged 3 commits into from
Feb 22, 2025

Conversation

nikhil-zlai
Copy link
Contributor

@nikhil-zlai nikhil-zlai commented Feb 22, 2025

Summary

Wanted to make a few changes to fetcher, but want to refactor first.

There is no new logic here - just refactors and removes old metrics logic

Checklist

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

Summary by CodeRabbit

  • Refactor
    • Reorganized modules and updated public API signatures for improved clarity and maintainability.
  • Chores
    • Removed legacy statistical data processing functionality to streamline features.
  • Tests
    • Updated tests to align with the refactored structure and API changes, including modifications to import statements.
  • New Features
    • Enhanced organization of import statements for better clarity and maintainability.

Copy link
Contributor

coderabbitai bot commented Feb 22, 2025

Walkthrough

This pull request refactors various Java and Scala files by updating import statements and type signatures to use fully qualified names from the ai.chronon.online.fetcher package. Several statistics-related methods and classes have been removed from both Java and Scala code, and the package structure has been reorganized across production and test files.

Changes

File(s) Change Summary
.../JavaExternalSourceHandler.java, .../JavaRequest.java, .../JavaResponse.java Added import for Fetcher; no functional changes.
.../JavaFetcher.java Updated method signatures and removed stats-related methods.
.../JavaSeriesStatsResponse.java, .../JavaStatsRequest.java, .../JavaStatsResponse.java Removed entire classes handling Java-based statistics requests and responses.
.../Api.scala, .../ExternalSourceRegistry.scala, .../OnlineDerivationUtil.scala, .../FetcherMain.scala Reorganized import paths and package declarations to reference the updated ai.chronon.online.fetcher package.
.../fetcher/Fetcher.scala, .../fetcher/FetcherBase.scala, .../fetcher/FetcherCache.scala Removed stats-related case classes/methods and updated method signatures to align with the new package structure.
Test files under .../test/ and Spark files in spark/ Modified test imports and type references; removed consistency metrics tests; updated Spark driver and utility imports to reflect the new package structure.

Suggested reviewers

  • david-zlai
  • piyush-zlai

Poem

In refactored code we weave our art,
With qualified types and a refined start.
Old stats are gone, neat paths now remain,
Imports realigned like a well-tuned refrain.
CodeRabbit cheers as our changes take flight!
🚀🛠 Happy coding!

Warning

Review ran into problems

🔥 Problems

GitHub Actions and Pipeline Checks: 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 66877a1 and 3a3da28.

📒 Files selected for processing (1)
  • spark/src/main/scala/ai/chronon/spark/ChrononKryoRegistrator.scala (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • spark/src/main/scala/ai/chronon/spark/ChrononKryoRegistrator.scala
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: non_spark_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: streaming_tests
  • GitHub Check: spark_tests
  • GitHub Check: join_tests
  • GitHub Check: streaming_tests
  • GitHub Check: groupby_tests
  • GitHub Check: join_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: groupby_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: spark_tests
  • GitHub Check: analyzer_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.
    • 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 (2)
online/src/main/scala/ai/chronon/online/fetcher/Fetcher.scala (2)

27-27: Wildcard import
Might import unused things.


188-188: Metric distribution
Check if errors need tracking here.

📜 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 e231fd3 and f2196ae.

📒 Files selected for processing (28)
  • online/src/main/java/ai/chronon/online/JavaExternalSourceHandler.java (2 hunks)
  • online/src/main/java/ai/chronon/online/JavaFetcher.java (5 hunks)
  • online/src/main/java/ai/chronon/online/JavaRequest.java (3 hunks)
  • online/src/main/java/ai/chronon/online/JavaResponse.java (3 hunks)
  • online/src/main/java/ai/chronon/online/JavaSeriesStatsResponse.java (0 hunks)
  • online/src/main/java/ai/chronon/online/JavaStatsRequest.java (0 hunks)
  • online/src/main/java/ai/chronon/online/JavaStatsResponse.java (0 hunks)
  • online/src/main/scala/ai/chronon/online/Api.scala (2 hunks)
  • online/src/main/scala/ai/chronon/online/ExternalSourceRegistry.scala (1 hunks)
  • online/src/main/scala/ai/chronon/online/OnlineDerivationUtil.scala (2 hunks)
  • online/src/main/scala/ai/chronon/online/fetcher/Fetcher.scala (3 hunks)
  • online/src/main/scala/ai/chronon/online/fetcher/FetcherBase.scala (2 hunks)
  • online/src/main/scala/ai/chronon/online/fetcher/FetcherCache.scala (2 hunks)
  • online/src/main/scala/ai/chronon/online/fetcher/FetcherMain.scala (2 hunks)
  • online/src/test/scala/ai/chronon/online/test/FetcherBaseTest.scala (9 hunks)
  • online/src/test/scala/ai/chronon/online/test/FetcherCacheTest.scala (2 hunks)
  • spark/src/main/scala/ai/chronon/spark/Driver.scala (1 hunks)
  • spark/src/main/scala/ai/chronon/spark/streaming/JoinSourceRunner.scala (4 hunks)
  • spark/src/main/scala/ai/chronon/spark/utils/MockApi.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/ExternalSourcesTest.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/SchemaEvolutionTest.scala (2 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/analyzer/DerivationTest.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/bootstrap/LogBootstrapTest.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/ChainingFetcherTest.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/FetcherTest.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/FetcherTestUtil.scala (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/JavaFetcherTest.java (1 hunks)
  • spark/src/test/scala/ai/chronon/spark/test/groupby/GroupByUploadTest.scala (1 hunks)
💤 Files with no reviewable changes (3)
  • online/src/main/java/ai/chronon/online/JavaStatsRequest.java
  • online/src/main/java/ai/chronon/online/JavaSeriesStatsResponse.java
  • online/src/main/java/ai/chronon/online/JavaStatsResponse.java
✅ Files skipped from review due to trivial changes (14)
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/FetcherTestUtil.scala
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/ChainingFetcherTest.scala
  • spark/src/main/scala/ai/chronon/spark/Driver.scala
  • spark/src/test/scala/ai/chronon/spark/test/fetcher/JavaFetcherTest.java
  • online/src/main/scala/ai/chronon/online/fetcher/FetcherMain.scala
  • spark/src/test/scala/ai/chronon/spark/test/analyzer/DerivationTest.scala
  • spark/src/test/scala/ai/chronon/spark/test/groupby/GroupByUploadTest.scala
  • online/src/main/scala/ai/chronon/online/Api.scala
  • online/src/main/scala/ai/chronon/online/ExternalSourceRegistry.scala
  • spark/src/test/scala/ai/chronon/spark/test/ExternalSourcesTest.scala
  • spark/src/test/scala/ai/chronon/spark/test/bootstrap/LogBootstrapTest.scala
  • spark/src/main/scala/ai/chronon/spark/utils/MockApi.scala
  • online/src/test/scala/ai/chronon/online/test/FetcherBaseTest.scala
  • online/src/test/scala/ai/chronon/online/test/FetcherCacheTest.scala
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: streaming_tests
  • GitHub Check: spark_tests
  • GitHub Check: streaming_tests
  • GitHub Check: spark_tests
  • GitHub Check: join_tests
  • GitHub Check: join_tests
  • GitHub Check: groupby_tests
  • GitHub Check: groupby_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: fetcher_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: non_spark_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (26)
online/src/main/scala/ai/chronon/online/fetcher/FetcherCache.scala (2)

1-14: LGTM! Package restructuring looks good.

Package and import changes align with the refactoring objectives.


113-114: LGTM! Type signature update looks good.

Using fully qualified type name Fetcher.Request improves clarity.

online/src/main/scala/ai/chronon/online/fetcher/FetcherBase.scala (2)

17-17: LGTM! Clean package organization.

Package and import changes improve code organization and readability.

Also applies to: 21-22, 24-27


306-308: LGTM! Clear type signatures.

Method signatures now use fully qualified names, improving clarity.

spark/src/main/scala/ai/chronon/spark/streaming/JoinSourceRunner.scala (4)

20-26: LGTM! Clean import organization.

The imports are now better organized and aligned with the new package structure.


358-358: LGTM! Proper request construction.

The request construction now uses the fully qualified Fetcher.Request type.


316-316: LGTM! More efficient column deduplication.

Using distinct directly is more efficient than Set conversion.


384-384: LGTM! Idiomatic array size access.

Using length is more idiomatic for arrays in Scala.

online/src/main/java/ai/chronon/online/JavaResponse.java (1)

20-20: LGTM! Clean refactoring of type signatures.

Type signatures are now using fully qualified names, improving clarity and avoiding potential naming conflicts.

Also applies to: 34-34, 46-46

online/src/main/java/ai/chronon/online/JavaRequest.java (1)

19-19: LGTM! Consistent type signature updates.

Type signatures now use fully qualified names, maintaining consistency with the refactoring.

Also applies to: 40-40, 49-49, 53-53

online/src/main/java/ai/chronon/online/JavaExternalSourceHandler.java (1)

19-19: LGTM! Type signatures updated correctly.

Method signatures and CompletableFuture types now use fully qualified names, aligning with the refactoring.

Also applies to: 40-40, 48-48

online/src/main/scala/ai/chronon/online/OnlineDerivationUtil.scala (1)

10-10: LGTM! Clean import and type updates.

Import and parameter type now use the new fetcher package structure.

Also applies to: 67-67

spark/src/test/scala/ai/chronon/spark/test/SchemaEvolutionTest.scala (2)

23-26: LGTM! Clean import refactoring.

The imports are now more explicit and better organized.


236-236: LGTM! Type-safe return type.

The return type now uses the fully qualified name, improving type safety.

online/src/main/scala/ai/chronon/online/fetcher/Fetcher.scala (5)

17-17: Package path name
No issues.


22-22: Used extension imports
Looks fine.


24-24: Nested import
Ok.


28-28: ResponseWithContext import
Ok.


38-40: New concurrency imports
Seems correct.

online/src/main/java/ai/chronon/online/JavaFetcher.java (6)

19-22: Imports for new fetcher package
No concerns.


38-38: Fetcher field
Fully qualified type. Good.


41-41: Constructor
Points to new fetcher path.


45-45: Second constructor
No concerns.


49-49: Third constructor
No concerns.


61-61: Builder
Usage looks correct.

spark/src/test/scala/ai/chronon/spark/test/fetcher/FetcherTest.scala (1)

26-26: Renamed import
Looks correct.

@nikhil-zlai nikhil-zlai merged commit 45bae2f into main Feb 22, 2025
19 checks passed
@nikhil-zlai nikhil-zlai deleted the fetcher_avro branch February 22, 2025 17:35
@coderabbitai coderabbitai bot mentioned this pull request Mar 6, 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.

2 participants