Skip to content
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

Unified Catalog #143

Merged
merged 4 commits into from
Dec 14, 2022
Merged

Unified Catalog #143

merged 4 commits into from
Dec 14, 2022

Conversation

osopardo1
Copy link
Member

@osopardo1 osopardo1 commented Dec 12, 2022

Description

In this PR, we are modifying the QbeastCatalog to process also writes in Delta (or other formats such Iceberg or Hudi once they're integrated).

Type of change

It is an improvement of an existing Catalog feature. Instead of managing two catalogs at the same time, the user would only need to set up one by adding the following configuration to any Spark Application:

--conf spark.sql.catalog.spark_catalog=io.qbeast.spark.internal.sources.catalog.QbeastCatalog

Then, the user can create qbeast tables and delta tables with either DataFrame API or SQL:

data.write.format("delta").saveAsTable("delta_table")

data.write
 .format("qbeast")
 .option("columnsToIndex", "id")
 .saveAsTable("qbeast_table")
spark.sql(
  s"CREATE TABLE student (id INT, name STRING, age INT) USING qbeast " +
    "OPTIONS ('columnsToIndex'='id')")

spark.sql(
  s"CREATE TABLE student (id INT, name STRING, age INT) USING delta")

The user can also choose to configure them as separate catalogs. But for some integrations (such as dbt) it's not recommended.

Checklist:

Here is the list of things you should do before submitting this pull request:

  • New feature / bug fix has been committed following the Contribution guide.
  • Add comments to the code (make it easier for the community!).
  • Change the documentation.
  • Add tests.
  • Your branch is updated to the main branch (dependent changes have been merged).

How Has This Been Tested? (Optional)

Please describe the tests that you ran to verify your changes.

We add a test in QbeastCatalogIntegrationTest in which we try to write as delta and qbeast with the same Catalog.

@osopardo1
Copy link
Member Author

osopardo1 commented Dec 12, 2022

Hello! I would suggest @Adricu8 and @eavilaes try the solution in your DBT project.
You can do an sbt assembly on the code and test it. This assembly would contain both qbeast-spark and qbeast-core packages. I will also put you as reviewers to verify everything works.

UPDATE: You can also retrieve the package of the new qbeast-spark SNAPSHOT from https://s01.oss.sonatype.org/content/repositories/snapshots/io/qbeast/qbeast-spark_2.12/0.3.0-alpha-SNAPSHOT/qbeast-spark_2.12-0.3.0-alpha-SNAPSHOT.jar
And qbeast-core https://s01.oss.sonatype.org/content/repositories/snapshots/io/qbeast/qbeast-spark_2.12/0.3.0-alpha-SNAPSHOT/qbeast-core_2.12-0.3.0-alpha-SNAPSHOT.jar

Thank you!

@codecov
Copy link

codecov bot commented Dec 12, 2022

Codecov Report

Merging #143 (83e3e9a) into main (d503833) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head 83e3e9a differs from pull request most recent head c0e9f5f. Consider uploading reports for the commit c0e9f5f to get more accurate results

@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
- Coverage   92.86%   92.83%   -0.03%     
==========================================
  Files          73       73              
  Lines        1709     1717       +8     
  Branches      126      126              
==========================================
+ Hits         1587     1594       +7     
- Misses        122      123       +1     
Impacted Files Coverage Δ
...spark/internal/sources/catalog/QbeastCatalog.scala 100.00% <100.00%> (ø)
...ala/io/qbeast/spark/delta/writer/BlockWriter.scala 95.65% <0.00%> (-2.18%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@osopardo1
Copy link
Member Author

In this PR, I also updated the docs and I will change the version to 0.3.0.
Ideally, we can publish the new version before Christmas 😃

@osopardo1 osopardo1 requested a review from Jiaweihu08 December 14, 2022 08:59
@osopardo1 osopardo1 merged commit 0bdee8e into Qbeast-io:main Dec 14, 2022
@osopardo1 osopardo1 deleted the unified-catalog branch January 10, 2023 15:32
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