Skip to content

Commit 0499132

Browse files
Merge branch 'main' into feat-datastore-request-tags
2 parents 8a810e8 + f84034b commit 0499132

9 files changed

Lines changed: 1008 additions & 1592 deletions

File tree

.github/workflows/create_additional_release_tag.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
release:
88
types: [published]
99
workflow_dispatch:
10+
inputs:
11+
target_ref:
12+
description: 'Git ref (tag or SHA) to check out and tag. Defaults to branch HEAD if empty.'
13+
required: false
14+
default: ''
1015
jobs:
1116
build:
1217
runs-on: ubuntu-latest
@@ -18,6 +23,7 @@ jobs:
1823
- name: Checkout code
1924
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2025
with:
26+
ref: ${{ inputs.target_ref || github.ref }}
2127
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
2228
persist-credentials: false
2329
- name: Set up Git
@@ -38,7 +44,7 @@ jobs:
3844
continue
3945
fi
4046
git tag $TAG_NAME
41-
git push origin $TAG_NAME
47+
git push https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git $TAG_NAME
4248
if [ "${ARTIFACT_ID}" = "libraries-bom" ]; then
4349
echo "Creating GitHub Release for ${TAG_NAME}"
4450
gh release create "${TAG_NAME}" --title "GCP Libraries BOM ${VERSION}" --notes "libraries-bom release."

java-bigquery-jdbc/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN bash -c " \
1414
&& git clone -b ${BRANCH} --depth 1 --single-branch https://github.com/googleapis/google-cloud-java.git \
1515
&& cd /git/google-cloud-java \
1616
&& source .kokoro/common.sh \
17-
&& install_modules java-bigquery \
17+
&& install_modules java-bigquery-jdbc \
1818
&& rm -rf /git"
1919

2020
# This will ensure all deps are present

java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryDatabaseMetaData.java

Lines changed: 735 additions & 1255 deletions
Large diffs are not rendered by default.

