1313import tech .ydb .core .Status ;
1414import tech .ydb .core .grpc .GrpcTransport ;
1515import tech .ydb .proto .ValueProtos ;
16- import tech .ydb .proto .scheme .SchemeOperationProtos ;
1716import tech .ydb .scheme .SchemeClient ;
17+ import tech .ydb .scheme .description .EntryType ;
1818import tech .ydb .scheme .description .ListDirectoryResult ;
1919import tech .ydb .table .Session ;
2020import tech .ydb .table .description .TableDescription ;
@@ -265,7 +265,7 @@ public List<String> getTableNames(boolean recursive) {
265265
266266 public List <String > getDirectoryNames () {
267267 return listDirectory (tablespace ).stream ()
268- .filter (e -> e .getType () == SchemeOperationProtos . Entry . Type .DIRECTORY )
268+ .filter (e -> e .getType () == EntryType .DIRECTORY )
269269 .map (DirectoryEntity ::getName )
270270 .collect (toList ());
271271 }
@@ -301,9 +301,9 @@ private List<DirectoryEntity> tables(String canonicalPath, String subDir, boolea
301301 String tableDir = YdbPaths .join (canonicalPath , subDir );
302302 List <DirectoryEntity > result = new ArrayList <>();
303303 for (DirectoryEntity entity : listDirectory (tableDir )) {
304- if (recursive && entity .getType () == SchemeOperationProtos . Entry . Type .DIRECTORY ) {
304+ if (recursive && entity .getType () == EntryType .DIRECTORY ) {
305305 result .addAll (tables (canonicalPath , YdbPaths .join (subDir , entity .getName ()), true ));
306- } else if (entity .getType () == SchemeOperationProtos . Entry . Type .TABLE ) {
306+ } else if (entity .getType () == EntryType .TABLE ) {
307307 result .add (entity .withName (YdbPaths .join (subDir , entity .getName ())));
308308 }
309309 }
@@ -422,25 +422,16 @@ protected void copyTable(String source, String destination) {
422422
423423 @ SneakyThrows
424424 private List <DirectoryEntity > listDirectory (String directory ) {
425- ListDirectoryResult result = schemeClient .listDirectory (directory ).join ()
426- .getValue ();
425+ ListDirectoryResult result = schemeClient .listDirectory (directory ).join ().getValue ();
427426
428- List <String > errors = new ArrayList <>();
429- List <DirectoryEntity > tables = result .getChildren ().stream ()
427+ return result .getEntryChildren ().stream ()
430428 .filter (entry -> switch (entry .getType ()) {
431429 case DIRECTORY , TABLE -> true ;
432- case COLUMN_STORE , COORDINATION_NODE -> false ;
433- default -> {
434- errors .add (String .format ("Unexpected entry type (%s:%s) in directory %s" , entry .getType (), entry .getName (), directory ));
435- yield false ;
436- }
430+ // Just ignore directory entries unsupported by YOJ
431+ default -> false ;
437432 })
438433 .map (tEntry -> new DirectoryEntity (tEntry .getType (), tEntry .getName ()))
439- .collect (toList ());
440- if (!errors .isEmpty ()) {
441- throw new IllegalStateException (String .join (String .format ("%n" ), errors ));
442- }
443- return tables ;
434+ .toList ();
444435 }
445436
446437 protected void mkdirs (String dir ) {
@@ -458,7 +449,7 @@ protected boolean hasPath(String path) {
458449
459450 @ Value
460451 private static class DirectoryEntity {
461- SchemeOperationProtos . Entry . Type type ;
452+ EntryType type ;
462453 @ With
463454 String name ;
464455 }
0 commit comments