From e2c5bcc22d2c175bba51fbb2a9c90303ecdf6f44 Mon Sep 17 00:00:00 2001 From: Samarth Jain Date: Wed, 1 Jul 2020 20:06:23 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20UnknownComplexTypeColumn#makeVectorObject?= =?UTF-8?q?Selector.=20Add=20a=20warning=20=E2=80=A6=20(#10123)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix UnknownComplexTypeColumn#makeVectorObjectSelector. Add a warning message to indicate failure in deserializing. --- .../column/UnknownTypeComplexColumn.java | 19 +------------------ .../segment/serde/ComplexColumnPartSerde.java | 7 +++++++ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/processing/src/main/java/org/apache/druid/segment/column/UnknownTypeComplexColumn.java b/processing/src/main/java/org/apache/druid/segment/column/UnknownTypeComplexColumn.java index 7332a5c3822..ce4db70438e 100644 --- a/processing/src/main/java/org/apache/druid/segment/column/UnknownTypeComplexColumn.java +++ b/processing/src/main/java/org/apache/druid/segment/column/UnknownTypeComplexColumn.java @@ -25,7 +25,6 @@ import org.apache.druid.segment.data.ReadableOffset; import org.apache.druid.segment.vector.NilVectorSelector; import org.apache.druid.segment.vector.ReadableVectorOffset; import org.apache.druid.segment.vector.VectorObjectSelector; -import org.apache.druid.segment.vector.VectorSizeInspector; import javax.annotation.Nullable; @@ -38,22 +37,6 @@ public class UnknownTypeComplexColumn implements ComplexColumn return INSTANCE; } - private static final NilVectorSelector NIL_VECTOR_SELECTOR_INSTANCE = - NilVectorSelector.create(new VectorSizeInspector() - { - @Override - public int getMaxVectorSize() - { - return 0; - } - - @Override - public int getCurrentVectorSize() - { - return 0; - } - }); - @Override public Class getClazz() { @@ -94,6 +77,6 @@ public class UnknownTypeComplexColumn implements ComplexColumn @Override public VectorObjectSelector makeVectorObjectSelector(ReadableVectorOffset offset) { - return NIL_VECTOR_SELECTOR_INSTANCE; + return NilVectorSelector.create(offset); } } diff --git a/processing/src/main/java/org/apache/druid/segment/serde/ComplexColumnPartSerde.java b/processing/src/main/java/org/apache/druid/segment/serde/ComplexColumnPartSerde.java index f10f53baf79..dc0278baaed 100644 --- a/processing/src/main/java/org/apache/druid/segment/serde/ComplexColumnPartSerde.java +++ b/processing/src/main/java/org/apache/druid/segment/serde/ComplexColumnPartSerde.java @@ -21,6 +21,7 @@ package org.apache.druid.segment.serde; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.druid.java.util.common.logger.Logger; import org.apache.druid.segment.GenericColumnSerializer; import javax.annotation.Nullable; @@ -33,11 +34,17 @@ public class ComplexColumnPartSerde implements ColumnPartSerde @Nullable private final ComplexMetricSerde serde; private final Serializer serializer; + private static final Logger log = new Logger(ComplexColumnPartSerde.class); private ComplexColumnPartSerde(String typeName, Serializer serializer) { this.typeName = typeName; this.serde = ComplexMetrics.getSerdeForType(typeName); + if (this.serde == null) { + // Not choosing to fail here since this gets handled as + // an UnknownTypeComplexColumn. See SimpleColumnHolder#getColumn. + log.warn("Unknown complex column of type %s detected", typeName); + } this.serializer = serializer; }