Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class HttpJsonHiveMetastoreServiceStub extends HiveMetastoreServiceStub {
serializer.putQueryParam(
fields, "hiveCatalogId", request.getHiveCatalogId());
serializer.putQueryParam(
fields, "primaryLocation", request.getPrimaryLocation());
fields, "primary_location", request.getPrimaryLocation());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The query parameter name has been changed from primaryLocation to primary_location. While breaking changes are permissible for unreleased APIs, this snake_case naming is inconsistent with the kebab-case naming (e.g., page-size) introduced in HttpJsonIcebergCatalogServiceStub.java. Standardizing on camelCase is recommended for Google Cloud APIs.

Suggested change
fields, "primary_location", request.getPrimaryLocation());
fields, "primaryLocation", request.getPrimaryLocation());
References
  1. Breaking changes to public APIs are permissible if the API has not yet been released.

serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public class HttpJsonIcebergCatalogServiceStub extends IcebergCatalogServiceStub
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<ListIcebergCatalogsRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "page-size", request.getPageSize());
serializer.putQueryParam(fields, "page-token", request.getPageToken());
Comment on lines +117 to +118
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The query parameters page-size and page-token have been changed to kebab-case, which is non-standard for Google Cloud APIs and inconsistent with the snake_case used in HttpJsonHiveMetastoreServiceStub.java. While breaking changes are permissible for unreleased APIs, it is recommended to use camelCase for consistency and adherence to standard API patterns.

Suggested change
serializer.putQueryParam(fields, "page-size", request.getPageSize());
serializer.putQueryParam(fields, "page-token", request.getPageToken());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
References
  1. Breaking changes to public APIs are permissible if the API has not yet been released.

serializer.putQueryParam(fields, "view", request.getViewValue());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
Expand Down Expand Up @@ -195,7 +195,7 @@ public class HttpJsonIcebergCatalogServiceStub extends IcebergCatalogServiceStub
ProtoRestSerializer<CreateIcebergCatalogRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(
fields, "icebergCatalogId", request.getIcebergCatalogId());
fields, "iceberg-catalog-id", request.getIcebergCatalogId());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The query parameter iceberg-catalog-id uses kebab-case, which is non-standard for Google Cloud REST APIs and inconsistent with the snake_case used elsewhere in the library. Consider using camelCase for consistency.

Suggested change
fields, "iceberg-catalog-id", request.getIcebergCatalogId());
fields, "icebergCatalogId", request.getIcebergCatalogId());
References
  1. Breaking changes to public APIs are permissible if the API has not yet been released.

serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.biglake.v1;

import com.google.cloud.biglake.hive.v1beta.CreateHiveCatalogRequest;
import com.google.cloud.biglake.hive.v1beta.HiveCatalog;
import com.google.cloud.biglake.hive.v1beta.HiveMetastoreServiceClient;
import com.google.cloud.biglake.hive.v1beta.HiveMetastoreServiceSettings;
import com.google.cloud.biglake.hive.v1beta.ListHiveCatalogsRequest;
import java.io.IOException;
import org.junit.Test;

public class BiglakeDemoTest {

@Test
public void testBiglakeRequests() throws Exception {
String projectId = System.getenv("GOOGLE_CLOUD_PROJECT");
if (projectId == null || projectId.isEmpty()) {
System.err.println(
"Warning: GOOGLE_CLOUD_PROJECT environment variable not defined. Skipping demo requests.");
return;
}

System.out.println("Starting BigLake Client library demo execution...");
System.out.println("Target Project ID: " + projectId);

runHiveMetastoreDemo(projectId);
runIcebergCatalogDemo(projectId);
}

private void runHiveMetastoreDemo(String projectId) throws IOException {
System.out.println("\nExecuting Hive Metastore affected requests test...");
HiveMetastoreServiceSettings settings =
HiveMetastoreServiceSettings.newHttpJsonBuilder().build();

try (HiveMetastoreServiceClient client = HiveMetastoreServiceClient.create(settings)) {
String parent = String.format("projects/%s", projectId);

// Call ListHiveCatalogsRequest verifying corrected query parameters
System.out.println("Requesting ListHiveCatalogs...");
ListHiveCatalogsRequest listRequest =
ListHiveCatalogsRequest.newBuilder().setParent(parent).setPageSize(10).build();

client
.listHiveCatalogs(listRequest)
.iterateAll()
.forEach(catalog -> System.out.println(" -> Found Catalog: " + catalog.getName()));

// Call CreateHiveCatalogRequest verifying query parameter primary_location serialization
System.out.println("Requesting CreateHiveCatalog (dry-run / testing)...");
CreateHiveCatalogRequest createRequest =
CreateHiveCatalogRequest.newBuilder()
.setParent(parent)
.setHiveCatalogId("test-demo-catalog-" + System.currentTimeMillis())
.setPrimaryLocation("us-central1")
.setHiveCatalog(HiveCatalog.newBuilder().build())
.build();

HiveCatalog response = client.createHiveCatalog(createRequest);
System.out.println(" -> Successfully Created Catalog: " + response.getName());
}
}

private void runIcebergCatalogDemo(String projectId) throws IOException {
System.out.println("\nExecuting Iceberg Catalog affected requests test...");
IcebergCatalogServiceSettings settings =
IcebergCatalogServiceSettings.newHttpJsonBuilder().build();

try (IcebergCatalogServiceClient client = IcebergCatalogServiceClient.create(settings)) {
String parent = String.format("projects/%s", projectId);

// Call ListIcebergCatalogsRequest verifying corrected query parameters
System.out.println("Requesting ListIcebergCatalogs...");
ListIcebergCatalogsRequest listRequest =
ListIcebergCatalogsRequest.newBuilder().setParent(parent).setPageSize(10).build();

client
.listIcebergCatalogs(listRequest)
.iterateAll()
.forEach(
catalog -> System.out.println(" -> Found Iceberg Catalog: " + catalog.getName()));

// Call CreateIcebergCatalogRequest verifying corrected parameter
System.out.println("Requesting CreateIcebergCatalog...");
CreateIcebergCatalogRequest createRequest =
CreateIcebergCatalogRequest.newBuilder()
.setParent(parent)
.setIcebergCatalogId("test-demo-iceberg-" + System.currentTimeMillis())
.setIcebergCatalog(IcebergCatalog.newBuilder().build())
.build();

IcebergCatalog response = client.createIcebergCatalog(createRequest);
System.out.println(" -> Successfully Created Iceberg Catalog: " + response.getName());
}
}
}
Loading