drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meh...@apache.org
Subject [5/5] drill git commit: DRILL-3285: Part 2--Renaming.
Date Tue, 23 Jun 2015 19:00:09 GMT
DRILL-3285: Part 2--Renaming.

Renamed state/control-flow members:
- started -> initialSchemaLoaded
- first -> beforeFirstBatch
- redoFirstNext -> returnTrueForNextCallToNext
- finished -> afterLastRow

Renamed other items:
- changed -> schemaChanged
- currentBatch -> currentBatchHolder
- DrillResultSet's currentBatch -> batchLoader


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/d040429c
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/d040429c
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/d040429c

Branch: refs/heads/master
Commit: d040429cdafee0bfd25d1115a36922a10e2b5d96
Parents: 228be48
Author: dbarclay <dbarclay@maprtech.com>
Authored: Fri Jun 12 18:37:58 2015 -0700
Committer: Mehant Baid <mehantr@gmail.com>
Committed: Mon Jun 22 13:05:04 2015 -0700

----------------------------------------------------------------------
 .../org/apache/drill/jdbc/impl/DrillCursor.java | 52 ++++++++++----------
 .../drill/jdbc/impl/DrillResultSetImpl.java     |  6 +--
 2 files changed, 30 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/d040429c/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillCursor.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillCursor.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillCursor.java
