case class RawTableParser(predicate: (Try[RawRow]) => Boolean = TableParser.includeAll, maybeHeader: Option[Header] = None, forgiving: Boolean = false, multiline: Boolean = false, headerRowsToRead: Int = 1) extends StringTableParser[RawTable] with CopyableTableParser[RawRow, String, RawTable] with Product with Serializable
Class used to parse files as a Table of Seq[String]. That's to say, no parsing of individual (or groups of) columns.
- predicate
a predicate which, if true, allows inclusion of the input row.
- maybeHeader
an optional fixed header. If None, we expect to find the header defined in the first line of the file.
- forgiving
forcing (defaults to true). If true then an individual malformed row will not prevent subsequent rows being parsed.
- Alphabetic
- By Inheritance
- RawTableParser
- Serializable
- Product
- Equals
- CopyableTableParser
- StringTableParser
- AbstractTableParser
- TableParser
- TableBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new RawTableParser(predicate: (Try[RawRow]) => Boolean = TableParser.includeAll, maybeHeader: Option[Header] = None, forgiving: Boolean = false, multiline: Boolean = false, headerRowsToRead: Int = 1)
- predicate
a predicate which, if true, allows inclusion of the input row.
- maybeHeader
an optional fixed header. If None, we expect to find the header defined in the first line of the file.
- forgiving
forcing (defaults to true). If true then an individual malformed row will not prevent subsequent rows being parsed.
Type Members
- type Input = String
The input type, typically
StringorStrings.The input type, typically
StringorStrings.- Definition Classes
- StringTableParser → TableParser
- type Row = RawRow
The row type.
The row type.
- Definition Classes
- RawTableParser → TableBuilder
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def builder(rows: Iterator[RawRow], header: Header): Table[Row]
Method to construct a Table based on the given iterator of rows and the given header.
Method to construct a Table based on the given iterator of rows and the given header.
- rows
an iterator of Row objects representing the data rows.
- header
a Header object representing the table's column headers.
- returns
the constructed Table based on the input rows and header.
- Attributes
- protected
- Definition Classes
- RawTableParser → TableBuilder
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def doParseRows(ts: Iterator[Input], header: Header, f: ((Input, Int)) => Try[Row])(implicit ev: Joinable[Input]): Try[RawTable]
Parses rows of input data into a table representation.
Parses rows of input data into a table representation.
This method utilizes an
IndexedInputToRowsAggregatorto transform an iterator of inputs into rows using the provided header and transformation function. It processes the input, materializes the resulting rows into a list, and constructs a table representation from the processed rows and header.- ts
an iterator of inputs to be parsed into rows.
- header
the
Headercontaining column metadata to guide the transformation process.- f
a transformation function that maps the
Headerto a function capable of transforming a tuple of input and its index into aTry[Row]. This function encapsulates row processing logic and error handling for each input element.- ev
an implicit evidence parameter ensuring the input type adheres to the
Joinabletype class, which defines how input elements can be combined or validated during processing.- returns
a
Trycontaining aTableif the parsing is successful, or an error in case of failure.
- Definition Classes
- AbstractTableParser
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val forgiving: Boolean
If true, individual row failures are logged but do not cause the overall parse to fail.
If true, individual row failures are logged but do not cause the overall parse to fail.
- Definition Classes
- RawTableParser → TableBuilder
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val headerRowsToRead: Int
This indicates the number of header rows which must be read from the input.
This indicates the number of header rows which must be read from the input. The value is usually 1 but some types of CSV file have more than one header line. If maybeHeader exists, then this number is ignored.
CONSIDER if this is really ignored when maybeHeader is defined, then we should eliminate such places where this value has an override of 0.
- Definition Classes
- RawTableParser → TableParser
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val maybeHeader: Option[Header]
This variable determines if there is a programmed, i.e., fixed, header for the parser.
This variable determines if there is a programmed, i.e., fixed, header for the parser. If its value is None, it signifies that we must look to the first line(s) of data for an appropriate header.
- Definition Classes
- RawTableParser → TableParser
- val multiline: Boolean
Value to determine whether it is acceptable to have a quoted string span more than one line.
Value to determine whether it is acceptable to have a quoted string span more than one line.
- returns
true if quoted strings may span more than one line.
- Definition Classes
- RawTableParser → TableParser
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def parse(xs: Iterator[String], n: Int = headerRowsToRead): Try[RawTable]
Method to parse a table based on a sequence of Inputs.
Method to parse a table based on a sequence of Inputs. NOTE: this is required so that we can invoke this method with an Iterator[String].
- xs
the sequence of Inputs, one for each row
- n
the number of rows to drop (length of the header)--defaults to 1.
- returns
a Try[Table].
- Definition Classes
- StringTableParser → AbstractTableParser → TableParser
- def parseRows(ws: Iterator[String], header: Header): Try[RawTable]
Parses rows from an iterator of input strings (
ws) using the provided header and row parsing logic.Parses rows from an iterator of input strings (
ws) using the provided header and row parsing logic.This method utilizes the
doParseRowsfunction to process each row in the input iterator, applying the providedrowParser.parsefunction to convert input strings into logical rows, while using the header to guide parsing and interpretation of the input.- ws
an iterator over the input strings, where each string represents a row in the table.
- header
the
Headerobject that describes the expected structure of the table (e.g., column names).- returns
a
Tryof the parsedTableobject. On success, it contains the resulting table; on failure, it contains the parsing error.
- Definition Classes
- StringTableParser → AbstractTableParser
- val predicate: (Try[RawRow]) => Boolean
Predicate to filter rows.
Predicate to filter rows. Defaults to including all rows.
- Attributes
- protected
- Definition Classes
- RawTableParser → TableBuilder
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- implicit val rowCellParser: CellParser[RawRow]
- val rowParser: RowParser[Row, String]
Method to define a row parser.
Method to define a row parser.
- returns
a RowParser[Row, Input].
- Definition Classes
- RawTableParser → TableParser
- def setForgiving(b: Boolean): RawTableParser
Configures the parser to operate in a "forgiving" mode, where errors encountered during the parsing of individual rows are logged but do not cause the parsing process to fail.
Configures the parser to operate in a "forgiving" mode, where errors encountered during the parsing of individual rows are logged but do not cause the parsing process to fail. When set to
true, the parser will attempt to continue parsing despite encountering errors in the input. When set tofalse, errors will cause the parsing process to terminate.- returns
an instance of
TableParser[Table]configured with the specified forgiving behavior.
- Definition Classes
- RawTableParser → CopyableTableParser
- def setHeader(header: Header): RawTableParser
Sets a fixed header for the table parser.
Sets a fixed header for the table parser. This method allows the configuration of the parser to use the specified header, instead of deriving it from the data during parsing.
- header
the
Headerinstance representing the fixed header for the table parser, containing column names and optional additional header lines.- returns
a new
TableParser[Table]instance configured with the specified header.
- Definition Classes
- RawTableParser → CopyableTableParser
- def setMultiline(b: Boolean): RawTableParser
Configures the parser to allow or disallow quoted strings to span across multiple lines.
Configures the parser to allow or disallow quoted strings to span across multiple lines.
When
multilineis set totrue, the parser permits quoted strings in the input to extend beyond a single line. If set tofalse, quoted strings are constrained to stay within one line.- returns
a new
TableParser[Table]instance configured with the updated multiline setting.
- Definition Classes
- RawTableParser → CopyableTableParser
- def setPredicate(p: (Try[Row]) => Boolean): RawTableParser
Sets a predicate function that determines whether a parsed
Rowshould be included in the finalTable.Sets a predicate function that determines whether a parsed
Rowshould be included in the finalTable. The predicate is applied to each parsedRowwrapped in aTryto allow filtering based on success or failure.- returns
a new instance of
TableParser[Table]with the specified predicate applied.
- Definition Classes
- RawTableParser → CopyableTableParser
- def setRowParser(rp: RowParser[Row, String]): RawTableParser
Sets the row parser to be used for parsing rows in the table.
Sets the row parser to be used for parsing rows in the table.
The row parser provides the logic for converting raw input data of type
Inputinto rows of typeRow. This method allows you to configure the table parser with a custom row parser, enabling flexibility in interpreting the rows according to specific requirements.- returns
a new
TableParserinstance configured with the specified row parser.
- Definition Classes
- RawTableParser → CopyableTableParser
- implicit val stringSeqParser: CellParser[Strings]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)