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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9340708c4f8 Throw `IndexOutOfBound` exception in row implementation.
9340708c4f8 is described below

commit 9340708c4f812d8acd3e108d870edcae48b1a170
Author: Zhihao Shen <[email protected]>
AuthorDate: Fri Jun 7 17:07:24 2024 +0800

    Throw `IndexOutOfBound` exception in row implementation.
---
 .../org/apache/iotdb/udf/api/utils/RowImpl.java     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git 
a/iotdb-api/udf-api/src/main/java/org/apache/iotdb/udf/api/utils/RowImpl.java 
b/iotdb-api/udf-api/src/main/java/org/apache/iotdb/udf/api/utils/RowImpl.java
index e0ca3a53fc6..d7d3a884869 100644
--- 
a/iotdb-api/udf-api/src/main/java/org/apache/iotdb/udf/api/utils/RowImpl.java
+++ 
b/iotdb-api/udf-api/src/main/java/org/apache/iotdb/udf/api/utils/RowImpl.java
@@ -45,36 +45,57 @@ public class RowImpl implements Row {
 
   @Override
   public int getInt(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return (int) rowRecord[columnIndex];
   }
 
   @Override
   public long getLong(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return (long) rowRecord[columnIndex];
   }
 
   @Override
   public float getFloat(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return (float) rowRecord[columnIndex];
   }
 
   @Override
   public double getDouble(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return (double) rowRecord[columnIndex];
   }
 
   @Override
   public boolean getBoolean(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return (boolean) rowRecord[columnIndex];
   }
 
   @Override
   public Binary getBinary(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return transformToUDFBinary((org.apache.tsfile.utils.Binary) 
rowRecord[columnIndex]);
   }
 
   @Override
   public String getString(int columnIndex) {
+    if (columnIndex >= size()) {
+      throw new IndexOutOfBoundsException("Index out of bound error!");
+    }
     return rowRecord[columnIndex].toString();
   }
 

Reply via email to