2626import static org .neo4j .shell .prettyprint .OutputFormatter .NEWLINE ;
2727import static org .neo4j .shell .prettyprint .OutputFormatter .repeat ;
2828
29- class TablePlanFormatter {
29+ public class TablePlanFormatter {
3030
3131 private static final String UNNAMED_PATTERN_STRING = " (UNNAMED|FRESHID|AGGREGATION|NODE|REL)(\\ d+)" ;
3232 private static final Pattern UNNAMED_PATTERN = Pattern .compile (UNNAMED_PATTERN_STRING );
@@ -37,9 +37,9 @@ class TablePlanFormatter {
3737 private static final String PAGE_CACHE = "Cache H/M" ;
3838 private static final String TIME = "Time (ms)" ;
3939 private static final String ORDER = "Ordered by" ;
40- private static final String IDENTIFIERS = "Identifiers" ;
40+ public static final String IDENTIFIERS = "Identifiers" ;
4141 private static final String OTHER = "Other" ;
42- private static final String DETAILS = "Details" ;
42+ public static final String DETAILS = "Details" ;
4343 private static final String SEPARATOR = ", " ;
4444 private static final Pattern DEDUP_PATTERN = Pattern .compile ("\\ s*(\\ S+)@\\ d+" );
4545 public static final int MAX_DETAILS_COLUMN_WIDTH = 100 ;
@@ -80,7 +80,8 @@ String formatPlan(@Nonnull Plan plan) {
8080 Map <String , Integer > columns = new HashMap <>();
8181 List <Line > lines = accumulate (plan , new Root (), columns );
8282
83- List <String > headers = HEADERS .stream ().filter (columns ::containsKey ).collect (Collectors .toList ());
83+ // Remove Identifiers column if we have a Details column
84+ List <String > headers = HEADERS .stream ().filter (header -> columns .containsKey (header ) && !(header .equals (IDENTIFIERS ) && columns .containsKey (DETAILS ))).collect (Collectors .toList ());
8485
8586 StringBuilder result = new StringBuilder ((2 + NEWLINE .length () + headers .stream ().mapToInt (h -> width (h , columns )).sum ()) * (lines .size () * 2 + 3 ));
8687
0 commit comments