You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@parquet.apache.org by bl...@apache.org on 2015/04/07 18:43:59 UTC
incubator-parquet-mr git commit: PARQUET-242: Fix
AvroReadSupport.setAvroDataSupplier.
Repository: incubator-parquet-mr
Updated Branches:
refs/heads/master ff7a48631 -> 4950ad86a
PARQUET-242: Fix AvroReadSupport.setAvroDataSupplier.
This should use the supplier class's name, rather than its toString
representation or else loading the class doesn't work.
Author: Ryan Blue <bl...@apache.org>
Closes #161 from rdblue/PARQUET-242-fix-avro-data-supplier and squashes the following commits:
ff5b7f8 [Ryan Blue] PARQUET-242: Add Avro data supplier test.
87a488b [Ryan Blue] PARQUET-242: Fix AvroReadSupport.setAvroDataSupplier.
Project: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/commit/4950ad86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/tree/4950ad86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/diff/4950ad86
Branch: refs/heads/master
Commit: 4950ad86a16e63fa26d51cd709e39666008c5fbc
Parents: ff7a486
Author: Ryan Blue <bl...@apache.org>
Authored: Tue Apr 7 09:43:55 2015 -0700
Committer: Ryan Blue <bl...@apache.org>
Committed: Tue Apr 7 09:43:55 2015 -0700
----------------------------------------------------------------------
.../main/java/parquet/avro/AvroReadSupport.java | 2 +-
.../java/parquet/avro/TestAvroDataSupplier.java | 43 ++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/4950ad86/parquet-avro/src/main/java/parquet/avro/AvroReadSupport.java
----------------------------------------------------------------------
diff --git a/parquet-avro/src/main/java/parquet/avro/AvroReadSupport.java b/parquet-avro/src/main/java/parquet/avro/AvroReadSupport.java
index 9df3363..e72d691 100644
--- a/parquet-avro/src/main/java/parquet/avro/AvroReadSupport.java
+++ b/parquet-avro/src/main/java/parquet/avro/AvroReadSupport.java
@@ -61,7 +61,7 @@ public class AvroReadSupport<T extends IndexedRecord> extends ReadSupport<T> {
public static void setAvroDataSupplier(Configuration configuration,
Class<? extends AvroDataSupplier> clazz) {
- configuration.set(AVRO_DATA_SUPPLIER, clazz.toString());
+ configuration.set(AVRO_DATA_SUPPLIER, clazz.getName());
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/4950ad86/parquet-avro/src/test/java/parquet/avro/TestAvroDataSupplier.java
----------------------------------------------------------------------
diff --git a/parquet-avro/src/test/java/parquet/avro/TestAvroDataSupplier.java b/parquet-avro/src/test/java/parquet/avro/TestAvroDataSupplier.java
new file mode 100644
index 0000000..c01def9
--- /dev/null
+++ b/parquet-avro/src/test/java/parquet/avro/TestAvroDataSupplier.java
@@ -0,0 +1,43 @@
+/**
+ * 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 parquet.avro;
+
+import org.apache.avro.generic.GenericData;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestAvroDataSupplier {
+
+ public static class GenericDataSupplier implements AvroDataSupplier {
+ @Override
+ public GenericData get() {
+ return GenericData.get();
+ }
+ }
+
+ @Test
+ public void testSetSupplierMethod() {
+ Configuration conf = new Configuration(false);
+ AvroReadSupport.setAvroDataSupplier(conf, GenericDataSupplier.class);
+ Assert.assertEquals("Should contain the class name",
+ "parquet.avro.TestAvroDataSupplier$GenericDataSupplier",
+ conf.get(AvroReadSupport.AVRO_DATA_SUPPLIER));
+ }
+}