You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2019/01/04 06:54:08 UTC

[GitHub] gparai closed pull request #1569: DRILL-6888: Move nested classes outside HashAggTemplate to allow for plain java compile option

gparai closed pull request #1569: DRILL-6888: Move nested classes outside HashAggTemplate to allow for plain java compile option
URL: https://github.com/apache/drill/pull/1569
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggSpilledPartition.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggSpilledPartition.java
new file mode 100644
index 00000000000..e5e82e0d3bb
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggSpilledPartition.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.physical.impl.aggregate;
+
+import org.apache.drill.exec.physical.impl.common.AbstractSpilledPartitionMetadata;
+import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
+
+public class HashAggSpilledPartition extends AbstractSpilledPartitionMetadata {
+  private final int spilledBatches;
+  private final String spillFile;
+
+  public HashAggSpilledPartition(final int cycle,
+                                 final int originPartition,
+                                 final int prevOriginPartition,
+                                 final int spilledBatches,
+                                 final String spillFile) {
+    super(cycle, originPartition, prevOriginPartition);
+
+    this.spilledBatches = spilledBatches;
+    this.spillFile = Preconditions.checkNotNull(spillFile);
+  }
+
+  public int getSpilledBatches() {
+    return spilledBatches;
+  }
+
+  public String getSpillFile() {
+    return spillFile;
+  }
+
+  @Override
+  public String makeDebugString() {
+    return String.format("Start reading spilled partition %d (prev %d) from cycle %d.",
+      this.getOriginPartition(), this.getPrevOriginPartition(), this.getCycle());
+  }
+}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
index d10a84af9b3..2f50dd6e863 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggTemplate.java
@@ -49,7 +49,6 @@
 import org.apache.drill.exec.ops.OperatorStats;
 import org.apache.drill.exec.physical.base.AbstractBase;
 import org.apache.drill.exec.physical.config.HashAggregate;
-import org.apache.drill.exec.physical.impl.common.AbstractSpilledPartitionMetadata;
 import org.apache.drill.exec.physical.impl.common.ChainedHashTable;
 import org.apache.drill.exec.physical.impl.common.CodeGenMemberInjector;
 import org.apache.drill.exec.physical.impl.common.HashTable;
@@ -84,7 +83,6 @@
 import org.apache.drill.exec.vector.ValueVector;
 
 import org.apache.drill.exec.vector.VariableWidthVector;
-import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
 
 import static org.apache.drill.exec.physical.impl.common.HashTable.BATCH_MASK;
 import static org.apache.drill.exec.record.RecordBatch.MAX_BATCH_ROW_COUNT;
@@ -149,7 +147,7 @@
   private int outBatchIndex[];
 
   // For handling spilling
-  private HashAggUpdater updater = new HashAggUpdater();
+  private HashAggUpdater updater;
   private SpilledState<HashAggSpilledPartition> spilledState = new SpilledState<>();
   private SpillSet spillSet;
   SpilledRecordbatch newIncoming; // when reading a spilled file - work like an "incoming"
@@ -171,59 +169,6 @@
   private OperatorStats stats = null;
   private HashTableStats htStats = new HashTableStats();
 
-  public static class HashAggSpilledPartition extends AbstractSpilledPartitionMetadata {
-    private final int spilledBatches;
-    private final String spillFile;
-
-    public HashAggSpilledPartition(final int cycle,
-                                   final int originPartition,
-                                   final int prevOriginPartition,
-                                   final int spilledBatches,
-                                   final String spillFile) {
-      super(cycle, originPartition, prevOriginPartition);
-
-      this.spilledBatches = spilledBatches;
-      this.spillFile = Preconditions.checkNotNull(spillFile);
-    }
-
-    public int getSpilledBatches() {
-      return spilledBatches;
-    }
-
-    public String getSpillFile() {
-      return spillFile;
-    }
-
-    @Override
-    public String makeDebugString() {
-      return String.format("Start reading spilled partition %d (prev %d) from cycle %d.",
-        this.getOriginPartition(), this.getPrevOriginPartition(), this.getCycle());
-    }
-  }
-
-  public class HashAggUpdater implements SpilledState.Updater {
-
-    @Override
-    public void cleanup() {
-      this.cleanup();
-    }
-
-    @Override
-    public String getFailureMessage() {
-      return null;
-    }
-
-    @Override
-    public long getMemLimit() {
-      return allocator.getLimit();
-    }
-
-    @Override
-    public boolean hasPartitionLimit() {
-      return false;
-    }
-  }
-
   public enum Metric implements MetricDef {
 
     NUM_BUCKETS,
@@ -375,6 +320,7 @@ public void setup(HashAggregate hashAggrConfig, HashTableConfig htConfig, Fragme
     this.context = context;
     this.stats = oContext.getStats();
     this.allocator = oContext.getAllocator();
+    this.updater = new HashAggUpdater(allocator);
     this.oContext = oContext;
     this.incoming = incoming;
     this.outgoing = outgoing;
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggUpdater.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggUpdater.java
new file mode 100644
index 00000000000..3ee26ebef80
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/aggregate/HashAggUpdater.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.physical.impl.aggregate;
+
+import org.apache.drill.exec.memory.BufferAllocator;
+import org.apache.drill.exec.physical.impl.common.SpilledState;
+
+public class HashAggUpdater implements SpilledState.Updater {
+  private final BufferAllocator allocator;
+  public HashAggUpdater(BufferAllocator allocator) { this.allocator = allocator; }
+
+  @Override
+  public void cleanup() { }
+
+  @Override
+  public String getFailureMessage() {
+    return null;
+  }
+
+  @Override
+  public long getMemLimit() {
+    return allocator.getLimit();
+  }
+
+  @Override
+  public boolean hasPartitionLimit() {
+    return false;
+  }
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services