You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by sh...@apache.org on 2022/07/19 13:23:05 UTC

[flink] branch master updated: [hotfix][table-runtime] Avoid NPE for SliceAssigner and improve error message

This is an automated email from the ASF dual-hosted git repository.

shengkai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 180774e9390 [hotfix][table-runtime] Avoid NPE for SliceAssigner and improve error message
180774e9390 is described below

commit 180774e93902862cf3bfa03de00437ae49d743eb
Author: lincoln lee <li...@gmail.com>
AuthorDate: Tue Jul 19 11:31:31 2022 +0800

    [hotfix][table-runtime] Avoid NPE for SliceAssigner and improve error message
    
    This closes #20302
---
 .../flink/table/runtime/operators/window/slicing/SliceAssigners.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/slicing/SliceAssigners.java b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/slicing/SliceAssigners.java
index b568c486018..b5a4463ad99 100644
--- a/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/slicing/SliceAssigners.java
+++ b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/slicing/SliceAssigners.java
@@ -553,6 +553,11 @@ public final class SliceAssigners {
         public final long assignSliceEnd(RowData element, ClockService clock) {
             final long timestamp;
             if (rowtimeIndex >= 0) {
+                if (element.isNullAt(rowtimeIndex)) {
+                    throw new RuntimeException(
+                            "RowTime field should not be null,"
+                                    + " please convert it to a non-null long value.");
+                }
                 // Precision for row timestamp is always 3
                 TimestampData rowTime = element.getTimestamp(rowtimeIndex, 3);
                 timestamp = toUtcTimestampMills(rowTime.getMillisecond(), shiftTimeZone);