Giter Site home page Giter Site logo

Comments (3)

rajagurunath avatar rajagurunath commented on June 1, 2024

Hi @MrPowers,

I really like the idea of leveraging delta-like metadata handling for parquet files also.

Currently, Dask seems to collect footer information from every parquet file using Pyarrow (read_metadata) utilities and creates a global _metadata file.

So if we are tracking that information in a JSON file, What information we are planning to save in the JSON logs? and how we are going to collect that information?

I gave an initial read to this Delta protocol, Are we planning to save just the statistics, schema information for every parquet file or some more things? and also how we are planning to make use of this information in dask readers perspective.

I am still confused here, so can you please shed some more light on this!

Thanks

from dask-deltatable.

MrPowers avatar MrPowers commented on June 1, 2024

@rajagurunath - the global _metadata file that Dask is currently creating is not scalable and I think we should ignore that file for purposes of this project. Assume write_metadata_file=False.

Let's look at a little example and see what the outputted JSON file should look like:

df = pd.DataFrame(
    {"letter": ["a", "b", "c", "a", "a", "d"], "number": [1, 2, 3, 4, 5, 6]}
)
ddf = dd.from_pandas(df, npartitions=3)
ddf.to_delta("tmp/parquet/1", engine="pyarrow", write_metadata_file=False)

Here's the JSON file that should be outputted:

{
   "commitInfo":{
      "timestamp":1632491414394,
      "operation":"WRITE",
      "operationParameters":{
         "mode":"Overwrite",
         "partitionBy":"[]"
      },
      "isBlindAppend":false,
      "operationMetrics":{
         "numFiles":"3",
         "numOutputBytes":"2390",
         "numOutputRows":"6"
      }
   }
}{
   "protocol":{
      "minReaderVersion":1,
      "minWriterVersion":2
   }
}{
   "metaData":{
      "id":"db102a08-5265-4f86-a281-dfc8cccacf0e",
      "format":{
         "provider":"parquet",
         "options":{
            
         }
      },
      "schemaString":"{\"type\":\"struct\",\"fields\":[{\"name\":\"letter\",\"type\":\"string\",\"nullable\":true,\"metadata\":{}},{\"name\":\"number\",\"type\":\"long\",\"nullable\":true,\"metadata\":{}}]}",
      "partitionColumns":[
         
      ],
      "configuration":{
         
      },
      "createdTime":1632491409910
   }
}{
   "add":{
      "path":"part.0.parquet",
      "partitionValues":{
         
      },
      "size":377,
      "modificationTime":1632491410000,
      "dataChange":true
   }
}{
   "add":{
      "path":"part.1.parquet",
      "partitionValues":{
         
      },
      "size":674,
      "modificationTime":1632491410000,
      "dataChange":true
   }
}{
   "add":{
      "path":"part.2.parquet",
      "partitionValues":{
         
      },
      "size":654,
      "modificationTime":1632491410000,
      "dataChange":true
   }
}

Here's what the files should look like:

tmp/parquet/1/
  _delta_log/
    00000000000000000000.json
  part.0.parquet
  part.1.parquet
  part.2.parquet

We basically need to create the _delta_log exactly how Spark creates it when it writes Delta files. See this file for a code snippet on how to create Delta lakes with Spark.

Let me know if you have any additional questions. You're doing great work and I'm happy to help!

from dask-deltatable.

mrocklin avatar mrocklin commented on June 1, 2024

from dask-deltatable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.