public class BigQueryUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BIG_NUMERIC_PRECISION |
static int |
DEFAULT_BIG_NUMERIC_SCALE |
static int |
DEFAULT_NUMERIC_PRECISION |
static int |
DEFAULT_NUMERIC_SCALE |
| Modifier and Type | Method and Description |
|---|---|
static com.google.cloud.bigquery.Schema |
adjustSchemaIfNeeded(com.google.cloud.bigquery.Schema wantedSchema,
com.google.cloud.bigquery.Schema existingTableSchema)
Adjusts the wanted schema to properly match the schema of an existing table.
|
static void |
convertAndThrow(com.google.cloud.bigquery.BigQueryError error) |
static <T> T |
createVerifiedInstance(String fullyQualifiedClassName,
Class<T> requiredClass,
Object... constructorArgs)
Create an instance of the given class name, and verify that it is an instance of the required
class
|
static Optional<String> |
emptyIfNeeded(String value) |
static boolean |
filterLengthInLimit(Optional<String> filter) |
static <T> Optional<T> |
firstPresent(Optional<T>... optionals) |
static String |
friendlyTableName(com.google.cloud.bigquery.TableId tableId) |
static com.google.common.collect.ImmutableList<String> |
getClusteringFields(com.google.cloud.bigquery.TableInfo tableInfo) |
static com.google.common.collect.ImmutableList<String> |
getPartitionFields(com.google.cloud.bigquery.TableInfo tableInfo) |
static List<String> |
getStreamNames(com.google.cloud.bigquery.storage.v1.ReadSession readSession)
Create a list of read stream names of given read session.
|
static boolean |
isBigLakeManagedTable(com.google.cloud.bigquery.TableInfo table)
BigLake Managed tables are not represented by a dedicated type.
|
static boolean |
isBigQueryNativeTable(com.google.cloud.bigquery.TableInfo table)
Since StandardTableDefinition (table_type == TableDefinition.Type.TABLE) can represent both
BigQuery native tables and BigLake Managed tables, the absence of the "bigLakeConfiguration"
field within the StandardTableDefinition
StandardTableDefinition.getBigLakeConfiguration(). |
static boolean |
isRetryable(Throwable cause) |
static List<String> |
optimizeLoadUriList(List<String> uris,
String prefixRegex,
String suffixRegex)
Solving Issue #248.
|
static com.google.cloud.bigquery.TableId |
parseTableId(String rawTable) |
static com.google.cloud.bigquery.TableId |
parseTableId(String rawTable,
Optional<String> dataset,
Optional<String> project) |
static com.google.cloud.bigquery.TableId |
parseTableId(String rawTable,
Optional<String> dataset,
Optional<String> project,
Optional<String> datePartition) |
static String |
prepareQueryForLog(String query,
int maxLength) |
static String |
sanitizeLabelValue(String value) |
static boolean |
schemaWritable(com.google.cloud.bigquery.Schema sourceSchema,
com.google.cloud.bigquery.Schema destinationSchema,
boolean regardFieldOrder,
boolean enableModeCheckForSchemaFields)
Compares to Schema instances for equality.
|
static <T> T |
verifySerialization(T obj)
Verify the given object is Serializable by returning the deserialized version of the serialized
instance
|
public static final int DEFAULT_NUMERIC_PRECISION
public static final int DEFAULT_NUMERIC_SCALE
public static final int DEFAULT_BIG_NUMERIC_PRECISION
public static final int DEFAULT_BIG_NUMERIC_SCALE
public static boolean isRetryable(Throwable cause)
public static com.google.cloud.bigquery.TableId parseTableId(String rawTable)
public static com.google.cloud.bigquery.TableId parseTableId(String rawTable, Optional<String> dataset, Optional<String> project)
public static com.google.cloud.bigquery.TableId parseTableId(String rawTable, Optional<String> dataset, Optional<String> project, Optional<String> datePartition)
public static String friendlyTableName(com.google.cloud.bigquery.TableId tableId)
public static void convertAndThrow(com.google.cloud.bigquery.BigQueryError error)
public static List<String> optimizeLoadUriList(List<String> uris, String prefixRegex, String suffixRegex)
uris - the list of URIs where the data was written toprefixRegex - the regex to catch the part before the file index.suffixRegex - the regex to catch the part after the file index.public static boolean schemaWritable(com.google.cloud.bigquery.Schema sourceSchema,
com.google.cloud.bigquery.Schema destinationSchema,
boolean regardFieldOrder,
boolean enableModeCheckForSchemaFields)
sourceSchema - the first schema to comparedestinationSchema - the second schema to compareregardFieldOrder - whether to regard the field order in the comparisonpublic static List<String> getStreamNames(com.google.cloud.bigquery.storage.v1.ReadSession readSession)
readSession - BQ read session handlepublic static <T> T createVerifiedInstance(String fullyQualifiedClassName, Class<T> requiredClass, Object... constructorArgs)
public static <T> T verifySerialization(T obj)
public static com.google.common.collect.ImmutableList<String> getPartitionFields(com.google.cloud.bigquery.TableInfo tableInfo)
public static com.google.common.collect.ImmutableList<String> getClusteringFields(com.google.cloud.bigquery.TableInfo tableInfo)
public static com.google.cloud.bigquery.Schema adjustSchemaIfNeeded(com.google.cloud.bigquery.Schema wantedSchema,
com.google.cloud.bigquery.Schema existingTableSchema)
wantedSchema - existingTableSchema - public static boolean isBigLakeManagedTable(com.google.cloud.bigquery.TableInfo table)
StandardTableDefinition.getBigLakeConfiguration().table - the table to checkpublic static boolean isBigQueryNativeTable(com.google.cloud.bigquery.TableInfo table)
StandardTableDefinition.getBigLakeConfiguration(). indicates a BigQuery native table.table - the table to checkCopyright © 2024. All rights reserved.