Skip to content

Commit

Permalink
fix json compat layer to not rewrite v4 into v5 after segment merging (
Browse files Browse the repository at this point in the history
  • Loading branch information
clintropolis authored and ektravel committed Oct 16, 2023
1 parent 7f51cf5 commit eeb28bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import org.apache.druid.jackson.DefaultObjectMapper;
import org.apache.druid.java.util.common.ISE;
import org.apache.druid.java.util.common.guava.Comparators;
import org.apache.druid.segment.AutoTypeColumnSchema;
import org.apache.druid.segment.DimensionHandler;
import org.apache.druid.segment.NestedCommonFormatColumnHandler;
import org.apache.druid.segment.NestedDataColumnHandlerV4;
import org.apache.druid.segment.NestedDataColumnSchema;
import org.apache.druid.segment.column.ColumnBuilder;
import org.apache.druid.segment.column.ColumnCapabilities;
import org.apache.druid.segment.column.ColumnCapabilitiesImpl;
Expand Down Expand Up @@ -168,13 +168,13 @@ public ColumnType getLogicalType()
@Override
public DimensionHandler getColumnHandler(String columnName)
{
return new NestedCommonFormatColumnHandler(columnName);
return new NestedDataColumnHandlerV4(columnName);
}

@Override
public DimensionSchema getColumnSchema(String columnName)
{
return new AutoTypeColumnSchema(columnName);
return new NestedDataColumnSchema(columnName, 4);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
import org.apache.druid.segment.DimensionSelector;
import org.apache.druid.segment.IndexSpec;
import org.apache.druid.segment.IndexableAdapter;
import org.apache.druid.segment.NestedDataColumnHandlerV4;
import org.apache.druid.segment.NestedDataColumnIndexerV4;
import org.apache.druid.segment.NestedDataColumnSchema;
import org.apache.druid.segment.ObjectColumnSelector;
import org.apache.druid.segment.QueryableIndex;
import org.apache.druid.segment.SimpleAscendingOffset;
Expand Down Expand Up @@ -226,6 +228,9 @@ public void testBasicFunctionality() throws IOException
final ColumnCapabilities capabilities = holder.getCapabilities();
Assert.assertEquals(ColumnType.NESTED_DATA, capabilities.toColumnType());
Assert.assertTrue(holder.getColumnFormat() instanceof NestedDataComplexTypeSerde.NestedColumnFormatV4);
Assert.assertTrue(holder.getColumnFormat().getColumnHandler("test") instanceof NestedDataColumnHandlerV4);
NestedDataColumnSchema schema = (NestedDataColumnSchema) holder.getColumnFormat().getColumnSchema("test");
Assert.assertEquals(4, schema.getFormatVersion());
try (NestedDataComplexColumn column = (NestedDataComplexColumn) holder.getColumn()) {
smokeTest(column);
}
Expand Down

0 comments on commit eeb28bb

Please sign in to comment.