index 9b54cf3..a54422e 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillCursor.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillCursor.java
@@ -44,16 +44,16 @@ class DrillCursor implements Cursor {
   private final DrillResultSetImpl resultSet;
 
   /** Holds current batch of records (none before first load). */
-  private final RecordBatchLoader currentBatch;
+  private final RecordBatchLoader currentBatchHolder;
 
   private final DrillResultSetImpl.ResultsListener resultsListener;
 
   /** Whether we're past the special first call to this.next() from
    * DrillResultSetImpl.execute(). */
-  private boolean started = false;
+  private boolean initialSchemaLoaded = false;
 
   /** Whether cursor is after the end of the sequence of records/rows. */
-  private boolean finished = false;
+  private boolean afterLastRow = false;
 
   /**
    * Whether the next call to this.next() should just return {@code true} rather
@@ -68,10 +68,10 @@ class DrillCursor implements Cursor {
    *   get first batch and schema before Statement.execute...(...) even returns.
    * </p>
    */
-  private boolean redoFirstNext = false;
+  private boolean returnTrueForNextCallToNext = false;
 
   /** Whether on first batch.  (Re skipping spurious empty batches.) */
-  private boolean first = true;
+  private boolean beforeFirstBatch = true;
 
   /** ... corresponds to current schema. */
   private DrillColumnMetaDataList columnMetaDataList;
@@ -92,7 +92,7 @@ class DrillCursor implements Cursor {
    */
   DrillCursor(final DrillResultSetImpl resultSet) {
     this.resultSet = resultSet;
-    currentBatch = resultSet.currentBatch;
+    currentBatchHolder = resultSet.batchLoader;
     resultsListener = resultSet.resultsListener;
   }
 
@@ -125,21 +125,21 @@ class DrillCursor implements Cursor {
    */
   @Override
   public boolean next() throws SQLException {
-    if (!started) {
-      started = true;
-      redoFirstNext = true;
-    } else if (redoFirstNext && !finished) {
+    if (!initialSchemaLoaded) {
+      initialSchemaLoaded = true;
+      returnTrueForNextCallToNext = true;
+    } else if (returnTrueForNextCallToNext && !afterLastRow) {
       // We have a deferred "not after end" to report--reset and report that.
-      redoFirstNext = false;
+      returnTrueForNextCallToNext = false;
       return true;
     }
 
-    if (finished) {
+    if (afterLastRow) {
       // We're already after end of rows/records--just report that after end.
       return false;
     }
 
-    if (currentRecordNumber + 1 < currentBatch.getRecordCount()) {
+    if (currentRecordNumber + 1 < currentBatchHolder.getRecordCount()) {
       // Have next row in current batch--just advance index and report "at a row."
       currentRecordNumber++;
       return true;
@@ -156,7 +156,7 @@ class DrillCursor implements Cursor {
         while ( qrb != null
                 && ( qrb.getHeader().getRowCount() == 0
                      || qrb.getData() == null )
-                && ! first ) {
+                && ! beforeFirstBatch ) {
           // Empty message--dispose of and try to get another.
           logger.warn( "Spurious batch read: {}", qrb );
 
@@ -178,13 +178,13 @@ class DrillCursor implements Cursor {
           }
         }
 
-        first = false;
+        beforeFirstBatch = false;
 
         if (qrb == null) {
           // End of batches--clean up, set state to done, report after last row.
 
-          currentBatch.clear();  // (We load it so we clear it.)
-          finished = true;
+          currentBatchHolder.clear();  // (We load it so we clear it.)
+          afterLastRow = true;
           return false;
         } else {
           // Got next (or first) batch--reset record offset to beginning,
@@ -192,20 +192,22 @@ class DrillCursor implements Cursor {
 
           currentRecordNumber = 0;
 
-          final boolean changed;
+          final boolean schemaChanged;
           try {
-            changed = currentBatch.load(qrb.getHeader().getDef(), qrb.getData());
+            schemaChanged = currentBatchHolder.load(qrb.getHeader().getDef(),
+                                                    qrb.getData());
           }
           finally {
             qrb.release();
           }
-          schema = currentBatch.getSchema();
-          if (changed) {
+          schema = currentBatchHolder.getSchema();
+          if (schemaChanged) {
             updateColumns();
           }
 
-          if (redoFirstNext && currentBatch.getRecordCount() == 0) {
-            redoFirstNext = false;
+          if (returnTrueForNextCallToNext
+              && currentBatchHolder.getRecordCount() == 0) {
+            returnTrueForNextCallToNext = false;
           }
           return true;
         }
@@ -237,7 +239,7 @@ class DrillCursor implements Cursor {
   }
 
   private void updateColumns() {
-    accessors.generateAccessors(this, currentBatch);
+    accessors.generateAccessors(this, currentBatchHolder);
     columnMetaDataList.updateColumnMetaData(UNKNOWN, UNKNOWN, UNKNOWN, schema);
     if (getResultSet().changeListener != null) {
       getResultSet().changeListener.schemaChanged(schema);
@@ -246,7 +248,7 @@ class DrillCursor implements Cursor {
 
   @Override
   public void close() {
-    // currentBatch is owned by resultSet and cleaned up by
+    // currentBatchHolder is owned by resultSet and cleaned up by
     // DrillResultSet.cleanup()
 
     // listener is owned by resultSet and cleaned up by

http://git-wip-us.apache.org/repos/asf/drill/blob/d040429c/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
index ab1eb92..c682d97 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
@@ -68,7 +68,7 @@ class DrillResultSetImpl extends AvaticaResultSet implements DrillResultSet
{
   private final DrillClient client;
   // TODO:  Resolve:  Since is barely manipulated here in DrillResultSetImpl,
   //  move down into DrillCursor and have this.clean() have cursor clean it.
-  final RecordBatchLoader currentBatch;
+  final RecordBatchLoader batchLoader;
   final DrillCursor cursor;
   boolean hasPendingCancelationNotification;
 
@@ -82,7 +82,7 @@ class DrillResultSetImpl extends AvaticaResultSet implements DrillResultSet
{
     resultsListener = new ResultsListener( batchQueueThrottlingThreshold );
     DrillConnection c = (DrillConnection) statement.getConnection();
     DrillClient client = c.getClient();
-    currentBatch = new RecordBatchLoader(client.getAllocator());
+    batchLoader = new RecordBatchLoader(client.getAllocator());
     this.client = client;
     cursor = new DrillCursor(this);
   }
@@ -133,7 +133,7 @@ class DrillResultSetImpl extends AvaticaResultSet implements DrillResultSet
{
       client.cancelQuery(resultsListener.getQueryId());
     }
     resultsListener.close();
-    currentBatch.clear();
+    batchLoader.clear();
   }
 
   @Override


Mime
View raw message