Repository: orc
Updated Branches:
  refs/heads/branch-1.5 d41e3b89c -> 90250bb02


ORC-116. Add examples of reading and writing ORC files from Java.

Fixes #269

Signed-off-by: Owen O'Malley <[email protected]>


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

Branch: refs/heads/branch-1.5
Commit: 90250bb02da23f6ee3dbd9993ad87799354e56bd
Parents: d41e3b8
Author: Owen O'Malley <[email protected]>
Authored: Tue Dec 6 09:34:55 2016 -0800
Committer: Owen O'Malley <[email protected]>
Committed: Wed May 16 16:55:26 2018 -0700

----------------------------------------------------------------------
 java/core/pom.xml                               |   1 -
 java/examples/pom.xml                           | 116 +++++++++++++++++++
 java/examples/src/assembly/uber.xml             |  33 ++++++
 java/examples/src/findbugs/exclude.xml          |  19 +++
 .../org/apache/orc/examples/AdvancedWriter.java |  98 ++++++++++++++++
 .../org/apache/orc/examples/CoreReader.java     |  68 +++++++++++
 .../org/apache/orc/examples/CoreWriter.java     |  63 ++++++++++
 .../java/org/apache/orc/examples/Driver.java    | 104 +++++++++++++++++
 java/pom.xml                                    |  37 ++++--
 java/shims/pom.xml                              |   6 +
 10 files changed, 534 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/core/pom.xml
