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 A632F200BE4 for ; Wed, 21 Dec 2016 23:50:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A4C37160B26; Wed, 21 Dec 2016 22:50:39 +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 EDF06160B18 for ; Wed, 21 Dec 2016 23:50:38 +0100 (CET) Received: (qmail 65228 invoked by uid 500); 21 Dec 2016 22:50:38 -0000 Mailing-List: contact commits-help@beam.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.incubator.apache.org Delivered-To: mailing list commits@beam.incubator.apache.org Received: (qmail 65208 invoked by uid 99); 21 Dec 2016 22:50:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2016 22:50:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B4313180B1E for ; Wed, 21 Dec 2016 22:50:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id iBHfrr3UIaJX for ; Wed, 21 Dec 2016 22:50:36 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 3198B5F298 for ; Wed, 21 Dec 2016 22:50:36 +0000 (UTC) Received: (qmail 59108 invoked by uid 99); 21 Dec 2016 22:49:36 -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; Wed, 21 Dec 2016 22:49:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B4B0BF16B5; Wed, 21 Dec 2016 22:49:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kenn@apache.org To: commits@beam.incubator.apache.org Date: Wed, 21 Dec 2016 22:50:22 -0000 Message-Id: <87a8b6f030ea434f8ce20a9bfbdce6be@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [48/51] [abbrv] incubator-beam git commit: Use informative Instant formatter in WatermarkHold archived-at: Wed, 21 Dec 2016 22:50:39 -0000 Use informative Instant formatter in WatermarkHold Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/fa4958a6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/fa4958a6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/fa4958a6 Branch: refs/heads/python-sdk Commit: fa4958a6140eb00ceee08b2468f7d88f17538794 Parents: 280a6a8 Author: Kenneth Knowles Authored: Mon Dec 19 20:40:47 2016 -0800 Committer: Kenneth Knowles Committed: Wed Dec 21 13:45:37 2016 -0800 ---------------------------------------------------------------------- .../apache/beam/runners/core/WatermarkHold.java | 4 +++- .../sdk/transforms/windowing/BoundedWindow.java | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fa4958a6/runners/core-java/src/main/java/org/apache/beam/runners/core/WatermarkHold.java ---------------------------------------------------------------------- diff --git a/runners/core-java/src/main/java/org/apache/beam/runners/core/WatermarkHold.java b/runners/core-java/src/main/java/org/apache/beam/runners/core/WatermarkHold.java index 7f1afcc..5e5f44d 100644 --- a/runners/core-java/src/main/java/org/apache/beam/runners/core/WatermarkHold.java +++ b/runners/core-java/src/main/java/org/apache/beam/runners/core/WatermarkHold.java @@ -207,7 +207,9 @@ class WatermarkHold implements Serializable { Instant shifted = windowingStrategy.getOutputTimeFn().assignOutputTime(timestamp, window); checkState(!shifted.isBefore(timestamp), "OutputTimeFn moved element from %s to earlier time %s for window %s", - timestamp, shifted, window); + BoundedWindow.formatTimestamp(timestamp), + BoundedWindow.formatTimestamp(shifted), + window); checkState(timestamp.isAfter(window.maxTimestamp()) || !shifted.isAfter(window.maxTimestamp()), "OutputTimeFn moved element from %s to %s which is beyond end of " http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/fa4958a6/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/BoundedWindow.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/BoundedWindow.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/BoundedWindow.java index 6da2495..74223b5 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/BoundedWindow.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/windowing/BoundedWindow.java @@ -34,11 +34,30 @@ import org.joda.time.Instant; public abstract class BoundedWindow { // The min and max timestamps that won't overflow when they are converted to // usec. + + /** + * The minimum value for any Beam timestamp. Often referred to as "-infinity". + * + *

This value and {@link #TIMESTAMP_MAX_VALUE} are chosen so that their + * microseconds-since-epoch can be safely represented with a {@code long}. + */ public static final Instant TIMESTAMP_MIN_VALUE = new Instant(TimeUnit.MICROSECONDS.toMillis(Long.MIN_VALUE)); + + /** + * The maximum value for any Beam timestamp. Often referred to as "+infinity". + * + *

This value and {@link #TIMESTAMP_MIN_VALUE} are chosen so that their + * microseconds-since-epoch can be safely represented with a {@code long}. + */ public static final Instant TIMESTAMP_MAX_VALUE = new Instant(TimeUnit.MICROSECONDS.toMillis(Long.MAX_VALUE)); + /** + * Formats a {@link Instant} timestamp with additional Beam-specific metadata, such as indicating + * whether the timestamp is the end of the global window or one of the distinguished values {@link + * #TIMESTAMP_MIN_VALUE} or {@link #TIMESTAMP_MIN_VALUE}. + */ public static String formatTimestamp(Instant timestamp) { if (timestamp.equals(TIMESTAMP_MIN_VALUE)) { return timestamp.toString() + " (TIMESTAMP_MIN_VALUE)";