github-advanced-security[bot] commented on code in PR #16620:
URL: https://github.com/apache/druid/pull/16620#discussion_r1643214256
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7464)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -509,7 +516,8 @@
final boolean combining,
final boolean includeTimestamp,
final ColumnSelectorFactory columnSelectorFactory,
- final List<ColumnType> valueTypes
+ final List<ColumnType> valueTypes,
+ final ObjectMapper spillMapper
Review Comment:
## Useless parameter
The parameter 'spillMapper' is never used.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7463)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7465)
##########
processing/src/test/java/org/apache/druid/query/groupby/ComplexGroupByTest.java:
##########
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.query.groupby;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.java.util.common.guava.Sequence;
+import org.apache.druid.java.util.common.guava.Sequences;
+import org.apache.druid.query.QueryContexts;
+import org.apache.druid.query.aggregation.AggregationTestHelper;
+import org.apache.druid.query.aggregation.CountAggregatorFactory;
+import org.apache.druid.query.aggregation.SerializablePairLongString;
+import
org.apache.druid.query.aggregation.SerializablePairLongStringComplexMetricSerde;
+import org.apache.druid.query.dimension.DefaultDimensionSpec;
+import org.apache.druid.segment.RowBasedSegment;
+import org.apache.druid.segment.Segment;
+import org.apache.druid.segment.column.ColumnType;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.timeline.SegmentId;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(Parameterized.class)
+public class ComplexGroupByTest
+{
+
+ private final QueryContexts.Vectorize vectorize;
+ private final AggregationTestHelper helper;
+ private final List<Segment> segments;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
Review Comment:
## Deprecated method or constructor invocation
Invoking [ExpectedException.none](1) should be avoided because it has been
deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7462)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7468)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
+ } else if (objects[i] instanceof Double) {
+ objects[i] = ((Double) objects[i]).floatValue();
+ }
+
+ } else {
+ objects[i] = codec.readValue(jp,
serdeHelpers[i].getComplexClazz());
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7472)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
+ } else if (objects[i] instanceof Double) {
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7469)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
+ } else if (objects[i] instanceof Double) {
+ objects[i] = ((Double) objects[i]).floatValue();
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7470)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
+ } else if (objects[i] instanceof Double) {
+ objects[i] = ((Double) objects[i]).floatValue();
+ }
+
+ } else {
+ objects[i] = codec.readValue(jp,
serdeHelpers[i].getComplexClazz());
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7473)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7467)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7466)
##########
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/RowBasedGrouperHelper.java:
##########
@@ -1371,6 +1363,64 @@
);
}
+ @Override
+ public ObjectMapper decorateObjectMapper(ObjectMapper spillMapper)
+ {
+
+ final JsonDeserializer<RowBasedKey> deserializer = new
JsonDeserializer<RowBasedKey>()
+ {
+ @Override
+ public RowBasedKey deserialize(
+ JsonParser jp,
+ DeserializationContext deserializationContext
+ ) throws IOException
+ {
+ if (!jp.isExpectedStartArrayToken()) {
+ throw DruidException.defensive("expected start token");
+ }
+ jp.nextToken();
+ ObjectCodec codec = jp.getCodec();
+
+ int i = 0;
+ Object[] objects = new Object[serdeHelpers.length];
+ while (jp.currentToken() != JsonToken.END_ARRAY) {
+ if (i > serdeHelpers.length) {
+ throw DruidException.defensive("not enough serde helpers");
+ }
+
+ if (serdeHelpers[i].getComplexClazz() == null) {
+ objects[i] = codec.readValue(jp, Object.class);
+ if (objects[i] instanceof Integer) {
+ objects[i] = ((Integer) objects[i]).longValue();
+ } else if (objects[i] instanceof Double) {
+ objects[i] = ((Double) objects[i]).floatValue();
Review Comment:
## Array index out of bounds
This array access might be out of bounds, as the index might be equal to the
array length.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7471)
--
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]