You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ad...@apache.org on 2015/02/25 22:44:20 UTC
[1/2] drill git commit: DRILL-2130: Fixed
JUnit/Hamcrest/Mockito/Paranamer class path problem.
Repository: drill
Updated Branches:
refs/heads/master 8bb6b08e5 -> f7ef5ec78
DRILL-2130: Fixed JUnit/Hamcrest/Mockito/Paranamer class path problem.
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/b0faf708
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/b0faf708
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/b0faf708
Branch: refs/heads/master
Commit: b0faf708bdbeb53bc3a446d3782554640bdfd6df
Parents: 8bb6b08
Author: dbarclay <db...@maprtech.com>
Authored: Sun Feb 22 00:45:42 2015 -0800
Committer: Aditya Kishore <ad...@apache.org>
Committed: Wed Feb 25 11:08:20 2015 -0800
----------------------------------------------------------------------
...rill2130CommonHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
...30StorageHBaseHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
...torageHiveCoreHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
...130InterpreterHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
exec/java-exec/pom.xml | 9 ++++
...ll2130JavaExecHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
...ll2130JavaJdbcHamcrestConfigurationTest.java | 46 ++++++++++++++++++++
pom.xml | 8 ++++
8 files changed, 293 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java b/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
new file mode 100644
index 0000000..99643b1
--- /dev/null
+++ b/common/src/test/java/org/apache/drill/test/Drill2130CommonHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130CommonHamcrestConfigurationTest {
+
+ @SuppressWarnings("unused")
+ private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+ @Test
+ public void testJUnitHamcrestMatcherFailureWorks() {
+ try {
+ assertThat( 1, equalTo( 2 ) );
+ }
+ catch ( NoSuchMethodError e ) {
+ fail( "Class search path seems broken re new JUnit and old Hamcrest."
+ + " Got NoSuchMethodError; e: " + e );
+ }
+ catch ( AssertionError e ) {
+ System.out.println( "Class path seems fine re new JUnit vs. old Hamcrest."
+ + " (Got AssertionError, not NoSuchMethodError.)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
new file mode 100644
index 0000000..b52654d
--- /dev/null
+++ b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/test/Drill2130StorageHBaseHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.hbase.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130StorageHBaseHamcrestConfigurationTest {
+
+ @SuppressWarnings("unused")
+ private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+ @Test
+ public void testJUnitHamcrestMatcherFailureWorks() {
+ try {
+ assertThat( 1, equalTo( 2 ) );
+ }
+ catch ( NoSuchMethodError e ) {
+ fail( "Class search path seems broken re new JUnit and old Hamcrest."
+ + " Got NoSuchMethodError; e: " + e );
+ }
+ catch ( AssertionError e ) {
+ System.out.println( "Class path seems fine re new JUnit vs. old Hamcrest."
+ + " (Got AssertionError, not NoSuchMethodError.)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
new file mode 100644
index 0000000..eaa1b45
--- /dev/null
+++ b/contrib/storage-hive/core/src/test/java/org/apache/drill/exec/test/Drill2130StorageHiveCoreHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130StorageHiveCoreHamcrestConfigurationTest {
+
+ @SuppressWarnings("unused")
+ private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+ @Test
+ public void testJUnitHamcrestMatcherFailureWorks() {
+ try {
+ assertThat( 1, equalTo( 2 ) );
+ }
+ catch ( NoSuchMethodError e ) {
+ fail( "Class search path seems broken re new JUnit and old Hamcrest."
+ + " Got NoSuchMethodError; e: " + e );
+ }
+ catch ( AssertionError e ) {
+ System.out.println( "Class path seems fine re new JUnit vs. old Hamcrest."
+ + " (Got AssertionError, not NoSuchMethodError.)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java b/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
new file mode 100644
index 0000000..41cf75b
--- /dev/null
+++ b/exec/interpreter/src/test/java/org/apache/drill/exec/expr/test/Drill2130InterpreterHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.expr.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130InterpreterHamcrestConfigurationTest {
+
+ @SuppressWarnings("unused")
+ private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+ @Test
+ public void testJUnitHamcrestMatcherFailureWorks() {
+ try {
+ assertThat( 1, equalTo( 2 ) );
+ }
+ catch ( NoSuchMethodError e ) {
+ fail( "Class search path seems broken re new JUnit and old Hamcrest."
+ + " Got NoSuchMethodError; e: " + e );
+ }
+ catch ( AssertionError e ) {
+ System.out.println( "Class path seems fine re new JUnit vs. old Hamcrest."
+ + " (Got AssertionError, not NoSuchMethodError.)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/java-exec/pom.xml
----------------------------------------------------------------------
diff --git a/exec/java-exec/pom.xml b/exec/java-exec/pom.xml
index 06f60fb..28eca2b 100644
--- a/exec/java-exec/pom.xml
+++ b/exec/java-exec/pom.xml
@@ -57,6 +57,15 @@
<groupId>com.thoughtworks.paranamer</groupId>
<artifactId>paranamer</artifactId>
<version>2.5.6</version>
+ <exclusions>
+ <!-- Exclude Paranamer's dependency on mockito-all, which has a Jar
+ file that contains old Hamcrest 1.1 classes (rather than declaring
+ a dependency on Hamcrest). (See DRILL-2130.) -->
+ <exclusion>
+ <artifactId>mockito-all</artifactId>
+ <groupId>org.mockito</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
new file mode 100644
index 0000000..03d858c
--- /dev/null
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/test/Drill2130JavaExecHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130JavaExecHamcrestConfigurationTest {
+
+ @SuppressWarnings("unused")
+ private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+ @Test
+ public void testJUnitHamcrestMatcherFailureWorks() {
+ try {
+ assertThat( 1, equalTo( 2 ) );
+ }
+ catch ( NoSuchMethodError e ) {
+ fail( "Class search path seems broken re new JUnit and old Hamcrest."
+ + " Got NoSuchMethodError; e: " + e );
+ }
+ catch ( AssertionError e ) {
+ System.out.println( "Class path seems fine re new JUnit vs. old Hamcrest."
+ + " (Got AssertionError, not NoSuchMethodError.)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
new file mode 100644
index 0000000..ada9ad2
--- /dev/null
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2130JavaJdbcHamcrestConfigurationTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.jdbc.test;
+
+import org.junit.Test;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+
+public class Drill2130JavaJdbcHamcrestConfigurationTest {
+
+ @SuppressWarnings("unused")
+ private org.hamcrest.MatcherAssert forCompileTimeCheckForNewEnoughHamcrest;
+
+ @Test
+ public void testJUnitHamcrestMatcherFailureWorks() {
+ try {
+ assertThat( 1, equalTo( 2 ) );
+ }
+ catch ( NoSuchMethodError e ) {
+ fail( "Class search path seems broken re new JUnit and old Hamcrest."
+ + " Got NoSuchMethodError; e: " + e );
+ }
+ catch ( AssertionError e ) {
+ System.out.println( "Class path seems fine re new JUnit vs. old Hamcrest."
+ + " (Got AssertionError, not NoSuchMethodError.)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/b0faf708/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index dc1448c..525579a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -525,6 +525,7 @@
<!-- Test Dependencies -->
<dependency>
+ <!-- JMockit needs to be on class path before JUnit. -->
<groupId>com.googlecode.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.3</version>
@@ -537,6 +538,13 @@
<scope>test</scope>
</dependency>
<dependency>
+ <!-- Mockito needs to be on the class path after JUnit (or Hamcrest) as
+ long as Mockito _contains_ older Hamcrest classes. See DRILL-2130. -->
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ </dependency>
+ <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
[2/2] drill git commit: DRILL-1690: Issue with using HBase plugin to
access row_key only
Posted by ad...@apache.org.
DRILL-1690: Issue with using HBase plugin to access row_key only
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/f7ef5ec7
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/f7ef5ec7
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/f7ef5ec7
Branch: refs/heads/master
Commit: f7ef5ec784844a99b8b39fe10ab14f001ae149f2
Parents: b0faf70
Author: Aditya Kishore <ad...@apache.org>
Authored: Wed Feb 25 01:10:48 2015 -0800
Committer: Aditya Kishore <ad...@apache.org>
Committed: Wed Feb 25 11:17:06 2015 -0800
----------------------------------------------------------------------
.../exec/store/hbase/HBaseRecordReader.java | 35 +++++++++++---------
1 file changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/f7ef5ec7/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
----------------------------------------------------------------------
diff --git a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
index da38707..42038e8 100644
--- a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
+++ b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/HBaseRecordReader.java
@@ -72,6 +72,8 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
private Configuration hbaseConf;
private OperatorContext operatorContext;
+ private boolean rowKeyOnly;
+
public HBaseRecordReader(Configuration conf, HBaseSubScan.HBaseSubScanSpec subScanSpec,
List<SchemaPath> projectedColumns, FragmentContext context) throws OutOfMemoryException {
hbaseConf = conf;
@@ -87,8 +89,8 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
@Override
protected Collection<SchemaPath> transformColumns(Collection<SchemaPath> columns) {
Set<SchemaPath> transformed = Sets.newLinkedHashSet();
+ rowKeyOnly = true;
if (!isStarQuery()) {
- boolean rowKeyOnly = true;
for (SchemaPath column : columns) {
if (column.getRootSegment().getPath().equalsIgnoreCase(ROW_KEY)) {
transformed.add(ROW_KEY_PATH);
@@ -116,6 +118,7 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
HBaseUtils.andFilterAtIndex(hbaseScan.getFilter(), HBaseUtils.LAST_FILTER, new FirstKeyOnlyFilter()));
}
} else {
+ rowKeyOnly = false;
transformed.add(ROW_KEY_PATH);
}
@@ -131,7 +134,6 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
this.operatorContext = operatorContext;
}
-
@Override
public void setup(OutputMutator output) throws ExecutionSetupException {
this.outputMutator = output;
@@ -197,22 +199,23 @@ public class HBaseRecordReader extends AbstractRecordReader implements DrillHBas
if (rowKeyVector != null) {
rowKeyVector.getMutator().setSafe(rowCount, cells[0].getRowArray(), cells[0].getRowOffset(), cells[0].getRowLength());
}
+ if (!rowKeyOnly) {
+ for (Cell cell : cells) {
+ int familyOffset = cell.getFamilyOffset();
+ int familyLength = cell.getFamilyLength();
+ byte[] familyArray = cell.getFamilyArray();
+ MapVector mv = getOrCreateFamilyVector(new String(familyArray, familyOffset, familyLength), true);
- for (Cell cell : cells) {
- int familyOffset = cell.getFamilyOffset();
- int familyLength = cell.getFamilyLength();
- byte[] familyArray = cell.getFamilyArray();
- MapVector mv = getOrCreateFamilyVector(new String(familyArray, familyOffset, familyLength), true);
+ int qualifierOffset = cell.getQualifierOffset();
+ int qualifierLength = cell.getQualifierLength();
+ byte[] qualifierArray = cell.getQualifierArray();
+ NullableVarBinaryVector v = getOrCreateColumnVector(mv, new String(qualifierArray, qualifierOffset, qualifierLength));
- int qualifierOffset = cell.getQualifierOffset();
- int qualifierLength = cell.getQualifierLength();
- byte[] qualifierArray = cell.getQualifierArray();
- NullableVarBinaryVector v = getOrCreateColumnVector(mv, new String(qualifierArray, qualifierOffset, qualifierLength));
-
- int valueOffset = cell.getValueOffset();
- int valueLength = cell.getValueLength();
- byte[] valueArray = cell.getValueArray();
- v.getMutator().setSafe(rowCount, valueArray, valueOffset, valueLength);
+ int valueOffset = cell.getValueOffset();
+ int valueLength = cell.getValueLength();
+ byte[] valueArray = cell.getValueArray();
+ v.getMutator().setSafe(rowCount, valueArray, valueOffset, valueLength);
+ }
}
}