From issues-return-152302-archive-asf-public=cust-asf.ponee.io@flink.apache.org Tue Feb 13 14:05:11 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 90BA118067B for ; Tue, 13 Feb 2018 14:05:11 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7F86D160C65; Tue, 13 Feb 2018 13:05:11 +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 C98D2160C53 for ; Tue, 13 Feb 2018 14:05:10 +0100 (CET) Received: (qmail 97950 invoked by uid 500); 13 Feb 2018 13:05:09 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 97936 invoked by uid 99); 13 Feb 2018 13:05:09 -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, 13 Feb 2018 13:05:09 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9E501E00A4; Tue, 13 Feb 2018 13:05:09 +0000 (UTC) From: zentol To: issues@flink.apache.org Reply-To: issues@flink.apache.org References: In-Reply-To: Subject: [GitHub] flink pull request #5415: [FLINK-3655] [core] Support multiple paths in File... Content-Type: text/plain Message-Id: <20180213130509.9E501E00A4@git1-us-west.apache.org> Date: Tue, 13 Feb 2018 13:05:09 +0000 (UTC) Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/5415#discussion_r167850694 --- Diff: flink-core/src/test/java/org/apache/flink/api/common/io/DelimitedInputFormatTest.java --- @@ -428,6 +431,78 @@ public void testDelimiterOnBufferBoundary() throws IOException { format.close(); } + // -- Statistics --// + + @Test + public void testGetStatistics() throws IOException { + final String myString = "my mocked line 1\nmy mocked line 2\n"; + final long size = myString.length(); + final Path filePath = createTempFilePath(myString); + + final String myString2 = "my mocked line 1\nmy mocked line 2\nanother mocked line3\n"; + final long size2 = myString2.length(); + final Path filePath2 = createTempFilePath(myString2); + + final long totalSize = size + size2; + + DelimitedInputFormat format = new MyTextInputFormat(); + format.setFilePaths(filePath.toUri().toString(), filePath2.toUri().toString()); + + FileInputFormat.FileBaseStatistics stats = format.getStatistics(null); + assertNotNull(stats); + assertEquals("The file size from the statistics is wrong.", totalSize, stats.getTotalInputSize()); + } + + @Test + public void testGetStatisticsFileDoesNotExist() throws IOException { + DelimitedInputFormat format = new MyTextInputFormat(); + format.setFilePaths("file:///path/does/not/really/exist", "file:///another/path/that/does/not/exist"); + + FileBaseStatistics stats = format.getStatistics(null); + assertNull("The file statistics should be null.", stats); + } + + @Test + public void testGetStatisticsSingleFileWithCachedVersion() throws IOException { + final String myString = "my mocked line 1\nmy mocked line 2\n"; + final Path tempFile = createTempFilePath(myString); + final long size = myString.length(); + final long cachedSize = 10065; --- End diff -- can we rename this to `fakeSize`? ---