Copilot commented on code in PR #16683:
URL: https://github.com/apache/pinot/pull/16683#discussion_r2298591099


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java:
##########
@@ -361,7 +361,17 @@ public int[][] transformToIntValuesMV(ValueBlock 
valueBlock) {
       int numValues = result.size();
       int[] values = new int[numValues];
       for (int j = 0; j < numValues; j++) {
-        values[j] = result.get(j);
+        Integer value = result.get(j);
+        if (value == null) {
+          if (_defaultValue != null) {
+            value = ((Number) _defaultValue).intValue();
+          } else {
+            throw new IllegalArgumentException(
+                "At least one of the resolved JSON arrays include nulls, which 
is not supported in Pinot. "
+                    + "Consider setting a default value as the forth argument 
of jsonextractscalar.");

Review Comment:
   The word 'forth' should be 'fourth' in the error message.
   ```suggestion
                       + "Consider setting a default value as the fourth 
argument of jsonextractscalar.");
   ```



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java:
##########
@@ -411,7 +431,17 @@ public float[][] transformToFloatValuesMV(ValueBlock 
valueBlock) {
       int numValues = result.size();
       float[] values = new float[numValues];
       for (int j = 0; j < numValues; j++) {
-        values[j] = result.get(j);
+        Float value = result.get(j);
+        if (value == null) {
+          if (_defaultValue != null) {
+            value = ((Number) _defaultValue).floatValue();
+          } else {
+            throw new IllegalArgumentException(
+                "At least one of the resolved JSON arrays include nulls, which 
is not supported in Pinot. "
+                    + "Consider setting a default value as the forth argument 
of jsonextractscalar.");

Review Comment:
   The word 'forth' should be 'fourth' in the error message.
   ```suggestion
                       + "Consider setting a default value as the fourth 
argument of jsonextractscalar.");
   ```



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java:
##########
@@ -386,7 +396,17 @@ public long[][] transformToLongValuesMV(ValueBlock 
valueBlock) {
       int numValues = result.size();
       long[] values = new long[numValues];
       for (int j = 0; j < numValues; j++) {
-        values[j] = result.get(j);
+        Long value = result.get(j);
+        if (value == null) {
+          if (_defaultValue != null) {
+            value = ((Number) _defaultValue).longValue();
+          } else {
+            throw new IllegalArgumentException(
+                "At least one of the resolved JSON arrays include nulls, which 
is not supported in Pinot. "
+                    + "Consider setting a default value as the forth argument 
of jsonextractscalar.");

Review Comment:
   The word 'forth' should be 'fourth' in the error message.
   ```suggestion
                       + "Consider setting a default value as the fourth 
argument of jsonextractscalar.");
   ```



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java:
##########
@@ -436,7 +466,17 @@ public double[][] transformToDoubleValuesMV(ValueBlock 
valueBlock) {
       int numValues = result.size();
       double[] values = new double[numValues];
       for (int j = 0; j < numValues; j++) {
-        values[j] = result.get(j);
+        Double value = result.get(j);
+        if (value == null) {
+          if (_defaultValue != null) {
+            value = ((Number) _defaultValue).doubleValue();
+          } else {
+            throw new IllegalArgumentException(
+                "At least one of the resolved JSON arrays include nulls, which 
is not supported in Pinot. "
+                    + "Consider setting a default value as the forth argument 
of jsonextractscalar.");

Review Comment:
   The word 'forth' should be 'fourth' in the error message.
   ```suggestion
                       + "Consider setting a default value as the fourth 
argument of jsonextractscalar.");
   ```



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java:
##########
@@ -461,7 +501,17 @@ public String[][] transformToStringValuesMV(ValueBlock 
valueBlock) {
       int numValues = result.size();
       String[] values = new String[numValues];
       for (int j = 0; j < numValues; j++) {
-        values[j] = result.get(j);
+        String value = result.get(j);
+        if (value == null) {
+          if (_defaultValue != null) {
+            value = _defaultValue.toString();
+          } else {
+            throw new IllegalArgumentException(
+                "At least one of the resolved JSON arrays include nulls, which 
is not supported in Pinot. "
+                    + "Consider setting a default value as the forth argument 
of jsonextractscalar.");

Review Comment:
   The word 'forth' should be 'fourth' in the error message.
   ```suggestion
                       + "Consider setting a default value as the fourth 
argument of jsonextractscalar.");
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to