-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Feature Request] Liquid Clustering #1874
Comments
Hi guys, do we have any white paper or link that I can refer to understand MDC, or liquid clustering? I know requirement doc is on the way but any other resource that can throw more light on this feature? |
This feature in on Delta Lake 3.0.0 Preview release notes, is it expected to have an 3.0.0 RC2 with the feature? Usually, the Delta final version is released few weeks after RC1. It seems this won't make to the 3.0.0 final? |
@tdas Hi,does Liquid Clustering use the DBSCAN algorithm? Thanks. |
@akshaysinghUdaan: Kindly use the link, https://www.databricks.com/blog/announcing-delta-lake-30-new-universal-format-and-liquid-clustering |
This needs a LOT more detail: "Liquid clustering uses a continuous fractal space filling curve as a multi-dimensional clustering technique, which significantly improves data skipping" |
"For multidimensional databases, Hilbert order has been proposed to be used instead of Z order because it has better locality-preserving behavior. For example, Hilbert curves have been used to compress and accelerate R-tree indexes[9] (see Hilbert R-tree). They have also been used to help compress data warehouses.[10][11]" |
@loquisgon we are working on the design doc and we will have more details on clustering algorithm. Stay tuned! |
@imback82 Any progress on the doc or implementing solution in delta project? Databricks 13.2 has already implemented the liquid clustering, but we still have lack of information about this solution |
@vkorukanti can you assign this issue to me? |
Hello everyone, we've added the design doc to this issue. Please feel free to review it. Thank you! |
@zedtang if you don't mind to share the doc using this option which allows to print and comment (if you select Commenter). Even if you leave Viewer permission only, at least that option allow us to print it. Previous design docs were shared that way |
Hi @felipepessoto , I updated the link to give everyone commenter access! |
Hi, will it be possible to use liquid clustering on partitioned tables? |
We propose to introduce a new feature **Clustered Table** to the Delta spec. The Clustered Table feature facilitates the physical clustering of rows that share similar values on a predefined set of clustering columns. This enhances query performance when selective filters are applied to these clustering columns through data skipping. More details can be found in the github issue [here](#1874). Closes #2264 GitOrigin-RevId: db124f01b8a8bfa06367700fbabb588c5b03497b
#1874 requests Liquid clustering, and this PR starts the first step to introduce ClusteringTableFeature and CLUSTERED_BY tags. When creating a clustered table, The feature clustering must exist in the table protocol's writerFeatures. When a clustering implementation clusters files, writers must incorporate a tag with CLUSTERED_BY as the key and the name of the clustering implementation as the corresponding value in add action. More detail can be found in the Delta protocol change PR #2264 The next step is to pave the way to integrate the table feature and clusterby tags when defining and clustering a clustered table. Closes #2281 GitOrigin-RevId: e210b491a324a0794ec9f3a9236bb1932a6677e3
In the design doc I don't see any info if clustering can be applied to existing Delta tables. As we use liquid from databricks already we observed that either you have to apply liquid to an empty table or you have to use the like command which basically copies and creates a new Delta table I guess it will be really frustrating if we can't apply liquid to existing Delta tables :) Thanks already everyone |
According to https://delta.io/pdfs/DLTDG_ER3.pdf (page 131) k-d trees are used to implement liquid clustering instead of space filling curves. Are there any pros and cons for an implementation using k-d trees? |
Good point. I think we should be able to migrate existing tables in place by |
Oh sorry about that @auckenth - this is an error within the book. We will be updating the book chapter with the latest info per the design doc. |
This PR is part of delta-io#1874. This PR implements a new data clustering algorithm based on Hilbert curve. No code uses this new implementation yet. Will implement incremental clustering using ZCube in follow-up PRs. Design can be found at: https://docs.google.com/document/d/1FWR3odjOw4v4-hjFy_hVaNdxHVs4WuK1asfB6M6XEMw/edit#heading=h.uubbjjd24plb. Closes delta-io#2314 GitOrigin-RevId: abafaa717ba8f7d8809114858c0fd2a25861fcb8
It'd be nice if someone could address comments and questions in the design doc. :) |
Sorry if this is not the right place to ask, but is there anyway with liquid cluster to enforce some level of clustering? In particular I want to cluster by something like project,day and implement retention such that I delete data older than X days which is different for each project. With hive style I can partition on those columns and delete entire files without rewrites. |
Sorry for the delay, I replied in the design doc. |
@zedtang Are you planning to support "cluster on write" ? |
@zedtang With the feature, we don't need additional OPTIMIZE run after ingesting large data. |
It's probably tricky to implement clustering on write. (1) clustering works well only when a sufficient amount of data has accumulated and can be clustered together, so doing on every write (commonly small writes) may not produce well-clustered data at the end, and one has to run offline optimize jobs anyway (2) clustering on write will require some kind of sorting, which will come at a cost to write latency. so it's not an easy decision. It would be very cool if someone proposes a design and shows that it will work well for some workloads without sacrificing write latency/throughput significantly |
Appending large amounts of data works well, because liquid clustering is incremental. The only drawback is that you need 2x storage for appended data if you want to preserve time travel. But if you try to merge large amounts of data (but still small compared to the rest of the table, think 200GB merged into 10TB), you have basically three options now:
I can think of two features either of which can help with this:
|
I've tested OPTIMIZE + liquid clustering + deletion vectors and Delta Lake wrote much less data than I expected: I merged 100GB of data that had about 25% of updates into 1TB table. Right now my S3 bucket looks like this:
If OPTIMIZE had to rewrite every file touched by a deletion vector, given that my updates are totally random, I would expect it to write 100GB + 1000GB of data, not 100GB + 25GB. But on a smaller-sized table (100GB of old data + 10GB increment) I ended up with 220GB, just as I predicted. I am quite confused now. |
Overview
We propose to introduce Liquid Clustering, a new effort to revamp how clustering works in Delta, which addresses the shortcomings of Hive-style partitioning and current ZORDER clustering.
Motivation
Partitioning/clustering is a common technique to manage datasets to reduce unnecessary data processing. Hive-style partitioning and ZORDER (multi-dimensional) clustering are existing solutions in Delta, but both have limitations.
Hive-style partitioning
Hive-style partitioning clusters data such that every file contains exactly one distinct combination of partition column values. Although Hive-style partitioning works well if tuned correctly, there are limitations:
ZORDER clustering
ZORDER is a muti-dimensional clustering technique used in Delta. The
OPTIMIZE ZORDER BY
command applies ZORDER clustering and improves the performance of queries that utilizeZORDER BY
columns in their predicates. However, it has the following limitations:OPTIMIZE ZORDER BY
run is not automatically clustered, and the user needs to rerun the command to cluster the new data.OPTIMIZE ZORDER BY
reclusters already well-clustered data, resulting in high write amplification.ZORDER BY
columns are not persisted and the user is required to remember the previousZORDER BY
columns, often causing user errors.Detailed Design
Please refer to the document here.
The text was updated successfully, but these errors were encountered: