Class IngestionUtils
- java.lang.Object
-
- org.apache.pinot.segment.local.utils.IngestionUtils
-
public final class IngestionUtils extends Object
Helper methods for ingestion
-
-
Method Summary
Modifier and Type Method Description static StringbuildSegment(SegmentGeneratorConfig segmentGeneratorConfig)Builds a segment using givenSegmentGeneratorConfigstatic LongextractTimeValue(Comparable time)static SegmentGeneratorConfiggenerateSegmentGeneratorConfig(TableConfig tableConfig, Schema schema)CreateSegmentGeneratorConfigusing tableConfig and schema.static SegmentGeneratorConfiggenerateSegmentGeneratorConfig(TableConfig tableConfig, Schema schema, BatchIngestionConfig batchIngestionConfig)CreateSegmentGeneratorConfigusing tableConfig, schema and batchIngestionConfig.static Set<String>getFieldsForRecordExtractor(IngestionConfig ingestionConfig, Schema schema)Extracts all fields required by theRecordExtractorfrom the given TableConfig and Schema Fields for ingestion come from 2 places: 1.static PinotFSgetOutputPinotFS(BatchConfig batchConfig, URI fileURI)Creates an instance of the PinotFS using the fileURI and fs properties from BatchConfigstatic booleanshouldIngestRow(GenericRow genericRow)Returns false if the record contains keyGenericRow.SKIP_RECORD_KEYwith value truestatic voiduploadSegment(String tableNameWithType, BatchConfig batchConfig, List<URI> segmentTarURIs, AuthProvider authProvider)Uploads the segments from the provided segmentTar URIs to the table, using push details from the batchConfig
-
-
-
Method Detail
-
generateSegmentGeneratorConfig
public static SegmentGeneratorConfig generateSegmentGeneratorConfig(TableConfig tableConfig, Schema schema) throws IOException, ClassNotFoundException
CreateSegmentGeneratorConfigusing tableConfig and schema. All properties are taken from the 1st Map in tableConfig -> ingestionConfig -> batchIngestionConfig -> batchConfigMaps- Parameters:
tableConfig- tableConfig with the batchConfigMap setschema- pinot schema- Throws:
IOExceptionClassNotFoundException
-
generateSegmentGeneratorConfig
public static SegmentGeneratorConfig generateSegmentGeneratorConfig(TableConfig tableConfig, Schema schema, BatchIngestionConfig batchIngestionConfig) throws ClassNotFoundException, IOException
CreateSegmentGeneratorConfigusing tableConfig, schema and batchIngestionConfig. The provided batchIngestionConfig will take precedence over the one in tableConfig- Throws:
ClassNotFoundExceptionIOException
-
buildSegment
public static String buildSegment(SegmentGeneratorConfig segmentGeneratorConfig) throws Exception
Builds a segment using givenSegmentGeneratorConfig- Returns:
- segment name
- Throws:
Exception
-
uploadSegment
public static void uploadSegment(String tableNameWithType, BatchConfig batchConfig, List<URI> segmentTarURIs, @Nullable AuthProvider authProvider) throws Exception
Uploads the segments from the provided segmentTar URIs to the table, using push details from the batchConfig- Parameters:
tableNameWithType- name of the table to upload the segmentbatchConfig- batchConfig with details about push such as controllerURI, pushAttempts, pushParallelism, etcsegmentTarURIs- list of URI for the segment tar filesauthProvider- auth provider- Throws:
Exception
-
getOutputPinotFS
public static PinotFS getOutputPinotFS(BatchConfig batchConfig, URI fileURI)
Creates an instance of the PinotFS using the fileURI and fs properties from BatchConfig
-
getFieldsForRecordExtractor
public static Set<String> getFieldsForRecordExtractor(@Nullable IngestionConfig ingestionConfig, Schema schema)
Extracts all fields required by theRecordExtractorfrom the given TableConfig and Schema Fields for ingestion come from 2 places: 1. The schema 2. The ingestion config in the table config. The ingestion config (e.g. filter, complexType) can have fields which are not in the schema.
-
shouldIngestRow
public static boolean shouldIngestRow(GenericRow genericRow)
Returns false if the record contains keyGenericRow.SKIP_RECORD_KEYwith value true
-
extractTimeValue
public static Long extractTimeValue(Comparable time)
-
-