Skip to content

Commit

Permalink
fix getTableMetadata test
Browse files Browse the repository at this point in the history
  • Loading branch information
cypherean committed Oct 24, 2024
1 parent f1488d8 commit c489750
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ public String getSegmentMetadata(
@ApiParam(value = "Table Name with type", required = true) @PathParam("tableName") String tableName,
@ApiParam(value = "Column name", allowMultiple = true) @QueryParam("columns") @DefaultValue("")
List<String> columns,
@ApiParam(value = "List of segments to fetch metadata for") @QueryParam("segmentsToInclude") @DefaultValue("")
List<String> segmentsToInclude, @Context HttpHeaders headers)
@ApiParam(value = "List of segments to fetch metadata for", allowMultiple = true) @QueryParam("segmentsToInclude")
@DefaultValue("") List<String> segmentsToInclude, @Context HttpHeaders headers)
throws WebApplicationException {
tableName = DatabaseUtils.translateTableName(tableName, headers);
InstanceDataManager instanceDataManager = _serverInstance.getInstanceDataManager();
Expand All @@ -212,6 +212,14 @@ public String getSegmentMetadata(
decodedColumns.add(URIUtils.decode(column));
}

List<String> decodedSegments = new ArrayList<>();
if (segmentsToInclude != null && !segmentsToInclude.isEmpty()) {
for (String segment : segmentsToInclude) {
if (!segment.isEmpty()) {
decodedSegments.add(URIUtils.decode(segment));
}
}
}
boolean allColumns = false;
// For robustness, loop over all columns, if any of the columns is "*", return metadata for all columns.
for (String column : decodedColumns) {
Expand All @@ -222,8 +230,8 @@ public String getSegmentMetadata(
}
Set<String> columnSet = allColumns ? null : new HashSet<>(decodedColumns);
List<SegmentDataManager> segmentDataManagers;
if (segmentsToInclude != null && !segmentsToInclude.isEmpty()) {
segmentDataManagers = tableDataManager.acquireSegments(segmentsToInclude, new ArrayList<>());
if (!decodedSegments.isEmpty()) {
segmentDataManagers = tableDataManager.acquireSegments(decodedSegments, new ArrayList<>());
} else {
segmentDataManagers = tableDataManager.acquireAllSegments();
}
Expand Down

0 comments on commit c489750

Please sign in to comment.