Class CsvOptions.Builder (2.42.3)

public static final class CsvOptions.Builder

Inheritance

java.lang.Object > CsvOptions.Builder

Methods

build()

public CsvOptions build()

Creates a CsvOptions object.

Returns
Type Description
CsvOptions

setAllowJaggedRows(boolean allowJaggedRows)

public CsvOptions.Builder setAllowJaggedRows(boolean allowJaggedRows)

Set whether BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. By default, rows with missing trailing columns are considered bad records.

Parameter
Name Description
allowJaggedRows boolean
Returns
Type Description
CsvOptions.Builder

setAllowQuotedNewLines(boolean allowQuotedNewLines)

public CsvOptions.Builder setAllowQuotedNewLines(boolean allowQuotedNewLines)

Sets whether BigQuery should allow quoted data sections that contain newline characters in a CSV file. By default quoted newline are not allowed.

Parameter
Name Description
allowQuotedNewLines boolean
Returns
Type Description
CsvOptions.Builder

setEncoding(String encoding)

public CsvOptions.Builder setEncoding(String encoding)

Sets the character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values set in #setQuote(String) and #setFieldDelimiter(String).

Parameter
Name Description
encoding String
Returns
Type Description
CsvOptions.Builder

setEncoding(Charset encoding)

public CsvOptions.Builder setEncoding(Charset encoding)

Sets the character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values set in #setQuote(String) and #setFieldDelimiter(String).

Parameter
Name Description
encoding Charset
Returns
Type Description
CsvOptions.Builder

setFieldDelimiter(String fieldDelimiter)

public CsvOptions.Builder setFieldDelimiter(String fieldDelimiter)

Sets the separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence " " to specify a tab separator. The default value is a comma (',').

Parameter
Name Description
fieldDelimiter String
Returns
Type Description
CsvOptions.Builder

setNullMarker(String nullMarker)

public CsvOptions.Builder setNullMarker(String nullMarker)

[Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when querying a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.

Parameter
Name Description
nullMarker String
Returns
Type Description
CsvOptions.Builder

setPreserveAsciiControlCharacters(boolean preserveAsciiControlCharacters)

public CsvOptions.Builder setPreserveAsciiControlCharacters(boolean preserveAsciiControlCharacters)

Sets whether BigQuery should allow ASCII control characters in a CSV file. By default ASCII control characters are not allowed.

Parameter
Name Description
preserveAsciiControlCharacters boolean
Returns
Type Description
CsvOptions.Builder

setQuote(String quote)

public CsvOptions.Builder setQuote(String quote)

Sets the value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set #setAllowQuotedNewLines(boolean) property to true.

Parameter
Name Description
quote String
Returns
Type Description
CsvOptions.Builder

setSkipLeadingRows(long skipLeadingRows)

public CsvOptions.Builder setSkipLeadingRows(long skipLeadingRows)

Sets the number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.

Parameter
Name Description
skipLeadingRows long
Returns
Type Description
CsvOptions.Builder