Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AABA411529 for ; Tue, 26 Aug 2014 07:28:59 +0000 (UTC) Received: (qmail 51142 invoked by uid 500); 26 Aug 2014 07:28:59 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 51072 invoked by uid 500); 26 Aug 2014 07:28:59 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 51001 invoked by uid 500); 26 Aug 2014 07:28:59 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 50982 invoked by uid 99); 26 Aug 2014 07:28:59 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Aug 2014 07:28:59 +0000 Date: Tue, 26 Aug 2014 07:28:59 +0000 (UTC) From: "Navis (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-7853) Make OrcNewInputFormat return row number as a key MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-7853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Navis updated HIVE-7853: ------------------------ Attachment: HIVE-7853.1.patch.txt Looks reasonable to me. > Make OrcNewInputFormat return row number as a key > ------------------------------------------------- > > Key: HIVE-7853 > URL: https://issues.apache.org/jira/browse/HIVE-7853 > Project: Hive > Issue Type: Bug > Components: File Formats > Affects Versions: 0.13.1 > Environment: all > Reporter: john > Labels: Orc > Attachments: HIVE-7853.1.patch.txt > > Original Estimate: 24h > Remaining Estimate: 24h > > Key is null in map when OrcNewInputFormat is used as Input Format Class > When using OrcNewInputFormat as input format class for my map reduce job, I find its key is always null in my map method. This gives me no way to get row number in my map method. If you compare RCFileInputFormat (for RC file), its key in map method returns the row number so I know which row I am processing. > Is there any workaround for me to get the row number from my map method? Of course, I can count the row number by myself. But that has two problems: #1 I have to assume the row is coming in the order; #2 I will get duplicated (and wrong) row numbers if a big input file causes multiple file splits (which will trigger my map method multiple times in different data nodes). At this point, I am really seeking a better way to get row number for each processed row in map method. > Here is what I have in my map logs: > [2014-08-06 09:39:25 DEBUG com.xxxx.hadoop.orcfile.OrcFileMap]: Mapper Input Key: (null) > [2014-08-06 09:39:25 DEBUG com.xxxx.hadoop.orcfile.OrcFileMap]: Mapper Input Value: {Q81510000, T99760000, 699760000, 81567560000, 9667981610000, 978989898980000, Laura, Lauraxxx@gmail.com} > My map method is: > protected void map(Object key, Writable value, Context context) > throws IOException, InterruptedException { > logger.debug("Mapper Input Key: " + key); > logger.debug("Mapper Input Value: " + value.toString()); > ..... > } > The fix should be: add following statement in nextKeyValue() method and pass the result all the way up to the map() method as its key: > reader.getRowNumber(); -- This message was sent by Atlassian JIRA (v6.2#6252)