Git Product home page Git Product logo

parquet-mr-bug's Introduction

Parquet MR Bug

This repository demonstrates Parquet-MR's inability to correctly serialize binary fields.

Thrift is capable of serializing/deserializing binary fields (and does not perform any encoding), whereas Parquet-MR will always apply UTF-8 encoding (treating binary fields as though they are UTF-8 encoded strings). This causes data corruption.

The Thrift struct that is encoded can be found in src/main/thrift/TestStruct.thrift.

An example of Thrift performing correctly can be found in src/main/scala/com/rouesnel/parquetmr/bug/ThriftExample.scala.

An example of Parquet performing badly can be found in src/main/scala/com/rouesnel/parquetmr/bug/ParquetExample.scala.

The Parquet example uses Ebenezer which is a library that wraps Scrooge generated thrift classes and calls into Parquet-MR. Specifically, au.com.cba.omnia.ebenezer.scrooge.ScroogeStructConverter is a simple transformation of parquet.thrift.ThriftSchemaConverter.ThriftStructConverter.

How to run

Thrift Example

./sbt "run-main com.rouesnel.parquetmr.bug.ThriftExample"

This should print the following:

Thrift
======

After encoding - binary field is equal to original binary field: true
After encoding - binary field is equal to UTF8 encoded binary field: false


Original
-----
binaryField:         -123, 20, 33
stringField:         foo
binaryAsStringField: -17, -65, -67, 20, 33



Parquet Serialized
-----
binaryField:         -123, 20, 33
stringField:         foo
binaryAsStringField: -17, -65, -67, 20, 33


binaryAsStringField should equal the binaryField in the deserialized version if Thrift does not support raw binary fields (e.g. without any encoding)
Since it does not we can conclude that Thrift actually supports raw encodings.

Parquet Example

./sbt "run-main com.rouesnel.parquetmr.bug.ParquetExample"

This should print the following:

Parquet
=======

Parquet File written to /some/random/location/test-324324-foo.parquet

After encoding - binary field is equal to original binary field: false
After encoding - binary field is equal to UTF8 encoded binary field: false


Original
-----
binaryField:         -123, 20, 33
stringField:         foo
binaryAsStringField: -17, -65, -67, 20, 33



Thrift Serialized
-----
binaryField:         3, 0, 0, 0, -123, 20, 33
stringField:         foo
binaryAsStringField: -17, -65, -67, 20, 33

parquet-mr-bug's People

Watchers

 avatar

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.