IndexedInputToRowsTransformer
A transformer class designed to map and process inputs to rows while handling indexed inputs.
This class extends InputTransformer and provides functionality to apply a transformation defined by a function f to indexed inputs ((Input, Int)), processing the resulting Try[Row] instances to either extract valid Row results or handle errors using logging.
Type parameters
- Input
-
The type of input elements to be processed. Must have an implicit
Joinable[Input]defined. - Row
-
The type of rows produced after transformation.
Value parameters
- f
-
A function that takes an
(Input, Int)tuple and maps it to aTry[Row], representing the transformation logic from input to row with error handling. - multiline
-
A boolean flag indicating whether the transformation operates in a multiline mode.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Type members
Classlikes
Implicit object representing a JoinableTInt instance for the type Input.
Implicit object representing a JoinableTInt instance for the type Input.
This implicit ensures that the JoinableTInt operations (such as join, zero, and valid) are defined for (Input, Int) based on the behavior of an implicitly available Joinable[Input] instance.
Definitions:
Joinable: A type class that defines how to join elements of a type, provide a zero value, and validate elements.JoinableTInt: A specializedJoinablefor tuples of type(T, Int), where the joining logic relies on theJoinable[T]instance for the first element of the tuple.
Usage:
- This implicit object provides
JoinableTIntbehavior for(Input, Int)automatically, provided there is an implicitJoinable[Input]in scope.
Details:
- The
tjmember refers to theJoinable[Input]instance, obtained implicitly.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Value members
Concrete methods
Processes an iterator of input elements, transforming them into an iterator of output rows. This method applies a two-step transformation: first, it maps the input elements into Try[Row] instances using the mapTsToRows method, then it processes these Try[Row] instances with processTriedRows to produce valid rows or handle errors.
Processes an iterator of input elements, transforming them into an iterator of output rows. This method applies a two-step transformation: first, it maps the input elements into Try[Row] instances using the mapTsToRows method, then it processes these Try[Row] instances with processTriedRows to produce valid rows or handle errors.
Value parameters
- xs
-
An
Iteratorof input elements of typeInput, representing the data to be transformed.
Attributes
- Returns
-
An
Iteratorof output rows of typeRow, resulting from the transformation process.
Processes an iterator of Try[Row] instances, filtering out any failures and retaining only successful results. For each Failure encountered, the exception is logged using the logException method. The successful Row objects are then extracted and returned as an iterator.
Processes an iterator of Try[Row] instances, filtering out any failures and retaining only successful results. For each Failure encountered, the exception is logged using the logException method. The successful Row objects are then extracted and returned as an iterator.
Value parameters
- rys
-
An
IteratorofTry[Row]instances to be processed, where each element represents a possible row or an error.
Attributes
- Returns
-
An
IteratorofRowobjects, containing only the successful results from the input.
Method to parse the input lazily, into rows, each a Try (joining lines which make up one row if multiline). Nothing is read until the result is iterated.
Method to parse the input lazily, into rows, each a Try (joining lines which make up one row if multiline). Nothing is read until the result is iterated.
Value parameters
- xs
-
the input (after any header lines).
Attributes
- Returns
-
an Iterator of Try[Row].
Inherited methods
Processes an input iterator of type Input and maps its elements into rows of type Row while handling potential errors using a specified transformation function. The function can operate in two modes:
Processes an input iterator of type Input and maps its elements into rows of type Row while handling potential errors using a specified transformation function. The function can operate in two modes:
- Multiline mode: input data can span multiple lines and will be joined using the provided
Joinabletype class. - Single-line mode: each input element is processed independently.
Value parameters
- ev
-
An implicit instance of the
Joinable[(Input, Int)]type class, which handles joining and validating input tuples during multiline mode. - g
-
A transformation function that takes a tuple
(Input, Int), representing an input element and its index, and returns aTry[Row]. The function should encapsulate the logic for mapping input to a row, including error handling. - multiline
-
A Boolean flag indicating whether to process input in multiline mode. -
true: Enables multiline processing using the providedJoinabletype class. -false: Processes each input independently. - xs
-
The input iterator containing elements of type
Input.
Attributes
- Returns
-
An iterator of
Try[Row], where each element represents either a successfully processed row or a failure. - In multiline mode, elements may span across multiple lines, joined using the logic provided by theJoinabletype class. - In single-line mode, each input element is processed individually. - Inherited from:
- InputPreprocessor
Givens
Givens
Implicit object representing a JoinableTInt instance for the type Input.
Implicit object representing a JoinableTInt instance for the type Input.
This implicit ensures that the JoinableTInt operations (such as join, zero, and valid) are defined for (Input, Int) based on the behavior of an implicitly available Joinable[Input] instance.
Definitions:
Joinable: A type class that defines how to join elements of a type, provide a zero value, and validate elements.JoinableTInt: A specializedJoinablefor tuples of type(T, Int), where the joining logic relies on theJoinable[T]instance for the first element of the tuple.
Usage:
- This implicit object provides
JoinableTIntbehavior for(Input, Int)automatically, provided there is an implicitJoinable[Input]in scope.
Details:
- The
tjmember refers to theJoinable[Input]instance, obtained implicitly.