Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-254

When an IterOutcome is NONE, do not access the batch

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.4.0
    • Component/s: None
    • Labels:
      None

      Description

      Data associated with a RecordBatch/RootExec in the NONE state should not be relied upon.

      This requires changes to logic in various parts of the code base; if an operator returns a NONE state, do not attempt to access the batch (e.g. record count, field metadata, value vectors, etc.).

        Issue Links

          Activity

          Hide
          jnadeau Jacques Nadeau added a comment -

          merged

          Show
          jnadeau Jacques Nadeau added a comment - merged
          Hide
          jnadeau Jacques Nadeau added a comment -

          The approach i'm taking is creating a new IteratorValidator operator that is inserted between all other operators at Implementation time if assertions are enabled. The semantics are as follows:

          For the RecordBatch interface

          A IllegalStateException is thrown if any of these methods are called and we've most recently returned either an OK or OK_NEW_SCHEMA.

          public Iterator<VectorWrapper<?>> iterator()
          public BatchSchema getSchema()
          public int getRecordCount()
          public SelectionVector2 getSelectionVector2()
          public SelectionVector4 getSelectionVector4()
          public TypedFieldId getValueVectorId(SchemaPath path)
          public VectorWrapper<?> getValueAccessorById(int fieldId, Class<?> clazz)
          public WritableBatch getWritableBatch()

          Additionally, if you attempt to call the next() method, we throw an IllegalStateException if the previous state was NONE.

          Once completed, this should reveal where we are violating interface contracts and correct those bugs.

          Show
          jnadeau Jacques Nadeau added a comment - The approach i'm taking is creating a new IteratorValidator operator that is inserted between all other operators at Implementation time if assertions are enabled. The semantics are as follows: For the RecordBatch interface A IllegalStateException is thrown if any of these methods are called and we've most recently returned either an OK or OK_NEW_SCHEMA. public Iterator<VectorWrapper<?>> iterator() public BatchSchema getSchema() public int getRecordCount() public SelectionVector2 getSelectionVector2() public SelectionVector4 getSelectionVector4() public TypedFieldId getValueVectorId(SchemaPath path) public VectorWrapper<?> getValueAccessorById(int fieldId, Class<?> clazz) public WritableBatch getWritableBatch() Additionally, if you attempt to call the next() method, we throw an IllegalStateException if the previous state was NONE. Once completed, this should reveal where we are violating interface contracts and correct those bugs.

            People

            • Assignee:
              jnadeau Jacques Nadeau
              Reporter:
              benjamin.becker Ben Becker
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development