drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [21/45] drill git commit: DRILL-3987: (REFACTOR) Extract BoundsChecking check from AssertionUtil. Remove unused file.
Date Fri, 13 Nov 2015 02:37:51 GMT
DRILL-3987: (REFACTOR) Extract BoundsChecking check from AssertionUtil. Remove unused file.


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

Branch: refs/heads/master
Commit: 62353a6fd301e4ff5ddce522b28b47a76c284af4
Parents: 1fde9bb
Author: Jacques Nadeau <jacques@apache.org>
Authored: Sat Nov 7 19:44:58 2015 -0800
Committer: Jacques Nadeau <jacques@apache.org>
Committed: Thu Nov 12 17:00:47 2015 -0800

----------------------------------------------------------------------
 .../com/google/protobuf/WireFormatProxy.java    | 27 --------------------
 .../apache/drill/exec/util/AssertionUtil.java   |  6 ++---
 .../expr/fn/impl/StringFunctionHelpers.java     |  4 +--
 .../apache/drill/exec/expr/fn/impl/XXHash.java  |  6 ++---
 .../store/easy/text/compliant/TextInput.java    |  6 ++---
 .../src/main/java/io/netty/buffer/DrillBuf.java |  4 +--
 .../drill/exec/memory/BoundsChecking.java       | 17 ++++++++++++
 .../exec/expr/fn/impl/ByteFunctionHelpers.java  |  4 +--
 8 files changed, 30 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/common/src/main/java/com/google/protobuf/WireFormatProxy.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/com/google/protobuf/WireFormatProxy.java b/common/src/main/java/com/google/protobuf/WireFormatProxy.java
deleted file mode 100644
index 181b975..0000000
--- a/common/src/main/java/com/google/protobuf/WireFormatProxy.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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 com.google.protobuf;
-
-public class WireFormatProxy {
-
-  WireFormatProxy(){};
-
-  public static int getFieldType(int tag){
-    return WireFormat.getTagWireType(tag);
-  }
-}

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/common/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/exec/util/AssertionUtil.java b/common/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
index 2348e62..770ed07 100644
--- a/common/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
+++ b/common/src/main/java/org/apache/drill/exec/util/AssertionUtil.java
@@ -20,20 +20,18 @@ package org.apache.drill.exec.util;
 public class AssertionUtil {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AssertionUtil.class);
 
-
   public static final boolean ASSERT_ENABLED;
-  public static final boolean BOUNDS_CHECKING_ENABLED;
 
   static{
     boolean isAssertEnabled = false;
     assert isAssertEnabled = true;
     ASSERT_ENABLED = isAssertEnabled;
-    BOUNDS_CHECKING_ENABLED = ASSERT_ENABLED || !"true".equals(System.getProperty("drill.enable_unsafe_memory_access"));
   }
 
   public static boolean isAssertionsEnabled(){
     return ASSERT_ENABLED;
   }
 
