Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D36A3200B13 for ; Wed, 1 Jun 2016 00:18:45 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D20A3160A46; Tue, 31 May 2016 22:18:45 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 27C40160A44 for ; Wed, 1 Jun 2016 00:18:45 +0200 (CEST) Received: (qmail 29536 invoked by uid 500); 31 May 2016 22:18:44 -0000 Mailing-List: contact dev-help@orc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@orc.apache.org Delivered-To: mailing list dev@orc.apache.org Received: (qmail 29525 invoked by uid 99); 31 May 2016 22:18:44 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2016 22:18:44 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0C3CEDFB74; Tue, 31 May 2016 22:18:44 +0000 (UTC) From: wagnermarkd To: dev@orc.apache.org Reply-To: dev@orc.apache.org References: In-Reply-To: Subject: [GitHub] orc pull request: ORC-52. Create ORC InputFormat and OutputFormat implementa... Content-Type: text/plain Message-Id: <20160531221844.0C3CEDFB74@git1-us-west.apache.org> Date: Tue, 31 May 2016 22:18:44 +0000 (UTC) archived-at: Tue, 31 May 2016 22:18:46 -0000 Github user wagnermarkd commented on a diff in the pull request: https://github.com/apache/orc/pull/27#discussion_r65273378 --- Diff: java/mapreduce/src/java/org.apache.orc.mapreduce/OrcOutputFormat.java --- @@ -0,0 +1,83 @@ +/** + * 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.mapreduce; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.mapreduce.OutputCommitter; +import org.apache.hadoop.mapreduce.RecordWriter; +import org.apache.hadoop.mapreduce.TaskAttemptContext; +import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; +import org.apache.hadoop.util.ReflectionUtils; +import org.apache.orc.CompressionKind; +import org.apache.orc.OrcConf; +import org.apache.orc.OrcFile; +import org.apache.orc.TypeDescription; +import org.apache.orc.Writer; + +import java.io.IOException; + +/** + * An ORC output format that satisfies the org.apache.hadoop.mapreduce API. + */ +public class OrcOutputFormat + extends FileOutputFormat { + private static final String EXTENSION = ".orc"; + // This is useful for unit tests or local runs where you don't need the + // output committer. + public static final String SKIP_TEMP_DIRECTORY = + "orc.mapreduce.output.skip-temporary-directory"; + + @Override + public RecordWriter + getRecordWriter(TaskAttemptContext taskAttemptContext + ) throws IOException { + Configuration conf = taskAttemptContext.getConfiguration(); + Path filename = getDefaultWorkFile(taskAttemptContext, EXTENSION); + Writer writer = OrcFile.createWriter(filename, + OrcFile.writerOptions(conf) --- End diff -- Same question as reader options: Can we pull all this boiler plate into the writerOptions method? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---