public class TsvFileParser extends Object implements FileParser
FileParser for parsing data out of a TSV file.| Constructor and Description |
|---|
TsvFileParser() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getColumnNames(File file)
Parses the given file and returns the column names that are available in the file.
|
boolean |
hasColumnNames()
Method that checks if the parser has access to column names.
|
List<Object[]> |
parse(File file,
org.apache.hive.hcatalog.data.schema.HCatSchema schema,
List<String> names)
Parses the given file and returns the rows with the requested columns.
|
TsvFileParser |
withCharset(Charset charset)
Use the provided
Charset. |
TsvFileParser |
withDelimiter(String delimiter)
Use the provided delimiter.
|
TsvFileParser |
withHeader()
Enable if TSV file has header row.
|
TsvFileParser |
withNullValue(Object nullValue)
Use the provided null value.
|
TsvFileParser |
withoutHeader()
Enable if TSV file has header row.
|
public TsvFileParser withDelimiter(String delimiter)
public TsvFileParser withNullValue(Object nullValue)
public TsvFileParser withCharset(Charset charset)
Charset. The default is UTF-8.public TsvFileParser withHeader()
public TsvFileParser withoutHeader()
public List<Object[]> parse(File file, org.apache.hive.hcatalog.data.schema.HCatSchema schema, List<String> names)
FileParserparse in interface FileParserfile - The file to be parsed.schema - The full schema of the Hive table.names - The requested field names.List of rows, each represented by an Object array.public boolean hasColumnNames()
FileParserhasColumnNames in interface FileParserpublic List<String> getColumnNames(File file)
FileParsergetColumnNames in interface FileParserfile - The file to be parsedList of column names as StringsCopyright © 2013–2020. All rights reserved.