Git Product home page Git Product logo

parquet-extra's Introduction

parquet-extra

Build Status codecov.io GitHub license Maven Central Scala Steward badge

A collection of Apache Parquet add-on modules.

  • parquet-avro - Scala macros for generating column projections and filter predicates from lambda functions.
  • parquet-tensorflow - TensorFlow Example read/write support.

License

Copyright 2019 Neville Li.

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

parquet-extra's People

Contributors

clairemcginty avatar nevillelyh avatar regadas avatar scala-steward avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parquet-extra's Issues

Macro expansion fails on an array

Suppose the following Avro schema:

[
{ "type": "enum",
   "name": "POSTag",
   "namespace": "com.nitro.nlp",
   "symbols": ["TO", "VB", "CC", "RB"]
 },
{ "type": "record",
  "name": "POS",
  "namespace": "com.nitro.nlp",
  "doc": "Part of speech tag",
  "fields": [
    {"name": "id", "type": "long"},
    {"name": "token", "type": "string"},
    {"name": "tag", "type": "POSTag"}
  ]
},
{ "type": "record",
   "name": "ParsedPDF",
   "namespace": "com.nitro.nlp",
   "doc": "Parsed PDF",
   "fields": [
     {"name": "text", "type": "string"},
     {"name": "pos", "type": { "type": "array", "items": "POS" } }
   ]
}
]

Then, let's create an RDD and try to do a predicate on the "pos" array from the ParsedPDF object:

ParquetInputFormat.setReadSupportClass(job, classOf[AvroReadSupport[ParsedPDF]])

val rdd = sc.newAPIHadoopFile(path, classOf[ParquetInputFormat[ParsedPDF]],
  classOf[Void], classOf[ParsedPDF], job.getConfiguration
). map(_._2) // drop Void key

val projection = Projection[ParsedPDF](_.getText)
AvroParquetInputFormat.setRequestedProjection(job, projection)

val results = rdd.map(_.toString).collect().mkString("\n")
println(s"Projection of text field only: $results")

This fails the following way:

Error:(100, 41) exception during macro expansion: 
java.lang.RuntimeException: Unsupported value type: ARRAY
    at me.lyh.parquet.avro.Predicate$.applyToPredicate$1(Predicate.scala:137)
    at me.lyh.parquet.avro.Predicate$.parse$1(Predicate.scala:162)
    at me.lyh.parquet.avro.Predicate$.buildFilterPredicate(Predicate.scala:169)
    at me.lyh.parquet.avro.Predicate$.applyImpl(Predicate.scala:17)
    val predicate = Predicate[ParsedPDF](x => x.getPos.exists(i => i.getTag == POSTag.CC))
                                        ^

Is array support not available? If so, what's the list of Avro types that are currently supported?
Is there a plan to add array support to predicates?

Thanks!

Marek Kolodziej

Include transformed TF Schema in ExampleWriteSupport metadata

for cross-platform compatibility, we can include the TF Schema--normalized into a tensorflow.metadata.v0.Schema--into the metadata map supplied to ExampleWriteSupport's WriteContext.

To be determined:

  • Ensure that tensorflow.metadata.v0.Schema can be reliably mapped to/from a String (since parquet metadata is a stringly typed map)
  • Decide on a key name in the metadata. I would propose just tensorflow.metadata.v0.schema to preserve the versioning/leave the door open to support further Schema versions.

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.