Class CsvOptions.Builder

java.lang.Object
com.google.cloud.bigquery.CsvOptions.Builder
Enclosing class:
CsvOptions

public static final class CsvOptions.Builder extends Object
  • Method Details

    • setAllowJaggedRows

      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.
    • 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 in setQuote(String) and setFieldDelimiter(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 in setQuote(String) and setFieldDelimiter(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 (',').
    • setNullMarker

      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.
    • 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 set setAllowQuotedNewLines(boolean) property to true.
    • 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 a CsvOptions object.