Package com.google.cloud.bigquery
Class QueryJobConfiguration
- java.lang.Object
-
- com.google.cloud.bigquery.JobConfiguration
-
- com.google.cloud.bigquery.QueryJobConfiguration
-
- All Implemented Interfaces:
Serializable
public final class QueryJobConfiguration extends JobConfiguration
Google BigQuery Query Job configuration. A Query Job runs a query against BigQuery data. Query job configurations haveJobConfiguration.Type.QUERY
type.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryJobConfiguration.Builder
static class
QueryJobConfiguration.Priority
Priority levels for a query.-
Nested classes/interfaces inherited from class com.google.cloud.bigquery.JobConfiguration
JobConfiguration.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
allowLargeResults()
Returns whether the job is enabled to create arbitrarily large results.Boolean
createSession()
Returns whether to create a new session.Boolean
dryRun()
Returns whether the job has to be dry run or not.boolean
equals(Object obj)
Boolean
flattenResults()
Returns whether nested and repeated fields should be flattened.Clustering
getClustering()
Returns the clustering specification for the destination table.List<ConnectionProperty>
getConnectionProperties()
Returns the connection properties for connection string with this jobJobInfo.CreateDisposition
getCreateDisposition()
Returns whether the job is allowed to create new tables.DatasetId
getDefaultDataset()
Returns the default dataset.EncryptionConfiguration
getDestinationEncryptionConfiguration()
TableId
getDestinationTable()
Returns the table where to put query results.Long
getJobTimeoutMs()
Returns the timeout associated with this jobMap<String,String>
getLabels()
Returns the labels associated with this jobInteger
getMaximumBillingTier()
Returns the optional billing tier limit for this job.Long
getMaximumBytesBilled()
Returns the optional bytes billed limit for this job.Long
getMaxResults()
This is only supported in the fast query path [Optional] The maximum number of rows of data to return per page of results.Map<String,QueryParameterValue>
getNamedParameters()
Returns the named query parameters to use for the query.List<QueryParameterValue>
getPositionalParameters()
Returns the positional query parameters to use for the query.QueryJobConfiguration.Priority
getPriority()
Returns the query priority.String
getQuery()
Returns the Google BigQuery SQL query.RangePartitioning
getRangePartitioning()
Returns the range partitioning specification for the tableList<JobInfo.SchemaUpdateOption>
getSchemaUpdateOptions()
[Experimental] Returns options allowing the schema of the destination table to be updated as a side effect of the query job.Map<String,ExternalTableDefinition>
getTableDefinitions()
Returns the external tables definitions.TimePartitioning
getTimePartitioning()
Returns the time partitioning specification for the destination table.List<UserDefinedFunction>
getUserDefinedFunctions()
Returns user defined function resources that can be used by this query.JobInfo.WriteDisposition
getWriteDisposition()
Returns the action that should occur if the destination table already exists.int
hashCode()
static QueryJobConfiguration.Builder
newBuilder(String query)
Creates a builder for a BigQuery Query Job given the query to be run.static QueryJobConfiguration
of(String query)
Returns a BigQuery Copy Job for the given the query to be run.QueryJobConfiguration.Builder
toBuilder()
Returns a builder for the object.Boolean
useLegacySql()
Returns whether to use BigQuery's legacy SQL dialect for this query.Boolean
useQueryCache()
Returns whether to look for the result in the query cache.-
Methods inherited from class com.google.cloud.bigquery.JobConfiguration
getType, toString
-
-
-
-
Method Detail
-
allowLargeResults
public Boolean allowLargeResults()
Returns whether the job is enabled to create arbitrarily large results. Iftrue
the query is allowed to create large results at a slight cost in performance. the query is allowed to create large results at a slight cost in performance.- See Also:
- Returning Large Query Results
-
createSession
public Boolean createSession()
Returns whether to create a new session.- See Also:
- Create Sessions
-
getCreateDisposition
public JobInfo.CreateDisposition getCreateDisposition()
Returns whether the job is allowed to create new tables.- See Also:
- Create Disposition
-
getDefaultDataset
public DatasetId getDefaultDataset()
Returns the default dataset. This dataset is used for all unqualified table names used in the query.
-
getDestinationTable
public TableId getDestinationTable()
Returns the table where to put query results. If not provided a new table is created. This value is required ifallowLargeResults()
istrue
.
-
getDestinationEncryptionConfiguration
public EncryptionConfiguration getDestinationEncryptionConfiguration()
-
flattenResults
public Boolean flattenResults()
Returns whether nested and repeated fields should be flattened. If set tofalse
QueryJobConfiguration.Builder.setAllowLargeResults(Boolean)
must betrue
.- See Also:
- Flatten
-
getPriority
public QueryJobConfiguration.Priority getPriority()
Returns the query priority.
-
getQuery
public String getQuery()
Returns the Google BigQuery SQL query.
-
getPositionalParameters
public List<QueryParameterValue> getPositionalParameters()
Returns the positional query parameters to use for the query.
-
getNamedParameters
public Map<String,QueryParameterValue> getNamedParameters()
Returns the named query parameters to use for the query.
-
getTableDefinitions
public Map<String,ExternalTableDefinition> getTableDefinitions()
Returns the external tables definitions. If querying external data sources outside of BigQuery, this value describes the data format, location and other properties of the data sources. By defining these properties, the data sources can be queried as if they were standard BigQuery tables.
-
useQueryCache
public Boolean useQueryCache()
Returns whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available whenQueryJobConfiguration.Builder.setDestinationTable(TableId)
is not set.- See Also:
- Query Caching
-
getUserDefinedFunctions
public List<UserDefinedFunction> getUserDefinedFunctions()
Returns user defined function resources that can be used by this query. Function resources can either be defined inline (UserDefinedFunction.Type.INLINE
) or loaded from a Google Cloud Storage URI (UserDefinedFunction.Type.FROM_URI
.
-
getWriteDisposition
public JobInfo.WriteDisposition getWriteDisposition()
Returns the action that should occur if the destination table already exists.- See Also:
- Write Disposition
-
dryRun
public Boolean dryRun()
Returns whether the job has to be dry run or not. If set, the job is not executed. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run.
-
useLegacySql
public Boolean useLegacySql()
Returns whether to use BigQuery's legacy SQL dialect for this query. By default this property is set tofalse
. If set tofalse
, the query will use BigQuery's Standard SQL. When set tofalse
, the values ofallowLargeResults()
andflattenResults()
are ignored; query will be run as ifallowLargeResults()
istrue
andflattenResults()
isfalse
. If set tonull
ortrue
, legacy SQL dialect is used. This property is experimental and might be subject to change.
-
getMaximumBillingTier
public Integer getMaximumBillingTier()
Returns the optional billing tier limit for this job.
-
getMaximumBytesBilled
public Long getMaximumBytesBilled()
Returns the optional bytes billed limit for this job.
-
getSchemaUpdateOptions
public List<JobInfo.SchemaUpdateOption> getSchemaUpdateOptions()
[Experimental] Returns options allowing the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema.
-
getTimePartitioning
public TimePartitioning getTimePartitioning()
Returns the time partitioning specification for the destination table.
-
getClustering
public Clustering getClustering()
Returns the clustering specification for the destination table.
-
getJobTimeoutMs
public Long getJobTimeoutMs()
Returns the timeout associated with this job
-
getRangePartitioning
public RangePartitioning getRangePartitioning()
Returns the range partitioning specification for the table
-
getConnectionProperties
public List<ConnectionProperty> getConnectionProperties()
Returns the connection properties for connection string with this job
-
getMaxResults
public Long getMaxResults()
This is only supported in the fast query path [Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies.- Returns:
- value or
null
for none
-
toBuilder
public QueryJobConfiguration.Builder toBuilder()
Description copied from class:JobConfiguration
Returns a builder for the object.- Specified by:
toBuilder
in classJobConfiguration
-
newBuilder
public static QueryJobConfiguration.Builder newBuilder(String query)
Creates a builder for a BigQuery Query Job given the query to be run.
-
of
public static QueryJobConfiguration of(String query)
Returns a BigQuery Copy Job for the given the query to be run. Job's id is chosen by the service.
-
-