Package com.google.cloud.bigquery
Class CsvOptions.Builder
- java.lang.Object
-
- com.google.cloud.bigquery.CsvOptions.Builder
-
- Enclosing class:
- CsvOptions
public static final class CsvOptions.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CsvOptions
build()
Creates aCsvOptions
object.CsvOptions.Builder
setAllowJaggedRows(boolean allowJaggedRows)
Set whether BigQuery should accept rows that are missing trailing optional columns.CsvOptions.Builder
setAllowQuotedNewLines(boolean allowQuotedNewLines)
Sets whether BigQuery should allow quoted data sections that contain newline characters in a CSV file.CsvOptions.Builder
setEncoding(String encoding)
Sets the character encoding of the data.CsvOptions.Builder
setEncoding(Charset encoding)
Sets the character encoding of the data.CsvOptions.Builder
setFieldDelimiter(String fieldDelimiter)
Sets the separator for fields in a CSV file.CsvOptions.Builder
setPreserveAsciiControlCharacters(boolean preserveAsciiControlCharacters)
Sets whether BigQuery should allow ASCII control characters in a CSV file.CsvOptions.Builder
setQuote(String quote)
Sets the value that is used to quote data sections in a CSV file.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.
-
-
-
Method Detail
-
setAllowJaggedRows
public CsvOptions.Builder setAllowJaggedRows(boolean allowJaggedRows)
Set whether BigQuery should accept rows that are missing trailing optional columns. Iftrue
, BigQuery treats missing trailing columns as null values. Iffalse
, 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.
-
setAllowQuotedNewLines
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.
-
setEncoding
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 insetQuote(String)
andsetFieldDelimiter(String)
.
-
setEncoding
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 insetQuote(String)
andsetFieldDelimiter(String)
.
-
setFieldDelimiter
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 "\t" to specify a tab separator. The default value is a comma (',').
-
setQuote
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 setsetAllowQuotedNewLines(boolean)
property totrue
.
-
setSkipLeadingRows
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.
-
setPreserveAsciiControlCharacters
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.
-
build
public CsvOptions build()
Creates aCsvOptions
object.
-
-