Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-164 Connector api overhaul
  3. TEIID-169

We should clarify the one-to-one relationship between Batch interface and BasicBatch class in the Connector API

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Optional Optional
    • 6.0.0
    • 6.0.0
    • Connector API
    • None

      When a connector implements the BatchedExecution interface, it is required to implement a method nextBatch() that returns a Batch. Batch is an interface, and technically can be implemented however the connector developer wants, as long as it implements "void addRow(List row)" and "List[] getResults()" - the implementation could theoretically store the current Batch state internally in a structure that was not a List[] and just do the needed conversions in these two methods.

      However, in every known connector the implementation of BatchedExecution just uses the BasicBatch implementation we provide for Batch, which takes the straightforward path and stores the batch internally as an ArrayList.

      This best practice is not obvious from the API itself (or even from the doc) - in the legacy MetaMatrix product we have had an instance where a developer built his own implementation of Batch (and somehow ran into trouble doing so).

      Perhaps we should make this best practice more obvious - one thought is that Batch should be an abstract class rather than an interface - or perhaps BatchedExecution should require that nextBatch return BasicBatch or an extension of BasicBatch - or perhaps we should leave the API as is in this regard and just highlight this in the doc (and javadoc).

            rhn-engineering-shawkins Steven Hawkins
            greghaber_jira Greg Haber (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: