Skip to content

Commit

Permalink
fix typo, simply code
Browse files Browse the repository at this point in the history
  • Loading branch information
orenccl committed Nov 11, 2024
1 parent 01d2d72 commit 4ad6d99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

package org.apache.gravitino.cli.commands;

import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.rel.indexes.Index;

Expand Down Expand Up @@ -66,17 +65,16 @@ public void handle() {

StringBuilder all = new StringBuilder();
for (Index index : indexes) {
// Flatten the two-dimensional array fieldNames to a single dot-separated string
List<String> flattenedFieldNames = new ArrayList<>();
for (String[] fieldHierarchy : index.fieldNames()) {
// Join nested fields (e.g., "a.b.c") for each inner array
flattenedFieldNames.add(String.join(".", fieldHierarchy));
}

String indexName = index.name();
for (String field : flattenedFieldNames) {
all.append(field).append(",").append(indexName).append(System.lineSeparator());
}
// Flatten nested field names into dot-separated strings (e.g., "a.b.c")
Arrays.stream(index.fieldNames())
// Convert nested fields to a single string
.map(nestedFieldName -> String.join(".", nestedFieldName))
.forEach(
fieldName ->
all.append(fieldName)
.append(",")
.append(index.name())
.append(System.lineSeparator()));
}

System.out.print(all);
Expand Down
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ gcli table details --metalake metalake_demo --name catalog_postgres.hr.departmen
gcli table details --metalake metalake_demo --name catalog_postgres.hr.departments --audit
```

### Show table indexex
### Show table indexes

```bash
gcli table details --metalake metalake_demo --name catalog_mysql.db.iceberg_namespace_properties --index
Expand Down

0 comments on commit 4ad6d99

Please sign in to comment.