Skip to content

feat: tiling support api changes part 1 #288

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

Closed
wants to merge 1 commit into from

Conversation

tchow-zlai
Copy link
Collaborator

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

Summary

Checklist

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

Summary by CodeRabbit

  • Tests
    • Enhanced logging in the Flink job execution for better traceability.
    • Updated formatting in the BigTableKVStoreTest class for consistency.
  • Chores
    • Consolidated import statements in the Api.scala file for improved readability.
    • Reorganized import statements in the DynamoDBKVStoreImpl and BigTableKVStoreImpl files.
  • Refactor
    • Streamlined handling of streaming data in the FetcherBase class, enhancing the flexibility of the fetching mechanism.
    • Removed and reintroduced the mapDatasetToTable method for better structure in the BigTableKVStore.

Copy link
Contributor

coderabbitai bot commented Jan 28, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request modifies multiple files to enhance code clarity and functionality. Changes include improvements in import statements for better readability, updates to the DataprocSubmitterTest for Flink job submissions, and significant modifications in the FetcherBase class to streamline the handling of streaming responses. Additionally, new methods are introduced in the BigTableKVStore object to enhance data handling capabilities.

Changes

File Change Summary
cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala Updated submit method call for Flink job; improved readability.
online/src/main/scala/ai/chronon/online/Api.scala Consolidated import statements for better clarity; updated comment for timestamp variable.
online/src/main/scala/ai/chronon/online/FetcherBase.scala Updated handling of streaming responses; changed optional parameters to sequences for improved logic.
cloud_aws/src/main/scala/ai/chronon/integrations/aws/DynamoDBKVStoreImpl.scala Consolidated import statements; no functional changes.
cloud_gcp/src/main/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreImpl.scala Reorganized imports; removed mapDatasetToTable method; added new methods for tiled data handling.
cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreTest.scala Minor formatting change in class declaration; no functional changes.
flink/src/main/scala/ai/chronon/flink/FlinkJob.scala Added logging statement in runGroupByJob method; no functional changes.

Possibly related PRs

Suggested reviewers

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

Poem

🚀 Dataproc's dance, a Flink job's flight
A test case waits, just out of sight
Imports now neat, responses in line,
Fetching with ease, the code's looking fine!
Streamlined and clear, let the data flow,
In the world of code, watch the progress grow! 🌟


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

@tchow-zlai tchow-zlai changed the base branch from tchow/teams-conf to main January 28, 2025 18:40
@tchow-zlai tchow-zlai force-pushed the tchow/more-migration branch from 87f9800 to f46bcbb Compare January 28, 2025 18:40
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

🔭 Outside diff range comments (1)
cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala (1)

Line range hint 56-64: Add assertions to validate job submission.

The test lacks verification steps.

     val submitter = DataprocSubmitter()
-    submitter.submit(spark.FlinkJob,
+    val jobId = submitter.submit(spark.FlinkJob,
       Map(MainClass -> "ai.chronon.flink.FlinkJob",
         FlinkMainJarURI -> "gs://zipline-jars/flink-assembly-0.1.0-SNAPSHOT.jar",
         JarURI -> "gs://zipline-jars/cloud_gcp_bigtable.jar"),
       List.empty,
       "--online-class=ai.chronon.integrations.cloud_gcp.GcpApiImpl",
       "--groupby-name=e2e-count",
       "-ZGCP_PROJECT_ID=bigtable-project-id",
-      "-ZGCP_INSTANCE_ID=bigtable-instance-id")
+      "-ZGCP_INSTANCE_ID=bigtable-instance-id")
+    assertNotNull("Job ID should not be null", jobId)
🧹 Nitpick comments (2)
cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala (2)

56-56: Remove the "DUMMY COMMIT" comment.

This comment doesn't provide any value.

-    // DUMMY COMMIT

Line range hint 56-64: Document the test's purpose.

Add a descriptive comment explaining what this test verifies.

+    // Verifies Flink job submission with BigTable configuration
     val submitter = DataprocSubmitter()
📜 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 0cdb2be and f46bcbb.

📒 Files selected for processing (1)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: scala_compile_fmt_fix

@tchow-zlai tchow-zlai force-pushed the tchow/more-migration branch 2 times, most recently from f46bcbb to 7bc42b4 Compare January 30, 2025 22:48
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)
online/src/main/scala/ai/chronon/online/FetcherBase.scala (1)

365-380: Consider parameterizing tile configuration

The tile key configuration uses hardcoded values (-1) for tileSizeMillis and tileStartTimestampMillis.

Consider making these configurable:

-                  new TileKey()
-                    .setKeyBytes(streamingKeyBytes.toList.map((b) => java.lang.Byte.valueOf(b)).asJava)
-                    .setDataset(groupByServingInfo.groupByOps.streamingDataset)
-                    .setTileSizeMillis(-1)
-                    .setTileStartTimestampMillis(-1))
+                  new TileKey()
+                    .setKeyBytes(streamingKeyBytes.toList.map((b) => java.lang.Byte.valueOf(b)).asJava)
+                    .setDataset(groupByServingInfo.groupByOps.streamingDataset)
+                    .setTileSizeMillis(groupByServingInfo.tileConfig.tileSizeMillis)
+                    .setTileStartTimestampMillis(groupByServingInfo.tileConfig.startTimestampMillis))
📜 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 f46bcbb and cfe39e9.

