Class ImmutableSegmentLoader


  • public class ImmutableSegmentLoader
    extends Object
    • Method Detail

      • load

        public static ImmutableSegment load​(File indexDir,
                                            ReadMode readMode)
                                     throws Exception
        Loads the segment with empty schema and IndexLoadingConfig. This method is used to access the segment without modifying it, i.e. in read-only mode.
        Throws:
        Exception
      • load

        public static ImmutableSegment load​(File indexDir,
                                            IndexLoadingConfig indexLoadingConfig)
                                     throws Exception
        Loads the segment with empty schema but a specified IndexLoadingConfig. This method modifies the segment like to convert segment format, add or remove indices. Mostly used by UT cases to add some specific index for testing purpose.
        Throws:
        Exception
      • load

        public static ImmutableSegment load​(File indexDir,
                                            IndexLoadingConfig indexLoadingConfig,
                                            @Nullable
                                            Schema schema)
                                     throws Exception
        Loads the segment with specified schema and IndexLoadingConfig, usually from Zookeeper. This method modifies the segment like to convert segment format, add or remove indices. Mainly used during segment reloading.
        Throws:
        Exception
      • load

        public static ImmutableSegment load​(File indexDir,
                                            IndexLoadingConfig indexLoadingConfig,
                                            @Nullable
                                            Schema schema,
                                            boolean needPreprocess)
                                     throws Exception
        Loads the segment with specified schema and IndexLoadingConfig, and allows to control whether to modify the segment like to convert segment format, add or remove indices.
        Throws:
        Exception
      • preprocess

        public static void preprocess​(File indexDir,
                                      IndexLoadingConfig indexLoadingConfig,
                                      @Nullable
                                      Schema schema)
                               throws Exception
        Preprocess the local segment directory according to the current table config and schema.
        Throws:
        Exception
      • needPreprocess

        public static boolean needPreprocess​(SegmentDirectory segmentDirectory,
                                             IndexLoadingConfig indexLoadingConfig,
                                             @Nullable
                                             Schema schema)
                                      throws Exception
        Check segment directory against the table config and schema to see if any preprocessing is needed, like changing segment format, adding new indices or updating default columns.
        Throws:
        Exception