Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/content/querying/segmentmetadataquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Segment metadata queries return per segment information about:

* Cardinality of all columns in the segment
* Estimated byte size for the segment columns if they were stored in a flat format
* Number of rows stored inside the segment
* Interval the segment covers
* Column type of all the columns in the segment
* Estimated total segment byte size in if it was stored in a flat format
Expand Down Expand Up @@ -43,7 +44,8 @@ The format of the result is:
"dim2" : { "type" : "STRING", "size" : 100000, "cardinality" : 1504 },
"metric1" : { "type" : "FLOAT", "size" : 100000, "cardinality" : null }
},
"size" : 300000
"size" : 300000,
"numRows" : 5000000
} ]
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ public SegmentAnalysis apply(SegmentAnalysis arg1, SegmentAnalysis arg2)
columns.put(columnName, rightColumns.get(columnName));
}

return new SegmentAnalysis("merged", newIntervals, columns, arg1.getSize() + arg2.getSize());
return new SegmentAnalysis(
"merged",
newIntervals,
columns,
arg1.getSize() + arg2.getSize(),
arg1.getNumRows() + arg2.getNumRows()
);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public Sequence<SegmentAnalysis> run(Query<SegmentAnalysis> inQ, Map<String, Obj
segment.getIdentifier(),
Arrays.asList(segment.getDataInterval()),
columns,
totalSize
totalSize,
numRows
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,23 @@ public class SegmentAnalysis
private final List<Interval> interval;
private final Map<String, ColumnAnalysis> columns;
private final long size;
private final int numRows;

@JsonCreator
public SegmentAnalysis(
@JsonProperty("id") String id,
@JsonProperty("intervals") List<Interval> interval,
@JsonProperty("columns") Map<String, ColumnAnalysis> columns,
@JsonProperty("size") long size
@JsonProperty("size") long size,
@JsonProperty("numRows") int numRows

)
{
this.id = id;
this.interval = interval;
this.columns = columns;
this.size = size;
this.numRows = numRows;
}

@JsonProperty
Expand All @@ -70,13 +73,20 @@ public long getSize()
return size;
}

@JsonProperty
public int getNumRows()
{
return numRows;
}

public String toDetailedString()
{
return "SegmentAnalysis{" +
"id='" + id + '\'' +
", interval=" + interval +
", columns=" + columns +
", size=" + size +
", numRows=" + numRows +
'}';
}

Expand All @@ -87,6 +97,7 @@ public String toString()
"id='" + id + '\'' +
", interval=" + interval +
", size=" + size +
", numRows=" + numRows +
'}';
}

Expand All @@ -105,6 +116,11 @@ public boolean equals(Object o)
if (size != that.size) {
return false;
}

if (numRows != that.numRows) {
return false;
}

if (id != null ? !id.equals(that.id) : that.id != null) {
return false;
}
Expand All @@ -122,6 +138,7 @@ public int hashCode()
result = 31 * result + (interval != null ? interval.hashCode() : 0);
result = 31 * result + (columns != null ? columns.hashCode() : 0);
result = 31 * result + (int) (size ^ (size >>> 32));
result = 31 * result + (int) (numRows ^ (numRows >>> 32));
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void testCacheStrategy() throws Exception
1,
null
)
), 71982
), 71982,
100
);

Object preparedValue = strategy.prepareForCache().apply(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public SegmentMetadataQueryTest()
1,
null
)
), 71982
), 71982,
1209
);
}

Expand Down