@ Nullable public static String getTableName ( Path rootPath , Path path ) { path = qualified ( rootPath , path ) ; if ( rootPath . equals ( path ) ) { // Path is root, no table return null ; } Path tablePath ; Path parent = path . getParent ( ) ; if ( Objects . equals ( parent , rootPath ) ) { // The path itself represents a table (e.g.; emodb://ci.us/mytable) tablePath = path ; } else if ( parent != null && Objects . equals ( parent . getParent ( ) , rootPath ) ) { // The path is a split (e.g.; emodb://ci.us/mytable/split-id) tablePath = parent ; } else { throw new IllegalArgumentException ( format ( "Path does not represent a table, split, or root (path=%s, root=%s)" , path , rootPath ) ) ; } return decode ( tablePath . getName ( ) ) ; }
Gets the table name from a path or null if the path is the root path .