Skip to content

Commit

Permalink
docs(samples): Update region tag for create table external hive parti…
Browse files Browse the repository at this point in the history
…tioning (#1079)

* docs(samples): updates region tag and file name

* docs(samples): updates region tag and file name

* docs(samples): updates class name
  • Loading branch information
steffnay authored Jan 29, 2021
1 parent 2890c80 commit 50bf783
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.example.bigquery;

// [START bigquery_create_table_external_hivepartitioned]
// [START bigquery_set_hivepartitioningoptions]
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryException;
Expand All @@ -27,7 +28,7 @@
import com.google.cloud.bigquery.TableInfo;

// Sample to create external table using hive partitioning
public class SetHivePartitioningOptions {
public class CreateTableExternalHivePartitioned {

public static void main(String[] args) {
// TODO(developer): Replace these variables before running the sample.
Expand All @@ -36,10 +37,10 @@ public static void main(String[] args) {
String sourceUri = "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/*";
String sourceUriPrefix =
"gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/{pkey:STRING}/";
setHivePartitioningOptions(datasetName, tableName, sourceUriPrefix, sourceUri);
createTableExternalHivePartitioned(datasetName, tableName, sourceUriPrefix, sourceUri);
}

public static void setHivePartitioningOptions(
public static void createTableExternalHivePartitioned(
String datasetName, String tableName, String sourceUriPrefix, String sourceUri) {
try {
// Initialize client that will be used to send requests. This client only needs to be created
Expand Down Expand Up @@ -68,3 +69,4 @@ public static void setHivePartitioningOptions(
}
}
// [END bigquery_set_hivepartitioningoptions]
// [END bigquery_create_table_external_hivepartitioned]
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

public class SetHivePartitioningOptionsIT {
public class CreateTableExternalHivePartitionedIT {

private static final String ID = UUID.randomUUID().toString().substring(0, 8);
private final Logger log = Logger.getLogger(this.getClass().getName());
Expand Down Expand Up @@ -74,11 +74,11 @@ public void tearDown() {
}

@Test
public void testSetHivePartitioningOptions() {
public void testCreateTableExternalHivePartitioned() {
String sourceUri = "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/*";
String sourceUriPrefix =
"gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/{pkey:STRING}/";
SetHivePartitioningOptions.setHivePartitioningOptions(
CreateTableExternalHivePartitioned.createTableExternalHivePartitioned(
BIGQUERY_DATASET_NAME, tableName, sourceUriPrefix, sourceUri);
assertThat(bout.toString()).contains("External table created using hivepartitioningoptions");
}
Expand Down

0 comments on commit 50bf783

Please sign in to comment.