mz_storage_operators

Module oneshot_source

Source
Expand description

“Oneshot” sources are a one-time ingestion of data from an external system, unlike traditional sources, they do not run continuously. Oneshot sources are generally used for COPY FROM SQL statements.

The implementation of reading and parsing data is behind the OneshotSource and OneshotFormat traits, respectively. Users looking to add new sources or formats, should only need to add new implementations for these traits.

  • OneshotSource is an interface for listing and reading from an external system, e.g. an HTTP server.
  • OneshotFormat is an interface for how to parallelize and parse data, e.g. CSV.

Given a OneshotSource and a OneshotFormat we build a dataflow structured like the following:

            ┏━━━━━━━━━━━━━━━┓
            ┃    Discover   ┃
            ┃    objects    ┃
            ┗━━━━━━━┯━━━━━━━┛
          ┌───< Distribute >───┐
          │                    │
    ┏━━━━━v━━━━┓         ┏━━━━━v━━━━┓
    ┃  Split   ┃   ...   ┃  Split   ┃
    ┃  Work 1  ┃         ┃  Work n  ┃
    ┗━━━━━┯━━━━┛         ┗━━━━━┯━━━━┛
          │                    │
          ├───< Distribute >───┤
          │                    │
    ┏━━━━━v━━━━┓         ┏━━━━━v━━━━┓
    ┃  Fetch   ┃   ...   ┃  Fetch   ┃
    ┃  Work 1  ┃         ┃  Work n  ┃
    ┗━━━━━┯━━━━┛         ┗━━━━━┯━━━━┛
          │                    │
          ├───< Distribute >───┤
          │                    │
    ┏━━━━━v━━━━┓         ┏━━━━━v━━━━┓
    ┃  Decode  ┃   ...   ┃  Decode  ┃
    ┃  Chunk 1 ┃         ┃  Chunk n ┃
    ┗━━━━━┯━━━━┛         ┗━━━━━┯━━━━┛
          │                    │
          │                    │
    ┏━━━━━v━━━━┓         ┏━━━━━v━━━━┓
    ┃  Stage   ┃   ...   ┃  Stage   ┃
    ┃  Batch 1 ┃         ┃  Batch n ┃
    ┗━━━━━┯━━━━┛         ┗━━━━━┯━━━━┛
          │                    │
          └─────────┬──────────┘
              ┏━━━━━v━━━━┓
              ┃  Result  ┃
              ┃ Callback ┃
              ┗━━━━━━━━━━┛

Modules§

Structs§

Enums§

Traits§

Functions§