This is an automated email from the ASF dual-hosted git repository.
asdf2014 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 5cecf6ce8f fix issue with segment metadata cache and complex types
when doing out of order upgrades from 0.22 (#14948)
5cecf6ce8f is described below
commit 5cecf6ce8f5cf027429ed4f0c9f88f099d6aa470
Author: Clint Wylie <[email protected]>
AuthorDate: Mon Sep 11 19:54:35 2023 -0700
fix issue with segment metadata cache and complex types when doing out of
order upgrades from 0.22 (#14948)
---
.../sql/calcite/schema/SegmentMetadataCache.java | 3 +++
.../sql/calcite/schema/SegmentMetadataCacheTest.java | 20 ++++++++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git
a/sql/src/main/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCache.java
b/sql/src/main/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCache.java
index 381f0ff4af..cd52fc7e57 100644
---
a/sql/src/main/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCache.java
+++
b/sql/src/main/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCache.java
@@ -961,6 +961,9 @@ public class SegmentMetadataCache
// likelyhood of upgrading from some version lower than 0.23 is low
try {
valueType = ColumnType.fromString(entry.getValue().getType());
+ if (valueType == null) {
+ valueType = ColumnType.ofComplex(entry.getValue().getType());
+ }
}
catch (IllegalArgumentException ignored) {
valueType = ColumnType.UNKNOWN_COMPLEX;
diff --git
a/sql/src/test/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCacheTest.java
b/sql/src/test/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCacheTest.java
index b541490548..5a52ab6738 100644
---
a/sql/src/test/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCacheTest.java
+++
b/sql/src/test/java/org/apache/druid/sql/calcite/schema/SegmentMetadataCacheTest.java
@@ -1417,9 +1417,21 @@ public class SegmentMetadataCacheTest extends
SegmentMetadataCacheCommon
false,
true,
1234,
- 26,
- "a",
- "z",
+ null,
+ null,
+ null,
+ null
+ ),
+ "distinct",
+ new ColumnAnalysis(
+ null,
+ "hyperUnique",
+ false,
+ true,
+ 1234,
+ null,
+ null,
+ null,
null
)
)
@@ -1433,7 +1445,7 @@ public class SegmentMetadataCacheTest extends
SegmentMetadataCacheCommon
)
);
Assert.assertEquals(
- RowSignature.builder().add("a", ColumnType.STRING).add("count",
ColumnType.LONG).build(),
+ RowSignature.builder().add("a", ColumnType.STRING).add("count",
ColumnType.LONG).add("distinct", ColumnType.ofComplex("hyperUnique")).build(),
signature
);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]