----------------------------------------------------------------------
diff --git a/java/core/pom.xml b/java/core/pom.xml
index eead60c..69b89d5 100644
--- a/java/core/pom.xml
+++ b/java/core/pom.xml
@@ -58,7 +58,6 @@
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdfs</artifactId>
-      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.hive</groupId>

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/pom.xml
----------------------------------------------------------------------
diff --git a/java/examples/pom.xml b/java/examples/pom.xml
new file mode 100644
index 0000000..85cf98d
--- /dev/null
+++ b/java/examples/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.orc</groupId>
+    <artifactId>orc</artifactId>
+    <version>1.5.1-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>orc-examples</artifactId>
+  <packaging>jar</packaging>
+  <name>ORC Examples</name>
+  <description>
+
+  </description>
+
+  <dependencies>
+    <!-- intra-project -->
+    <dependency>
+      <groupId>org.apache.orc</groupId>
+      <artifactId>orc-core</artifactId>
+    </dependency>
+
+    <!-- inter-project -->
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
+      <version>${hadoop.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdfs</artifactId>
+      <version>${hadoop.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hive</groupId>
+      <artifactId>hive-storage-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <sourceDirectory>${basedir}/src/java</sourceDirectory>
+    <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
+    <testResources>
+      <testResource>
+        <directory>${basedir}/src/test/resources</directory>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>org.apache.orc.examples.Driver</mainClass>
+            </manifest>
+          </archive>
+          <descriptors>
+            <descriptor>src/assembly/uber.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id> <!-- this is used for inheritance merges -->
+            <phase>package</phase> <!-- bind to the packaging phase -->
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>cmake</id>
+      <build>
+        <directory>${build.dir}/examples</directory>
+      </build>
+    </profile>
+  </profiles>
+</project>

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/src/assembly/uber.xml
----------------------------------------------------------------------
diff --git a/java/examples/src/assembly/uber.xml 
b/java/examples/src/assembly/uber.xml
new file mode 100644
index 0000000..014eab9
--- /dev/null
+++ b/java/examples/src/assembly/uber.xml
@@ -0,0 +1,33 @@
+<!--
+  Licensed 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.
+-->
+<assembly>
+  <id>uber</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <useProjectArtifact>true</useProjectArtifact>
+      <unpack>true</unpack>
+      <scope>runtime</scope>
+    </dependencySet>
+  </dependencySets>
+  <containerDescriptorHandlers>
+    <containerDescriptorHandler>
+      <handlerName>metaInf-services</handlerName>
+    </containerDescriptorHandler>
+  </containerDescriptorHandlers>
+</assembly>

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/src/findbugs/exclude.xml
----------------------------------------------------------------------
diff --git a/java/examples/src/findbugs/exclude.xml 
b/java/examples/src/findbugs/exclude.xml
new file mode 100644
index 0000000..fd215c0
--- /dev/null
+++ b/java/examples/src/findbugs/exclude.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed 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.
+-->
+<FindBugsFilter>
+  <Match>
+    <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2,DM_EXIT"/>
+  </Match>
+</FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/src/java/org/apache/orc/examples/AdvancedWriter.java
----------------------------------------------------------------------
diff --git a/java/examples/src/java/org/apache/orc/examples/AdvancedWriter.java 
b/java/examples/src/java/org/apache/orc/examples/AdvancedWriter.java
new file mode 100644
index 0000000..ced67d3
--- /dev/null
+++ b/java/examples/src/java/org/apache/orc/examples/AdvancedWriter.java
@@ -0,0 +1,98 @@
+/*
+ * 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.orc.examples;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.MapColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+import org.apache.orc.OrcFile;
+import org.apache.orc.TypeDescription;
+import org.apache.orc.Writer;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * This example shows how to write compound data types in ORC.
+ *
+ */
+public class AdvancedWriter {
+  public static void main(Configuration conf, String[] args) throws 
IOException {
+    Path testFilePath = new Path("advanced-example.orc");
+
+    TypeDescription schema =
+        TypeDescription.fromString("struct<first:int," +
+            "second:int,third:map<string,int>>");
+
+    Writer writer =
+        OrcFile.createWriter(testFilePath,
+            OrcFile.writerOptions(conf).setSchema(schema));
+
+    VectorizedRowBatch batch = schema.createRowBatch();
+    LongColumnVector first = (LongColumnVector) batch.cols[0];
+    LongColumnVector second = (LongColumnVector) batch.cols[1];
+
+    //Define map. You need also to cast the key and value vectors
+    MapColumnVector map = (MapColumnVector) batch.cols[2];
+    BytesColumnVector mapKey = (BytesColumnVector) map.keys;
+    LongColumnVector mapValue = (LongColumnVector) map.values;
+
+    // Each map has 5 elements
+    final int MAP_SIZE = 5;
+    final int BATCH_SIZE = batch.getMaxSize();
+
+    // Ensure the map is big enough
+    mapKey.ensureSize(BATCH_SIZE * MAP_SIZE, false);
+    mapValue.ensureSize(BATCH_SIZE * MAP_SIZE, false);
+
+    // add 1500 rows to file
+    for(int r=0; r < 1500; ++r) {
+      int row = batch.size++;
+
+      first.vector[row] = r;
+      second.vector[row] = r * 3;
+
+      map.offsets[row] = map.childCount;
+      map.lengths[row] = MAP_SIZE;
+      map.childCount += MAP_SIZE;
+
+      for (int mapElem = (int) map.offsets[row];
+           mapElem < map.offsets[row] + MAP_SIZE; ++mapElem) {
+        String key = "row " + r + "." + (mapElem - map.offsets[row]);
+        mapKey.setVal(mapElem, key.getBytes(StandardCharsets.UTF_8));
+        mapValue.vector[mapElem] = mapElem;
+      }
+      if (row == BATCH_SIZE - 1) {
+        writer.addRowBatch(batch);
+        batch.reset();
+      }
+    }
+    if (batch.size != 0) {
+      writer.addRowBatch(batch);
+      batch.reset();
+    }
+    writer.close();  }
+
+  public static void main(String[] args) throws IOException {
+    main(new Configuration(), args);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/src/java/org/apache/orc/examples/CoreReader.java
----------------------------------------------------------------------
diff --git a/java/examples/src/java/org/apache/orc/examples/CoreReader.java 
b/java/examples/src/java/org/apache/orc/examples/CoreReader.java
new file mode 100644
index 0000000..7ee5f44
--- /dev/null
+++ b/java/examples/src/java/org/apache/orc/examples/CoreReader.java
@@ -0,0 +1,68 @@
+/*
+ * 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.orc.examples;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+import org.apache.orc.OrcFile;
+import org.apache.orc.Reader;
+import org.apache.orc.RecordReader;
+import org.apache.orc.TypeDescription;
+
+import java.io.IOException;
+
+public class CoreReader {
+  public static void main(Configuration conf, String[] args) throws 
IOException {
+    // Get the information from the file footer
+    Reader reader = OrcFile.createReader(new Path("my-file.orc"),
+                                         OrcFile.readerOptions(conf));
+    System.out.println("File schema: " + reader.getSchema());
+    System.out.println("Row count: " + reader.getNumberOfRows());
+
+    // Pick the schema we want to read using schema evolution
+    TypeDescription readSchema =
+        TypeDescription.fromString("struct<z:int,y:string,x:bigint>");
+    // Read the row data
+    VectorizedRowBatch batch = readSchema.createRowBatch();
+    RecordReader rowIterator = reader.rows(reader.options()
+                                             .schema(readSchema));
+    LongColumnVector z = (LongColumnVector) batch.cols[0];
+    BytesColumnVector y = (BytesColumnVector) batch.cols[1];
+    LongColumnVector x = (LongColumnVector) batch.cols[2];
+    while (rowIterator.nextBatch(batch)) {
+      for(int row=0; row < batch.size; ++row) {
+        int zRow = z.isRepeating ? 0: row;
+        int xRow = x.isRepeating ? 0: row;
+        System.out.println("z: " +
+            (z.noNulls || !z.isNull[zRow] ? z.vector[zRow] : null));
+        System.out.println("y: " + y.toString(row));
+        System.out.println("x: " +
+            (x.noNulls || !x.isNull[xRow] ? x.vector[xRow] : null));
+      }
+    }
+    rowIterator.close();
+  }
+
+  public static void main(String[] args) throws IOException {
+    main(new Configuration(), args);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/src/java/org/apache/orc/examples/CoreWriter.java
----------------------------------------------------------------------
diff --git a/java/examples/src/java/org/apache/orc/examples/CoreWriter.java 
b/java/examples/src/java/org/apache/orc/examples/CoreWriter.java
new file mode 100644
index 0000000..77bb2c0
--- /dev/null
+++ b/java/examples/src/java/org/apache/orc/examples/CoreWriter.java
@@ -0,0 +1,63 @@
+/*
+ * 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.orc.examples;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+import org.apache.orc.OrcFile;
+import org.apache.orc.TypeDescription;
+import org.apache.orc.Writer;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+public class CoreWriter {
+  public static void main(Configuration conf, String[] args) throws 
IOException {
+    TypeDescription schema =
+      TypeDescription.fromString("struct<x:int,y:string>");
+    Writer writer = OrcFile.createWriter(new Path("my-file.orc"),
+                                         OrcFile.writerOptions(conf)
+                                          .setSchema(schema));
+    VectorizedRowBatch batch = schema.createRowBatch();
+    LongColumnVector x = (LongColumnVector) batch.cols[0];
+    BytesColumnVector y = (BytesColumnVector) batch.cols[1];
+    for(int r=0; r < 10000; ++r) {
+      int row = batch.size++;
+      x.vector[row] = r;
+      byte[] buffer = ("Last-" + (r * 3)).getBytes(StandardCharsets.UTF_8);
+      y.setRef(row, buffer, 0, buffer.length);
+      // If the batch is full, write it out and start over.
+      if (batch.size == batch.getMaxSize()) {
+        writer.addRowBatch(batch);
+        batch.reset();
+      }
+    }
+    if (batch.size != 0) {
+      writer.addRowBatch(batch);
+    }
+    writer.close();
+  }
+
+  public static void main(String[] args) throws IOException {
+    main(new Configuration(), args);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/examples/src/java/org/apache/orc/examples/Driver.java
----------------------------------------------------------------------
diff --git a/java/examples/src/java/org/apache/orc/examples/Driver.java 
b/java/examples/src/java/org/apache/orc/examples/Driver.java
new file mode 100644
index 0000000..ca17b35
--- /dev/null
+++ b/java/examples/src/java/org/apache/orc/examples/Driver.java
@@ -0,0 +1,104 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.orc.examples;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.hadoop.conf.Configuration;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Driver program for the java ORC examples.
+ */
+public class Driver {
+
+  @SuppressWarnings("static-access")
+  static Options createOptions() {
+    Options result = new Options();
+
+    result.addOption("h", "help", false, "Print help message");
+    result.addOption("D", "define", true, "Set a configuration property");
+    return result;
+  }
+
+  static class DriverOptions {
+    final CommandLine genericOptions;
+    final String command;
+    final String[] commandArgs;
+
+    DriverOptions(String[] args) throws ParseException {
+      genericOptions = new DefaultParser().parse(createOptions(), args, true);
+      String[] unprocessed = genericOptions.getArgs();
+      if (unprocessed.length == 0) {
+        command = null;
+        commandArgs = new String[0];
+      } else {
+        command = unprocessed[0];
+        if (genericOptions.hasOption('h')) {
+          commandArgs = new String[]{"-h"};
+        } else {
+          commandArgs = new String[unprocessed.length - 1];
+          System.arraycopy(unprocessed, 1, commandArgs, 0, commandArgs.length);
+        }
+      }
+    }
+  }
+
+  public static void main(String[] args) throws Exception {
+    DriverOptions options = new DriverOptions(args);
+
+    if (options.command == null) {
+      System.err.println("ORC Java Examples");
+      System.err.println();
+      System.err.println("usage: java -jar orc-examples-*.jar [--help]" +
+          " [--define X=Y] <command> <args>");
+      System.err.println();
+      System.err.println("Commands:");
+      System.err.println("   write - write a sample ORC file");
+      System.err.println("   read - read a sample ORC file");
+      System.err.println("   write2 - write a sample ORC file with a map");
+      System.err.println();
+      System.err.println("To get more help, provide -h to the command");
+      System.exit(1);
+    }
+    Configuration conf = new Configuration();
+    String[] confSettings = options.genericOptions.getOptionValues("D");
+    if (confSettings != null) {
+      for (String param : confSettings) {
+        String[] parts = param.split("=", 2);
+        conf.set(parts[0], parts[1]);
+      }
+    }
+    if ("read".equals(options.command)) {
+      CoreReader.main(conf, options.commandArgs);
+    } else if ("write".equals(options.command)) {
+      CoreWriter.main(conf, options.commandArgs);
+    } else if ("write2".equals(options.command)) {
+      AdvancedWriter.main(conf, options.commandArgs);
+    } else {
+      System.err.println("Unknown subcommand: " + options.command);
+      System.exit(1);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/pom.xml
----------------------------------------------------------------------
diff --git a/java/pom.xml b/java/pom.xml
index 68166b0..93b1003 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -58,6 +58,7 @@
     <module>core</module>
     <module>mapreduce</module>
     <module>tools</module>
+    <module>examples</module>
   </modules>
 
   <properties>
@@ -324,19 +325,19 @@
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>findbugs-maven-plugin</artifactId>
-         </plugin>
+          </plugin>
           <plugin>
             <groupId>org.apache.rat</groupId>
             <artifactId>apache-rat-plugin</artifactId>
-         </plugin>
-       </plugins>
+          </plugin>
+        </plugins>
       </build>
     </profile>
     <profile>
       <!-- a developer profile to build some benchmarks -->
       <id>benchmark</id>
       <modules>
-       <module>bench</module>
+        <module>bench</module>
       </modules>
     </profile>
   </profiles>
@@ -348,6 +349,16 @@
         <groupId>org.apache.orc</groupId>
         <artifactId>orc-shims</artifactId>
         <version>1.5.1-SNAPSHOT</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-hdfs</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.orc</groupId>
@@ -392,8 +403,8 @@
         <version>3.9</version>
         <exclusions>
           <exclusion>
-           <groupId>commons-beanutils</groupId>
-           <artifactId>commons-beanutils</artifactId>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
           </exclusion>
         </exclusions>
       </dependency>
@@ -418,8 +429,8 @@
         <version>0.10</version>
         <exclusions>
           <exclusion>
-           <groupId>io.airlift</groupId>
-           <artifactId>slice</artifactId>
+            <groupId>io.airlift</groupId>
+            <artifactId>slice</artifactId>
           </exclusion>
         </exclusions>
       </dependency>
@@ -442,8 +453,8 @@
             <artifactId>jersey-json</artifactId>
           </exclusion>
           <exclusion>
-           <groupId>commons-beanutils</groupId>
-           <artifactId>commons-beanutils-core</artifactId>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils-core</artifactId>
           </exclusion>
           <exclusion>
             <groupId>commons-daemon</groupId>
@@ -585,6 +596,12 @@
         <groupId>org.apache.hive</groupId>
         <artifactId>hive-storage-api</artifactId>
         <version>${storage-api.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-hdfs</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.zookeeper</groupId>

http://git-wip-us.apache.org/repos/asf/orc/blob/90250bb0/java/shims/pom.xml
----------------------------------------------------------------------
diff --git a/java/shims/pom.xml b/java/shims/pom.xml
index dfc4572..3348a46 100644
--- a/java/shims/pom.xml
+++ b/java/shims/pom.xml
@@ -40,11 +40,17 @@
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
       <version>${hadoop.version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdfs</artifactId>
       <version>${hadoop.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
 
     <!-- test inter-project -->

Reply via email to