Uploaded image for project: 'Kudu'
  1. Kudu
  2. KUDU-388

Simplify KuduScanner iteration API

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: M5
    • Fix Version/s: None
    • Component/s: api, client
    • Labels:
      None

      Description

      Currently, the KuduScanner for the C++ client has an iteration API that always results in the following (verbose) code pattern:

      vector<KuduRowResult> rows;
      while (scanner.HasMoreRows()) {
        CHECK_OK(scanner.NextBatch(&rows));
        BOOST_FOREACH(const KuduRowResult& row, rows) {
          DoStuffWithRow(row);
        }
        rows.clear();
      }
      

      On top of the extra avoidable LOCs, the client has to manage individual batches and clear the vector. This batching should be done internally by the scanner, probably in the same manner above, but only exposing a bool HasNext() and const KuduRowResult& GetNext() interface. The simpler interface has another advantage in that it would allow us to change the way we gather rows while keeping the implementation details away from the client.

      See discussion below for further API considerations.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vladimir.feinberg Vladimir Feinberg
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: