From e0d9458144e68411f1dd62afb91efd1e1ef92cc5 Mon Sep 17 00:00:00 2001 From: Paul Lam Date: Wed, 5 Jan 2022 03:06:12 +0800 Subject: [PATCH] [KYUUBI #1679] Remove invalid column and field number check ### _Why are the changes needed?_ ResultSet checks if the column number of data matches the one in metadata by calling iterator.next() to get a sample row, which would make the first row missing in the final result. The bug didn't appear in the tests, because the condition is wrong. Fixed by c0e9072a4c3383562b0fe1938e3bfa1947376754. ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [X] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #1680 from link3280/bugfix/flink_invliad_resultset. Closes #1679 238809d0 [Paul Lin] Fix first row missing in ResultSet c0e9072a [Paul Lam] Fix ArrayIndexOutOfBoundsException in ResultSet Lead-authored-by: Paul Lam Co-authored-by: Paul Lin Signed-off-by: yanghua --- .../org/apache/kyuubi/engine/flink/result/ResultSet.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/externals/kyuubi-flink-sql-engine/src/main/java/org/apache/kyuubi/engine/flink/result/ResultSet.java b/externals/kyuubi-flink-sql-engine/src/main/java/org/apache/kyuubi/engine/flink/result/ResultSet.java index 10fc35ebf..33dd8c29e 100644 --- a/externals/kyuubi-flink-sql-engine/src/main/java/org/apache/kyuubi/engine/flink/result/ResultSet.java +++ b/externals/kyuubi-flink-sql-engine/src/main/java/org/apache/kyuubi/engine/flink/result/ResultSet.java @@ -53,11 +53,6 @@ public class ResultSet { this.resultKind = Preconditions.checkNotNull(resultKind, "resultKind must not be null"); this.columns = Preconditions.checkNotNull(columns, "columns must not be null"); this.data = Preconditions.checkNotNull(data, "data must not be null"); - if (!data.hasNext()) { - Preconditions.checkArgument( - columns.size() == data.next().getArity(), - "the size of columns and the number of fields in the row should be equal"); - } this.changeFlags = changeFlags; if (changeFlags != null) { Preconditions.checkArgument(