Skip to content

Read collection of values out of backends #1605

Closed

Description

@lossyrob

This is the first piece of the "Collections API", which is the ability to work with collections of (key, value) pairs in a similar way to using RDDs, without the overhead of Spark.

This task is to read a collection of tiles from the backends. We can already read in single values (e.g. Tiles), and RDDs of tiles. With the completion of this task, we will read some collection of values (e.g. Vector[(SpatialKey, Tile)]) out of the backend. This should be able to use the Query API to query the backend in order to produce the collection.

A potential interface for this type of reader is follows, which is distinctly similar to FilteringLayerReader

  abstract class CollectionLayerReader[ID] {
    def read[
      K: AvroRecordCodec: Boundable: JsonFormat: ClassTag,
      V: AvroRecordCodec: ClassTag,
      M: JsonFormat: GetComponent[?, Bounds[K]]
    ](id: ID, rasterQuery: LayerQuery[K, M], numPartitions: Int, indexFilterOnly: Boolean): Vector[(K, V)] with Metadata[M]

    def read[
      K: AvroRecordCodec: Boundable: JsonFormat: ClassTag,
      V: AvroRecordCodec: ClassTag,
      M: JsonFormat: GetComponent[?, Bounds[K]]
    ](id: ID, rasterQuery: LayerQuery[K, M], numPartitions: Int): Vector[(K, V)] with Metadata[M] =
      read(id, rasterQuery, numPartitions, false)

    def read[
      K: AvroRecordCodec: Boundable: JsonFormat: ClassTag,
      V: AvroRecordCodec: ClassTag,
      M: JsonFormat: GetComponent[?, Bounds[K]]
    ](id: ID, rasterQuery: LayerQuery[K, M]): Vector[(K, V)] with Metadata[M] =
      read(id, rasterQuery, defaultNumPartitions)

    def read[
      K: AvroRecordCodec: Boundable: JsonFormat: ClassTag,
      V: AvroRecordCodec: ClassTag,
      M: JsonFormat: GetComponent[?, Bounds[K]]
    ](id: ID, numPartitions: Int): Vector[(K, V)] with Metadata[M] =
      read(id, new LayerQuery[K, M], numPartitions)

    def query[
      K: AvroRecordCodec: Boundable: JsonFormat: ClassTag,
      V: AvroRecordCodec: ClassTag,
      M: JsonFormat: GetComponent[?, Bounds[K]]
    ](layerId: ID): BoundLayerQuery[K, M, Vector[(K, V)] with Metadata[M]] =
      new BoundLayerQuery(new LayerQuery, read(layerId, _))

    def query[
      K: AvroRecordCodec: Boundable: JsonFormat: ClassTag,
      V: AvroRecordCodec: ClassTag,
      M: JsonFormat: GetComponent[?, Bounds[K]]
    ](layerId: ID, numPartitions: Int): BoundLayerQuery[K, M, Vector[(K, V)] with Metadata[M]] =
      new BoundLayerQuery(new LayerQuery, read(layerId, _, numPartitions))
  }

This might require us to have a similar type as ContextRDD for the collection type, e.g. ContextCollection

Activity

  1. added this to the 1.0 milestone on Jul 26, 2016
  2. lossyrob commented on Jul 26, 2016

    @lossyrob
    MemberAuthor
  3. pomadchin commented on Jul 26, 2016

    @pomadchin
    Member

    @lossyrob great, thanks!

  4. fosskers commented on Sep 28, 2016

    @fosskers
    Contributor

    This can be closed @lossyrob @echeipesh @rossbernet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions