Return-Path: X-Original-To: apmail-pig-commits-archive@www.apache.org Delivered-To: apmail-pig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0FA911118B for ; Sun, 8 Jun 2014 00:53:44 +0000 (UTC) Received: (qmail 78223 invoked by uid 500); 8 Jun 2014 00:53:44 -0000 Delivered-To: apmail-pig-commits-archive@pig.apache.org Received: (qmail 78182 invoked by uid 500); 8 Jun 2014 00:53:44 -0000 Mailing-List: contact commits-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list commits@pig.apache.org Received: (qmail 78175 invoked by uid 99); 8 Jun 2014 00:53:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jun 2014 00:53:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jun 2014 00:53:43 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 47F4223888E4; Sun, 8 Jun 2014 00:53:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1601191 - in /pig/trunk: CHANGES.txt src/org/apache/pig/builtin/PigStorage.java Date: Sun, 08 Jun 2014 00:53:23 -0000 To: commits@pig.apache.org From: cheolsoo@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140608005323.47F4223888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cheolsoo Date: Sun Jun 8 00:53:22 2014 New Revision: 1601191 URL: http://svn.apache.org/r1601191 Log: PIG-3988: PigStorage: CommandLineParser is not thread safe (tmwoodruff via cheolsoo) Modified: pig/trunk/CHANGES.txt pig/trunk/src/org/apache/pig/builtin/PigStorage.java Modified: pig/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1601191&r1=1601190&r2=1601191&view=diff ============================================================================== --- pig/trunk/CHANGES.txt (original) +++ pig/trunk/CHANGES.txt Sun Jun 8 00:53:22 2014 @@ -32,6 +32,8 @@ OPTIMIZATIONS BUG FIXES +PIG-3988: PigStorage: CommandLineParser is not thread safe (tmwoodruff via cheolsoo) + PIG-2409: Pig show wrong tracking URL for hadoop 2 (lbendig via rohini) PIG-3978: Container reuse does not across PigServer (daijy) Modified: pig/trunk/src/org/apache/pig/builtin/PigStorage.java URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/PigStorage.java?rev=1601191&r1=1601190&r2=1601191&view=diff ============================================================================== --- pig/trunk/src/org/apache/pig/builtin/PigStorage.java (original) +++ pig/trunk/src/org/apache/pig/builtin/PigStorage.java Sun Jun 8 00:53:22 2014 @@ -149,10 +149,6 @@ LoadPushDown, LoadMetadata, StoreMetadat protected ResourceSchema schema; protected LoadCaster caster; - private final CommandLine configuredOptions; - private final Options validOptions = new Options(); - private final static CommandLineParser parser = new GnuParser(); - protected boolean[] mRequiredColumns = null; private boolean mRequiredColumnsInitialized = false; @@ -163,14 +159,21 @@ LoadPushDown, LoadMetadata, StoreMetadat private static final String TAG_SOURCE_PATH = "tagPath"; private Path sourcePath = null; - private void populateValidOptions() { + private Options populateValidOptions() { + Options validOptions = new Options(); validOptions.addOption("schema", false, "Loads / Stores the schema of the relation using a hidden JSON file."); validOptions.addOption("noschema", false, "Disable attempting to load data schema from the filesystem."); validOptions.addOption(TAG_SOURCE_FILE, false, "Appends input source file name to beginning of each tuple."); validOptions.addOption(TAG_SOURCE_PATH, false, "Appends input source file path to beginning of each tuple."); validOptions.addOption("tagsource", false, "Appends input source file name to beginning of each tuple."); - Option overwrite = OptionBuilder.hasOptionalArgs(1).withArgName("overwrite").withLongOpt("overwrite").withDescription("Overwrites the destination.").create(); - validOptions.addOption(overwrite); + Option overwrite = new Option(null, "Overwrites the destination."); + overwrite.setLongOpt("overwrite"); + overwrite.setOptionalArg(true); + overwrite.setArgs(1); + overwrite.setArgName("overwrite"); + validOptions.addOption(overwrite); + + return validOptions; } public PigStorage() { @@ -204,11 +207,12 @@ LoadPushDown, LoadMetadata, StoreMetadat * @throws ParseException */ public PigStorage(String delimiter, String options) { - populateValidOptions(); fieldDel = StorageUtil.parseFieldDel(delimiter); + Options validOptions = populateValidOptions(); String[] optsArr = options.split(" "); try { - configuredOptions = parser.parse(validOptions, optsArr); + CommandLineParser parser = new GnuParser(); + CommandLine configuredOptions = parser.parse(validOptions, optsArr); isSchemaOn = configuredOptions.hasOption("schema"); if (configuredOptions.hasOption("overwrite")) { String value = configuredOptions.getOptionValue("overwrite");