java-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/BigQueryDatabaseMetaDataTest.java

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
import com.google.api.gax.paging.Page;
3333
import com.google.cloud.bigquery.*;
34-
import com.google.cloud.bigquery.BigQuery.RoutineListOption;
3534
import com.google.cloud.bigquery.exception.BigQueryJdbcException;
3635
import com.google.cloud.bigquery.jdbc.BigQueryJdbcTypeMappings.ColumnTypeInfo;
3736
import io.opentelemetry.api.common.AttributeKey;
@@ -49,11 +48,8 @@
4948
import java.sql.Statement;
5049
import java.sql.Types;
5150
import java.util.*;
52-
import java.util.concurrent.Callable;
53-
import java.util.concurrent.ExecutionException;
5451
import java.util.concurrent.ExecutorService;
5552
import java.util.concurrent.Executors;
56-
import java.util.concurrent.Future;
5753
import java.util.regex.Pattern;
5854
import java.util.stream.Stream;
5955
import org.junit.jupiter.api.AfterEach;
@@ -761,7 +757,7 @@ public void testProcessSchemaInfo() {
761757
String schemaName = "dataset_beta";
762758
Dataset dataset = mockBigQueryDataset(catalog, schemaName);
763759

764-
dbMetadata.processSchemaInfo(dataset, collectedResults, resultSchemaFields);
760+
dbMetadata.processSchemaInfo(dataset.getDatasetId(), collectedResults, resultSchemaFields);
765761

766762
assertEquals(1, collectedResults.size());
767763
FieldValueList row = collectedResults.get(0);
@@ -1614,96 +1610,6 @@ public void testDefineGetProcedureColumnsComparator() {
16141610
assertEquals("param_a", results.get(4).get("COLUMN_NAME").getStringValue());
16151611
}
16161612

1617-
@Test
1618-
public void testListMatchingProcedureIdsFromDatasets() throws Exception {
1619-
String catalog = "test-proj";
1620-
String schema1Name = "dataset1";
1621-
String schema2Name = "dataset2";
1622-
Dataset dataset1 = mockBigQueryDataset(catalog, schema1Name);
1623-
Dataset dataset2 = mockBigQueryDataset(catalog, schema2Name);
1624-
List<Dataset> datasetsToScan = Arrays.asList(dataset1, dataset2);
1625-
1626-
Routine proc1_ds1 = mockBigQueryRoutine(catalog, schema1Name, "proc_a", "PROCEDURE", "desc a");
1627-
Routine func1_ds1 = mockBigQueryRoutine(catalog, schema1Name, "func_b", "FUNCTION", "desc b");
1628-
Routine proc2_ds2 = mockBigQueryRoutine(catalog, schema2Name, "proc_c", "PROCEDURE", "desc c");
1629-
1630-
Page<Routine> page1 = mock(Page.class, withSettings().withoutAnnotations());
1631-
when(page1.iterateAll()).thenReturn(Arrays.asList(proc1_ds1, func1_ds1));
1632-
when(bigqueryClient.listRoutines(eq(dataset1.getDatasetId()), any(RoutineListOption.class)))
1633-
.thenReturn(page1);
1634-
1635-
Page<Routine> page2 = mock(Page.class, withSettings().withoutAnnotations());
1636-
when(page2.iterateAll()).thenReturn(Collections.singletonList(proc2_ds2));
1637-
when(bigqueryClient.listRoutines(eq(dataset2.getDatasetId()), any(RoutineListOption.class)))
1638-
.thenReturn(page2);
1639-
1640-
ExecutorService mockExecutor = mock(ExecutorService.class);
1641-
doAnswer(
1642-
invocation -> {
1643-
Callable<?> callable = invocation.getArgument(0);
1644-
@SuppressWarnings("unchecked") // Suppress warning for raw Future mock
1645-
Future<Object> mockedFuture = mock(Future.class);
1646-
1647-
try {
1648-
Object result = callable.call();
1649-
doReturn(result).when(mockedFuture).get();
1650-
} catch (InterruptedException interruptedException) {
1651-
doThrow(interruptedException).when(mockedFuture).get();
1652-
} catch (Exception e) {
1653-
doThrow(new ExecutionException(e)).when(mockedFuture).get();
1654-
}
1655-
return mockedFuture;
1656-
})
1657-
.when(mockExecutor)
1658-
.submit(any(Callable.class));
1659-
1660-
List<RoutineId> resultIds =
1661-
dbMetadata.listMatchingProcedureIdsFromDatasets(
1662-
datasetsToScan, null, null, mockExecutor, catalog, dbMetadata.LOG);
1663-
1664-
assertEquals(2, resultIds.size());
1665-
assertTrue(resultIds.contains(proc1_ds1.getRoutineId()));
1666-
assertTrue(resultIds.contains(proc2_ds2.getRoutineId()));
1667-
assertFalse(resultIds.contains(func1_ds1.getRoutineId())); // Should not contain functions
1668-
1669-
verify(mockExecutor, times(2)).submit(any(Callable.class));
1670-
}
1671-
1672-
@Test
1673-
public void testProcessProcedureArgumentsSequentially_Basic() throws InterruptedException {
1674-
String catalog = "p";
1675-
String schemaName = "d";
1676-
RoutineArgument arg1 = mockRoutineArgument("arg1_name", StandardSQLTypeName.STRING, "IN");
1677-
Routine proc1 =
1678-
mockBigQueryRoutineWithArgs(
1679-
catalog, schemaName, "proc1", "PROCEDURE", "desc1", Collections.singletonList(arg1));
1680-
Routine func1 =
1681-
mockBigQueryRoutineWithArgs(
1682-
catalog,
1683-
schemaName,
1684-
"func1",
1685-
"FUNCTION",
1686-
"desc_func",
1687-
Collections.emptyList()); // Should be skipped
1688-
Routine proc2 =
1689-
mockBigQueryRoutineWithArgs(
1690-
catalog, schemaName, "proc2", "PROCEDURE", "desc2", Collections.emptyList());
1691-
1692-
List<Routine> fullRoutines = Arrays.asList(proc1, func1, proc2);
1693-
Pattern columnNameRegex = null;
1694-
List<FieldValueList> collectedResults = Collections.synchronizedList(new ArrayList<>());
1695-
Schema resultSchema = dbMetadata.defineGetProcedureColumnsSchema();
1696-
FieldList resultSchemaFields = resultSchema.getFields();
1697-
1698-
dbMetadata.processProcedureArgumentsSequentially(
1699-
fullRoutines, columnNameRegex, collectedResults, resultSchemaFields, dbMetadata.LOG);
1700-
1701-
// Only proc1 has arguments, so collectedResults should contain 1 row.
1702-
assertEquals(1, collectedResults.size());
1703-
FieldValueList row = collectedResults.get(0);
1704-
assertEquals("arg1_name", row.get("COLUMN_NAME").getStringValue());
1705-
}
1706-
17071613
@Test
17081614
public void testDefineGetTableTypesSchema() {
17091615
Schema schema = BigQueryDatabaseMetaData.defineGetTableTypesSchema();

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,10 @@ public Routine apply(com.google.api.services.bigquery.model.Routine routinePb) {
16591659

16601660
@Override
16611661
public InsertAllResponse insertAll(InsertAllRequest request) {
1662+
// This API inserts the specified rows into a table using the BigQuery insertAll API.
1663+
// Note: To prevent duplicate rows, this method does not perform automatic retries unless
1664+
// insert IDs are provided. Transient service errors (such as UNAVAILABLE) may be thrown and
1665+
// should be handled by the caller.
16621666
final TableId tableId =
16631667
request
16641668
.getTable()

0 commit comments

Comments
 (0)