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 DDE32200C6F for ; Tue, 9 May 2017 15:35:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DC6B6160BB6; Tue, 9 May 2017 13:35:12 +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 2FEAB160BB3 for ; Tue, 9 May 2017 15:35:12 +0200 (CEST) Received: (qmail 16779 invoked by uid 500); 9 May 2017 13:35:11 -0000 Mailing-List: contact commits-help@beam.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.apache.org Delivered-To: mailing list commits@beam.apache.org Received: (qmail 16770 invoked by uid 99); 9 May 2017 13:35:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 May 2017 13:35:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id CF9361A07D1 for ; Tue, 9 May 2017 13:35:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id miaWoNalKVZW for ; Tue, 9 May 2017 13:35:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id B85025F51F for ; Tue, 9 May 2017 13:35:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id E60BBE0D4D for ; Tue, 9 May 2017 13:35:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3660121DF9 for ; Tue, 9 May 2017 13:35:04 +0000 (UTC) Date: Tue, 9 May 2017 13:35:04 +0000 (UTC) From: "Josh Di Fabio (JIRA)" To: commits@beam.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (BEAM-2229) GcsFileSystem attempts to create invalid Metadata MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 09 May 2017 13:35:13 -0000 [ https://issues.apache.org/jira/browse/BEAM-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Di Fabio updated BEAM-2229: -------------------------------- Summary: GcsFileSystem attempts to create invalid Metadata (was: GcsFileSystem can create invalid Metadata) > GcsFileSystem attempts to create invalid Metadata > ------------------------------------------------- > > Key: BEAM-2229 > URL: https://issues.apache.org/jira/browse/BEAM-2229 > Project: Beam > Issue Type: Bug > Components: sdk-java-gcp > Affects Versions: 2.0.0 > Reporter: Josh Di Fabio > Assignee: Daniel Halperin > Priority: Trivial > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > This is the first issue I've raised on Apache's JIRA; if I have made any mistakes in compiling this ticket then I apologise and would welcome any feedback. > When matching a path spec, {{GcsFileSystem.toMetadata()}} will sometimes attempt to build an instance of {{org.apache.beam.sdk.io.fs.MatchResult.Metadata}} without first setting {{sizeBytes}}\[1\]. This always results in an error in the autovalue-generated builder for {{MatchResult.Metadata}} as {{sizeBytes}} is a required field\[2\]. > I propose that {{GcsFileSystem}} set {{sizeBytes}} to {{0}} when there is no size returned by GCS, which will presumably happen when the path spec refers either to a directory, or to a non-existent file. {{GcsFileSystem.toMetadata()}} could be updated as follows: > *Before* > {code:java} > if (size != null) { > ret.setSizeBytes(size.longValue()); > } > {code} > *After* > {code:java} > if (size != null) { > ret.setSizeBytes(size.longValue()); > } else { > ret.setSizeBytes(0); > } > {code} > \[1\] https://github.com/apache/beam/blob/5bfd3e049c0ca0744165b0243a645e8e427032d5/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/storage/GcsFileSystem.java#L240-L242 > \[2\] https://gist.github.com/joshdifabio/fe543b97e02e7ddac8edb73be38deb06#file-autovalue_matchresult_metadata-java-L102-L110 -- This message was sent by Atlassian JIRA (v6.3.15#6346)