📒 Files selected for processing (3)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala (1 hunks)
  • online/src/main/scala/ai/chronon/online/Api.scala (1 hunks)
  • online/src/main/scala/ai/chronon/online/FetcherBase.scala (8 hunks)
✅ Files skipped from review due to trivial changes (1)
  • online/src/main/scala/ai/chronon/online/Api.scala
🚧 Files skipped from review as they are similar to previous changes (1)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: no_spark_scala_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (5)
online/src/main/scala/ai/chronon/online/FetcherBase.scala (5)

52-52: LGTM: Import addition

Clean import of TileKey for tile-based streaming.


74-74: LGTM: Method signature update

Changed from Option[Seq[TimedValue]] to Seq[TimedValue] for simpler handling.


103-103: LGTM: Simplified null check

Direct empty check on sequence instead of option handling.


452-453: LGTM: Streamlined streaming response handling

Simplified streaming response handling by flattening the responses.

Also applies to: 462-462


724-724: LGTM: Case class field update

Updated GroupByRequestMeta to use Seq[GetRequest] for streaming requests.

@tchow-zlai tchow-zlai changed the title dummy commit feat: tiling support api changes part 1 Jan 30, 2025
@tchow-zlai tchow-zlai force-pushed the tchow/more-migration branch from cfe39e9 to 944f2a6 Compare January 31, 2025 23:52
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

🧹 Nitpick comments (1)
cloud_gcp/src/main/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreImpl.scala (1)

251-251: Use Some(ts) instead of Option(ts)

Option(ts) can handle null values, but since ts is a primitive Long, Some(ts) is more idiomatic.

-            buildRowKey(request.keyBytes, request.dataset, Option(ts))
+            buildRowKey(request.keyBytes, request.dataset, Some(ts))
📜 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 cfe39e9 and 944f2a6.

📒 Files selected for processing (7)
  • cloud_aws/src/main/scala/ai/chronon/integrations/aws/DynamoDBKVStoreImpl.scala (1 hunks)
  • cloud_gcp/src/main/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreImpl.scala (5 hunks)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreTest.scala (1 hunks)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala (1 hunks)
  • flink/src/main/scala/ai/chronon/flink/FlinkJob.scala (1 hunks)
  • online/src/main/scala/ai/chronon/online/Api.scala (1 hunks)
  • online/src/main/scala/ai/chronon/online/FetcherBase.scala (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreTest.scala
  • cloud_aws/src/main/scala/ai/chronon/integrations/aws/DynamoDBKVStoreImpl.scala
🚧 Files skipped from review as they are similar to previous changes (2)
  • cloud_gcp/src/test/scala/ai/chronon/integrations/cloud_gcp/DataprocSubmitterTest.scala
  • online/src/main/scala/ai/chronon/online/Api.scala
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: no_spark_scala_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (7)
flink/src/main/scala/ai/chronon/flink/FlinkJob.scala (1)

98-101: LGTM! Good logging practice.

The logging statement provides clear runtime information about the job configuration.

online/src/main/scala/ai/chronon/online/FetcherBase.scala (3)

21-21: Neat aggregator import usage.
No issues observed.


23-29: Consolidated imports look good.
They align well with streaming logic.


35-36: Concurrency imports are correct.
Use of Futures and Try is appropriate.

cloud_gcp/src/main/scala/ai/chronon/integrations/cloud_gcp/BigTableKVStoreImpl.scala (3)

3-7: LGTM: Import organization

Imports are now better organized, grouping related imports together.


381-397: Add validation for tileSizeMs

buildTiledRowKey should validate that tileSizeMs is positive and a multiple of a reasonable time unit.


450-454: ⚠️ Potential issue

Incomplete implementation

computeTiles returns a dummy tile instead of actual computation.

Comment on lines +412 to +414
def tileQueryColumnBased(query: Query, startTs: Long, endTs: Long) = {}

def tileQueryCellBased(query: Query, startTs: Long, endTs: Long) = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Empty method implementations

tileQueryColumnBased and tileQueryCellBased are empty. Either implement them or mark as TODO.

@tchow-zlai tchow-zlai marked this pull request as draft February 3, 2025 19:18
Co-authored-by: Thomas Chow <[email protected]>

Co-authored-by: Thomas Chow <[email protected]>
@tchow-zlai tchow-zlai force-pushed the tchow/more-migration branch from 944f2a6 to 73df588 Compare February 9, 2025 01:08
@tchow-zlai tchow-zlai closed this Feb 14, 2025
@tchow-zlai tchow-zlai deleted the tchow/more-migration branch February 14, 2025 19:40
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.

1 participant