-
+  private AssertionUtil() {
+  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
index 2f5cf26..c919f28 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionHelpers.java
@@ -22,7 +22,7 @@ import io.netty.buffer.DrillBuf;
 import io.netty.util.internal.PlatformDependent;
 
 import org.apache.drill.exec.expr.holders.VarCharHolder;
-import org.apache.drill.exec.util.AssertionUtil;
+import org.apache.drill.exec.memory.BoundsChecking;
 import org.joda.time.chrono.ISOChronology;
 
 import com.google.common.base.Charsets;
@@ -30,7 +30,7 @@ import com.google.common.base.Charsets;
 public class StringFunctionHelpers {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StringFunctionHelpers.class);
 
-  private static final boolean BOUNDS_CHECKING_ENABLED = AssertionUtil.BOUNDS_CHECKING_ENABLED;
+  private static final boolean BOUNDS_CHECKING_ENABLED = BoundsChecking.BOUNDS_CHECKING_ENABLED;
 
   static final int RADIX = 10;
   static final long MAX_LONG = -Long.MAX_VALUE / RADIX;

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
index 81dbf5f..b18daed 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/XXHash.java
@@ -17,17 +17,17 @@
  */
 package org.apache.drill.exec.expr.fn.impl;
 
-import org.apache.drill.exec.util.AssertionUtil;
-
 import io.netty.buffer.DrillBuf;
 import io.netty.util.internal.PlatformDependent;
 
+import org.apache.drill.exec.memory.BoundsChecking;
+
 import com.google.common.primitives.UnsignedLongs;
 
 public final class XXHash {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(XXHash.class);
 
-  private static final boolean BOUNDS_CHECKING_ENABLED = AssertionUtil.BOUNDS_CHECKING_ENABLED;
+  private static final boolean BOUNDS_CHECKING_ENABLED = BoundsChecking.BOUNDS_CHECKING_ENABLED;
 
   static final long PRIME64_1 = UnsignedLongs.decode("11400714785074694791");
   static final long PRIME64_2 = UnsignedLongs.decode("14029467366897019727");

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/TextInput.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/TextInput.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/TextInput.java
index c764f56..c99e867 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/TextInput.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/easy/text/compliant/TextInput.java
@@ -41,9 +41,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
 
-import org.apache.drill.exec.ops.OperatorContext;
-import org.apache.drill.exec.ops.OperatorStats;
-import org.apache.drill.exec.util.AssertionUtil;
+import org.apache.drill.exec.memory.BoundsChecking;
 import org.apache.hadoop.fs.ByteBufferReadable;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.Seekable;
@@ -310,7 +308,7 @@ final class TextInput {
       throw StreamFinishedPseudoException.INSTANCE;
     }
 
-    if(AssertionUtil.BOUNDS_CHECKING_ENABLED){
+    if (BoundsChecking.BOUNDS_CHECKING_ENABLED) {
       buffer.checkBytes(bufferPtr - 1, bufferPtr);
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java
----------------------------------------------------------------------
diff --git a/exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java b/exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java
index 38eb622..b85502b 100644
--- a/exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java
+++ b/exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java
@@ -30,16 +30,16 @@ import java.nio.charset.Charset;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.drill.exec.memory.Accountor;
+import org.apache.drill.exec.memory.BoundsChecking;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.ops.BufferManager;
-import org.apache.drill.exec.util.AssertionUtil;
 
 import com.google.common.base.Preconditions;
 
 public final class DrillBuf extends AbstractByteBuf implements AutoCloseable {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillBuf.class);
 
-  private static final boolean BOUNDS_CHECKING_ENABLED = AssertionUtil.BOUNDS_CHECKING_ENABLED;
+  private static final boolean BOUNDS_CHECKING_ENABLED = BoundsChecking.BOUNDS_CHECKING_ENABLED;
 
   private final ByteBuf b;
   private final long addr;

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BoundsChecking.java
----------------------------------------------------------------------
diff --git a/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BoundsChecking.java
b/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BoundsChecking.java
new file mode 100644
index 0000000..7588b2c
--- /dev/null
+++ b/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BoundsChecking.java
@@ -0,0 +1,17 @@
+package org.apache.drill.exec.memory;
+
+public class BoundsChecking {
+  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BoundsChecking.class);
+
+  public static final boolean BOUNDS_CHECKING_ENABLED;
+
+  static {
+    boolean isAssertEnabled = false;
+    assert isAssertEnabled = true;
+    BOUNDS_CHECKING_ENABLED = isAssertEnabled
+        || !"true".equals(System.getProperty("drill.enable_unsafe_memory_access"));
+  }
+
+  private BoundsChecking() {
+  }
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/62353a6f/exec/vector/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java
b/exec/vector/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java
index 006a084..8a330b8 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/expr/fn/impl/ByteFunctionHelpers.java
@@ -21,7 +21,7 @@ package org.apache.drill.exec.expr.fn.impl;
 import io.netty.buffer.DrillBuf;
 import io.netty.util.internal.PlatformDependent;
 
-import org.apache.drill.exec.util.AssertionUtil;
+import org.apache.drill.exec.memory.BoundsChecking;
 import org.apache.drill.exec.util.DecimalUtility;
 
 import com.google.common.primitives.UnsignedLongs;
@@ -29,7 +29,7 @@ import com.google.common.primitives.UnsignedLongs;
 public class ByteFunctionHelpers {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ByteFunctionHelpers.class);
 
-  private static final boolean BOUNDS_CHECKING_ENABLED = AssertionUtil.BOUNDS_CHECKING_ENABLED;
+  private static final boolean BOUNDS_CHECKING_ENABLED = BoundsChecking.BOUNDS_CHECKING_ENABLED;
 
   /**
    * Helper function to check for equality of bytes in two DrillBuffers


Mime
View raw message