From 2fd3e9e8e58256c9409bd0459267ef75871ada3c Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Thu, 14 May 2015 21:35:49 -0500 Subject: [PATCH] return size = 0 in ColumnAnalysis if its unknown that is if complex agg did not implement inputSizeFn() so that segment metadata query shows atleast some information. also instead of COMPLEX, return type of data stored. --- docs/content/SegmentMetadataQuery.md | 2 +- .../main/java/io/druid/query/metadata/SegmentAnalyzer.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/SegmentMetadataQuery.md b/docs/content/SegmentMetadataQuery.md index d31e5697fef..2fafda3835a 100644 --- a/docs/content/SegmentMetadataQuery.md +++ b/docs/content/SegmentMetadataQuery.md @@ -47,7 +47,7 @@ The format of the result is: ``` Dimension columns will have type `STRING`. -Metric columns will have type `FLOAT`. +Metric columns will have type `FLOAT` or `LONG` or name of the underlying complex type such as `hyperUnique` in case of COMPLEX metric. Timestamp column will have type `LONG`. Only columns which are dimensions (ie, have type `STRING`) will have any cardinality. Rest of the columns (timestamp and metric columns) will show cardinality as `null`. diff --git a/processing/src/main/java/io/druid/query/metadata/SegmentAnalyzer.java b/processing/src/main/java/io/druid/query/metadata/SegmentAnalyzer.java index d9c3145ebf3..e9f70d3b7e6 100644 --- a/processing/src/main/java/io/druid/query/metadata/SegmentAnalyzer.java +++ b/processing/src/main/java/io/druid/query/metadata/SegmentAnalyzer.java @@ -143,7 +143,7 @@ public class SegmentAnalyzer final Function inputSizeFn = serde.inputSizeFn(); if (inputSizeFn == null) { - return ColumnAnalysis.error("noSizeFn"); + return new ColumnAnalysis(typeName, 0, null, null); } final int length = column.getLength(); @@ -152,6 +152,6 @@ public class SegmentAnalyzer size += inputSizeFn.apply(complexColumn.getRowValue(i)); } - return new ColumnAnalysis(capabilities.getType().name(), size, null, null); + return new ColumnAnalysis(typeName, size, null, null); } }