Fix UnknownComplexTypeColumn#makeVectorObjectSelector. Add a warning … (#10123)

* Fix UnknownComplexTypeColumn#makeVectorObjectSelector. Add a warning message to indicate failure in deserializing.
This commit is contained in:
Samarth Jain 2020-07-01 20:06:23 -07:00 committed by GitHub
parent c5540f46ed
commit e2c5bcc22d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 18 deletions

View File

@ -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);
}
}

View File

@ -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;
}