@@ -419,4 +419,191 @@ public String dump() throws TileDBError {
419419
420420 return tiledb .charpp_value (uri );
421421 }
422+
423+ /**
424+ * Retrieves the number of MBRs from the fragment.
425+ *
426+ * <p>In the case of sparse fragments, this is the number of physical tiles.
427+ *
428+ * <p>Dense fragments do not contain MBRs.
429+ *
430+ * @param fragmentID The index of the fragment of interest.
431+ * @return The number of MBRs.
432+ * @throws TileDBError
433+ */
434+ public long getMBRNum (long fragmentID ) throws TileDBError {
435+ SWIGTYPE_p_unsigned_long_long numFrags = tiledb .new_ullp ();
436+ ctx .handleError (
437+ tiledb .tiledb_fragment_info_get_mbr_num (
438+ ctx .getCtxp (), this .fragmentInfop , fragmentID , numFrags ));
439+ return tiledb .ullp_value (numFrags ).longValue ();
440+ }
441+
442+ /**
443+ * Retrieves the MBR from a given fragment for a given dimension index.
444+ *
445+ * @param fragmentID The index of the fragment of interest.
446+ * @param mid The mbr of the fragment of interest.
447+ * @param dimensionID The dimension index, following the order as it was defined in the domain of
448+ * the array schema.
449+ * @return The MBR.
450+ */
451+ public long [] getMBRFromIndex (long fragmentID , long dimensionID , long mid ) throws TileDBError {
452+ long [] mbr ;
453+ try (NativeArray mbrArray = new NativeArray (ctx , 2 , Long .class )) {
454+ ctx .handleError (
455+ tiledb .tiledb_fragment_info_get_mbr_from_index (
456+ ctx .getCtxp (),
457+ this .fragmentInfop ,
458+ fragmentID ,
459+ mid ,
460+ dimensionID ,
461+ mbrArray .toVoidPointer ()));
462+ mbr = (long []) mbrArray .toJavaArray ();
463+ }
464+ return mbr ;
465+ }
466+
467+ /**
468+ * Retrieves the MBR from a given fragment for a given dimension index.
469+ *
470+ * @param fragmentID The index of the fragment of interest.
471+ * @param mid The mbr of the fragment of interest.
472+ * @param dimName The dimension name.
473+ * @return The MBR.
474+ */
475+ public long [] getMBRFromName (long fragmentID , String dimName , long mid ) throws TileDBError {
476+ long [] mbr ;
477+ try (NativeArray mbrArray = new NativeArray (ctx , 2 , Long .class )) {
478+ ctx .handleError (
479+ tiledb .tiledb_fragment_info_get_mbr_from_name (
480+ ctx .getCtxp (),
481+ this .fragmentInfop ,
482+ fragmentID ,
483+ mid ,
484+ dimName ,
485+ mbrArray .toVoidPointer ()));
486+ mbr = (long []) mbrArray .toJavaArray ();
487+ }
488+ return mbr ;
489+ }
490+
491+ /**
492+ * Returns the MBR of the fragment with the given index on the given dimension index. Applicable
493+ * to string dimensions.
494+ *
495+ * @param fragmentID The index of the fragment of interest.
496+ * @param mid The mbr of the fragment of interest.
497+ * @param dimId The dimension index, following the order as it was defined in the domain of the
498+ * array schema.
499+ * @return The MBR.
500+ */
501+ public Pair <Long , Long > getMBRVarSizeFromIndex (long fragmentID , long dimId , long mid )
502+ throws TileDBError {
503+ SWIGTYPE_p_unsigned_long_long startSize = tiledb .new_ullp ();
504+ SWIGTYPE_p_unsigned_long_long endSize = tiledb .new_ullp ();
505+ ctx .handleError (
506+ tiledb .tiledb_fragment_info_get_mbr_var_size_from_index (
507+ ctx .getCtxp (), this .fragmentInfop , fragmentID , mid , dimId , startSize , endSize ));
508+ return new Pair <>(
509+ tiledb .ullp_value (startSize ).longValue (), tiledb .ullp_value (endSize ).longValue ());
510+ }
511+
512+ /**
513+ * Returns the MBR of the fragment with the given index on the given dimension name. Applicable to
514+ * string dimensions.
515+ *
516+ * @param fragmentID The index of the fragment of interest.
517+ * @param mid The mbr of the fragment of interest.
518+ * @param dimName The dimension name.
519+ * @return The MBR.
520+ */
521+ public Pair <Long , Long > getMBRVarSizeFromName (long fragmentID , String dimName , long mid )
522+ throws TileDBError {
523+ SWIGTYPE_p_unsigned_long_long startSize = tiledb .new_ullp ();
524+ SWIGTYPE_p_unsigned_long_long endSize = tiledb .new_ullp ();
525+ ctx .handleError (
526+ tiledb .tiledb_fragment_info_get_mbr_var_size_from_name (
527+ ctx .getCtxp (), this .fragmentInfop , fragmentID , mid , dimName , startSize , endSize ));
528+ return new Pair <>(
529+ tiledb .ullp_value (startSize ).longValue (), tiledb .ullp_value (endSize ).longValue ());
530+ }
531+
532+ /**
533+ * Returns the MBR of the fragment with the given index on the given dimension index. Applicable
534+ * to string dimensions.
535+ *
536+ * @param fragmentID The index of the fragment of interest.
537+ * @param mid The mbr of the fragment of interest.
538+ * @param dimId The dimension index, following the order as it was defined in the domain of the
539+ * array schema.
540+ * @return The MBR.
541+ */
542+ public Pair <String , String > getMBRVarFromIndex (long fragmentID , long dimId , long mid )
543+ throws TileDBError {
544+ Pair <Long , Long > size = this .getMBRVarSizeFromIndex (fragmentID , dimId , mid );
545+
546+ try (NativeArray start = new NativeArray (ctx , size .getFirst ().intValue (), String .class );
547+ NativeArray end = new NativeArray (ctx , size .getSecond ().intValue (), String .class ); ) {
548+ ctx .handleError (
549+ tiledb .tiledb_fragment_info_get_mbr_var_from_index (
550+ ctx .getCtxp (),
551+ this .fragmentInfop ,
552+ fragmentID ,
553+ mid ,
554+ dimId ,
555+ start .toVoidPointer (),
556+ end .toVoidPointer ()));
557+ Object st = new String ((byte []) start .toJavaArray ());
558+ Object e = new String ((byte []) end .toJavaArray ());
559+ return new Pair (st , e );
560+ }
561+ }
562+
563+ /**
564+ * Returns the MBR of the fragment with the given index on the given dimension name. Applicable to
565+ * string dimensions.
566+ *
567+ * @param fragmentID The index of the fragment of interest.
568+ * @param mid The mbr of the fragment of interest.
569+ * @param dimName The dimension name.
570+ * @return The MBR.
571+ */
572+ public Pair <String , String > getMBRVarFromName (long fragmentID , String dimName , long mid )
573+ throws TileDBError {
574+ Pair <Long , Long > size = this .getMBRVarSizeFromName (fragmentID , dimName , mid );
575+
576+ try (NativeArray start = new NativeArray (ctx , size .getFirst ().intValue (), String .class );
577+ NativeArray end = new NativeArray (ctx , size .getSecond ().intValue (), String .class ); ) {
578+ ctx .handleError (
579+ tiledb .tiledb_fragment_info_get_mbr_var_from_name (
580+ ctx .getCtxp (),
581+ this .fragmentInfop ,
582+ fragmentID ,
583+ mid ,
584+ dimName ,
585+ start .toVoidPointer (),
586+ end .toVoidPointer ()));
587+ Object st = new String ((byte []) start .toJavaArray ());
588+ Object e = new String ((byte []) end .toJavaArray ());
589+ return new Pair (st , e );
590+ }
591+ }
592+
593+ /**
594+ * Get the fragment info schema name.
595+ *
596+ * @param fragmentID The fragment info object.
597+ * @return The schema name.
598+ * @throws TileDBError
599+ */
600+ public String getArraySchemaName (long fragmentID ) throws TileDBError {
601+ SWIGTYPE_p_p_char name = tiledb .new_charpp ();
602+
603+ ctx .handleError (
604+ tiledb .tiledb_fragment_info_get_array_schema_name (
605+ ctx .getCtxp (), fragmentInfop , fragmentID , name ));
606+
607+ return tiledb .charpp_value (name );
608+ }
422609}
0 commit comments