-
Notifications
You must be signed in to change notification settings - Fork 8
feat: support dataproc federated bigquery catalog #128
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 in this pull request involve modifications to four main files: Changes
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
4b58ac3 to
5760be9
Compare
68ae7f0 to
766f7e5
Compare
chewy-zlai
left a comment
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.
A couple of small nits
f74a8bd to
450524b
Compare
450524b to
ad8617b
Compare
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: 0
🧹 Nitpick comments (1)
spark/src/test/scala/ai/chronon/spark/test/JoinTest.scala (1)
72-109: Enhance test robustness and cleanup.While the test case correctly verifies the dynamic partition overwrite functionality, consider the following improvements:
- Add cleanup of test data to prevent test pollution
- Replace generic assertions with more descriptive ones
- Remove or guard debug show() statements with a flag
Consider applying these changes:
test("testing basic spark dynamic partition overwrite") { import org.apache.spark.sql.SaveMode import spark.implicits._ + // Clean up test table if exists + spark.sql(f"DROP TABLE IF EXISTS ${namespace}.table") val rows = List( TestRow("1", "a"), TestRow("2", "b"), TestRow("3", "c"), TestRow("4", "d"), TestRow("5", "e") ) val data = spark.createDataFrame(rows) toDF ("ds", "value") data.write.mode(SaveMode.Overwrite).format("hive").partitionBy("ds").saveAsTable(f"${namespace}.table") - assertEquals(spark.table(f"${namespace}.table").as[TestRow].collect().toList.sorted, rows.sorted) + assertResult(rows.sorted, "Initial data write failed")( + spark.table(f"${namespace}.table").as[TestRow].collect().toList.sorted + ) - spark.table(f"${namespace}.table").show(truncate = false) + if (debugEnabled) { + spark.table(f"${namespace}.table").show(truncate = false) + } val dynamicPartitions = List( TestRow("4", "y"), TestRow("5", "z") ) val dynamicPartitionsDF = spark.createDataset(dynamicPartitions).select("value", "ds") dynamicPartitionsDF.write .format("hive") .mode(SaveMode.Overwrite) .insertInto(f"${namespace}.table") - spark.table(f"${namespace}.table").show(truncate = false) + if (debugEnabled) { + spark.table(f"${namespace}.table").show(truncate = false) + } val updatedExpected = (rows.map((r) => r.ds -> r.value).toMap ++ dynamicPartitions.map((r) => r.ds -> r.value).toMap).map { case (k, v) => TestRow(k, v) }.toList - assertEquals(updatedExpected.sorted, spark.table(f"${namespace}.table").as[TestRow].collect().toList.sorted) + assertResult(updatedExpected.sorted, "Dynamic partition overwrite failed")( + spark.table(f"${namespace}.table").as[TestRow].collect().toList.sorted + ) + // Clean up test data + spark.sql(f"DROP TABLE IF EXISTS ${namespace}.table") }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)
📒 Files selected for processing (1)
spark/src/test/scala/ai/chronon/spark/test/JoinTest.scala(2 hunks)
🔇 Additional comments (1)
spark/src/test/scala/ai/chronon/spark/test/JoinTest.scala (1)
46-55: LGTM! Well-structured case class and companion object.
The implementation is clean and follows Scala best practices. The implicit ordering is correctly implemented for sorting TestRow instances based on the ds field.
|
ptal @chewy-zlai | @piyush-zlai |
## Summary - https://app.asana.com/0/1208949807589885/1208951092959581 - this PR is the followup to enabling the `spark-bigquery-connector`. It introduces the minimal fallback where a dataproc cluster is configured with a federated endpoint, as described in https://docs.google.com/document/d/1bxNUeaVrWDRL07fyLWiBDwO6pLS9BUbPbMLSnbRDRCk/edit?tab=t.0#heading=h.917ddfitv46i . From this perspective, a bigquery catalog looks like a hive metastore. We can access it through typical catalog api's, and dataproc will proxy at the API service layer. Minimal code change! - We do need a slight change to workaround a bug in the latest version of the connector though. ## 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 an online execution context for specific join operations. - Added a new test case for dynamic partitioning in Spark. - **Bug Fixes** - Adjusted Spark session configuration for partition overwrite mode to ensure future compatibility. - **Chores** - Removed unnecessary JAR file dependency from Spark job submission, simplifying the process. - Updated JAR URI configuration to a new storage location. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- av pr metadata This information is embedded by the av CLI when creating PRs to track the status of stacks when using Aviator. Please do not delete or edit this section of the PR. ``` {"parent":"main","parentHead":"","trunk":"main"} ``` -->
## Summary - https://app.asana.com/0/1208949807589885/1208951092959581 - this PR is the followup to enabling the `spark-bigquery-connector`. It introduces the minimal fallback where a dataproc cluster is configured with a federated endpoint, as described in https://docs.google.com/document/d/1bxNUeaVrWDRL07fyLWiBDwO6pLS9BUbPbMLSnbRDRCk/edit?tab=t.0#heading=h.917ddfitv46i . From this perspective, a bigquery catalog looks like a hive metastore. We can access it through typical catalog api's, and dataproc will proxy at the API service layer. Minimal code change! - We do need a slight change to workaround a bug in the latest version of the connector though. ## 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 an online execution context for specific join operations. - Added a new test case for dynamic partitioning in Spark. - **Bug Fixes** - Adjusted Spark session configuration for partition overwrite mode to ensure future compatibility. - **Chores** - Removed unnecessary JAR file dependency from Spark job submission, simplifying the process. - Updated JAR URI configuration to a new storage location. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- av pr metadata This information is embedded by the av CLI when creating PRs to track the status of stacks when using Aviator. Please do not delete or edit this section of the PR. ``` {"parent":"main","parentHead":"","trunk":"main"} ``` -->
## Summary - https://app.asana.com/0/1208949807589885/1208951092959581 - this PR is the followup to enabling the `spark-bigquery-connector`. It introduces the minimal fallback where a dataproc cluster is configured with a federated endpoint, as described in https://docs.google.com/document/d/1bxNUeaVrWDRL07fyLWiBDwO6pLS9BUbPbMLSnbRDRCk/edit?tab=t.0#heading=h.917ddfitv46i . From this perspective, a bigquery catalog looks like a hive metastore. We can access it through typical catalog api's, and dataproc will proxy at the API service layer. Minimal code change! - We do need a slight change to workaround a bug in the latest version of the connector though. ## 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 an online execution context for specific join operations. - Added a new test case for dynamic partitioning in Spark. - **Bug Fixes** - Adjusted Spark session configuration for partition overwrite mode to ensure future compatibility. - **Chores** - Removed unnecessary JAR file dependency from Spark job submission, simplifying the process. - Updated JAR URI configuration to a new storage location. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- av pr metadata This information is embedded by the av CLI when creating PRs to track the status of stacks when using Aviator. Please do not delete or edit this section of the PR. ``` {"parent":"main","parentHead":"","trunk":"main"} ``` -->
## Summary - https://app.asana.com/0/1208949807589885/1208951092959581 - this PR is the followup to enabling the `spark-bigquery-connector`. It introduces the minimal fallbaour clients where a dataproc cluster is configured with a federated endpoint, as described in https://docs.google.com/document/d/1bxNUeaVrWDRL07fyLWiBDwO6pLS9BUbPbMLSnbRDRCk/edit?tab=t.0#heading=h.917ddfitv46i . From this perspective, a bigquery catalog looks like a hive metastore. We can access it through typical catalog api's, and dataproc will proxy at the API service layer. Minimal code change! - We do need a slight change to workaround a bug in the latest version of the connector though. ## 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 an online execution context for specific join operations. - Added a new test case for dynamic partitioning in Spark. - **Bug Fixes** - Adjusted Spark session configuration for partition overwrite mode to ensure future compatibility. - **Chores** - Removed unnecessary JAR file dependency from Spark job submission, simplifying the process. - Updated JAR URI configuration to a new storage location. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- av pr metadata This information is embedded by the av CLI when creating PRs to traour clients the status of staour clientss when using Aviator. Please do not delete or edit this section of the PR. ``` {"parent":"main","parentHead":"","trunk":"main"} ``` -->
Summary
spark-bigquery-connector. It introduces the minimal fallback where a dataproc cluster is configured with a federated endpoint, as described in https://docs.google.com/document/d/1bxNUeaVrWDRL07fyLWiBDwO6pLS9BUbPbMLSnbRDRCk/edit?tab=t.0#heading=h.917ddfitv46i . From this perspective, a bigquery catalog looks like a hive metastore. We can access it through typical catalog api's, and dataproc will proxy at the API service layer. Minimal code change!Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Chores