sachin-27 opened a new issue, #27953:
URL: https://github.com/apache/datafusion/issues/27953

   Hi @alamb @adriangb @suremarc @xudong963 @zhuqi-lucas,
   
   We're working on incremental materialized views on top of DataFusion. 
Instead of recomputing a view, each refresh aggregates only the new rows and 
merges them into the view's stored results. So over its life a view holds data 
written by many DataFusion releases. That made us look at what changes between 
DataFusion versions. A few things we noticed going from 53 to 55:
   
   - approx_distinct: the hash changed from ahash (53) to foldhash (54), whose 
output isn't stable across versions or platforms, and 55 changed string hashing 
again and stores small sets as a list of up to 256 hashes.
   - The hash can depend on the in-memory type: in 55 a short Utf8View string 
hashes by its view, and Parquet strings come back as Utf8View or Utf8 depending 
on schema_force_view_types.
   - Function behaviour changes: 54 switched number vs string comparison from 
string order to numeric (`5 > '100'` went from true to false), and there were 
fixes to LIKE with escapes, overflowing time casts and date_trunc on extreme 
timestamps.
   - Some aggregate states changed shape, e.g. the decimal sum inside avg in 55.
   - datafusion-proto notes that a plan serialized by one version may not 
deserialize with another.
   - Bug fixes like #22374 (row-group pruning for `LIKE 'foo\_%'`) correct 
future results, but anything computed while the bug was there stays wrong.
   
   None of this matters when results are recomputed on every query, but it does 
once they're stored, so we'd like some direction from the community before 
going further.
   
   Other engines have gone different ways here:
   
   - ClickHouse puts a version number in the aggregate state type, keeps old 
layouts readable forever, and gates behaviour changes behind a `compatibility` 
setting.
   - Iceberg pins the Apache DataSketches theta format, with a fixed seed and 
value encoding, for its NDV stats, so a sketch written by one engine can be 
merged by another.
   
   How does the community recommend handling this?
   
   1. For materialized views built on DataFusion, is there a recommended way to 
deal with results or state written by an older version, other than rebuilding 
the affected views?
   2. Is there a view on which DataFusion outputs should be stable across 
versions (aggregate state, sketches, proto plans)? Would a stable, versioned 
approx_distinct format be welcome upstream, or should projects that persist 
state bring their own UDAFs?
   3. Is there appetite for a way to keep the old behaviour after a semantic 
change, similar to ClickHouse's `compatibility` setting, or for versioned plan 
serialization?
   4. Is there shared work on storage formats or UDFs for materialized views, 
for example in datafusion-materialized-views, that we should build on?
   
   Curious to hear how the community sees this.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to