8000 GCP / Google workspace by mjsprengers · Pull Request #111 · Blazebit/blaze-query · GitHub
[go: up one dir, main page]

Skip to content

GCP / Google workspace - #111

Merged
maxhov merged 49 commits into
Blazebit:mainfrom
mjsprengers:gcp_fetchers
Mar 13, 2026
Merged

maxhov merged 49 commits into
Blazebit:mainfrom
mjsprengers:gcp_fetchers

Conversation

@mjsprengers
Copy link
Copy Markdown
Contributor

No description provided.

mjsprengers and others added 30 commits October 30, 2024 09:21
@mjsprengers
mjsprengers marked this pull request as ready for review March 11, 2026 20:25
@maxhov maxhov left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review

The core wrapper pattern design is solid and consistent. Good test coverage for GCP Compute, Storage, and Google Workspace. The resolveType() / createConvertingAccessor() extension to ConventionContext is well-designed.

See inline comments for specific items to address.

try {
List<Directory> directoryServices = GoogleDirectoryConnectorConfig.GOOGLE_DIRECTORY_SERVICE.getAll( context );
List<Group> list = new ArrayList<>();
List<GoogleGroup> list = new ArrayList<>();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Potential NullPointerException: getGroups() can return null when no groups exist. The same issue applies to all other Google Workspace fetchers (MemberDataFetcher.getMembers(), UserDataFetcher.getUsers(), RoleDataFetcher.getItems(), RoleAssignmentDataFetcher.getItems(), DriveDataFetcher.getDrives()). Consider adding a null check or using a helper like:

List<Group> groups = directory.groups().list().setCustomer("my_customer").execute().getGroups();
if (groups != 
10BC8
null) {
    for (Group group : groups) {
        list.add(new GoogleGroup(group.getId(), group));
    }
}

List<? extends GcpOrganization> organizations = context.getSession().getOrFetch( GcpOrganization.class );
List<? extends GcpFolder> folders = context.getSession().getOrFetch( GcpFolder.class );

for ( CredentialsProvider credentialsProvider : credentialsProviders ) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Duplicate projects: This first calls client.searchProjects("") (returns all projects the caller can see), then also iterates organizations and folders via client.listProjects(parent). This will likely return duplicate projects. Either remove the search call, remove the org/folder iteration, or add deduplication logic.

*/
package com.blazebit.query.connector.google.drive;

public abstract class GoogleWrapper<T> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Duplicate class: This GoogleWrapper<T> is identical to com.blazebit.query.connector.google.directory.GoogleWrapper<T>. Consider extracting a single shared base class (e.g., in a google-base module or the existing connector-base) to avoid duplication.

// queryContextBuilder.setProperty( GoogleDirectoryConnectorConfig.GOOGLE_DIRECTORY_SERVICE.getPropertyName(), createGoogleDirectory() );
// queryContextBuilder.setProperty( GoogleDriveConnectorConfig.GOOGLE_DRIVE_SERVICE.getPropertyName(), createGoogleDrive() );
// queryContextBuilder.setProperty( GcpConnectorConfig.GCP_CREDENTIALS_PROVIDER.getPropertyName(), createGcpCredentialsProvider() );
queryContextBuilder.setProperty( GoogleDirectoryConnectorConfig.GOOGLE_DIRECTORY_SERVICE.getPropertyName(), createGoogleDirectory() );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Debug leftover: These Google/GCP config lines appear to have been uncommented for local testing. They should be re-commented before merge, consistent with the other commented-out providers.

import com.google.cloud.compute.v1.Instance;

public class GcpInstance extends GcpWrapper<Instance> {
public GcpInstance(String resourceId, Instance instance) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: extra space before GcpInstance:

public  GcpInstance(String resourceId, Instance instance) {

should be:

public GcpInstance(String resourceId, Instance instance) {

Expression e3 = toList( (CollectionDataFormat) dataFormatField.getFormat(), elementPhysType, e2,
subBlockBuilder );
subBlockBuilder.add( Expressions.statement( Expressions.assign( resultVar, e3 ) ) );
subBlockBuilder.add( Expressions.statement( Expressions.assign( resultVar,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This wrapping in FakeComparableList is a behavioral change in the core query engine. Could you add a brief comment explaining why this is needed? (e.g., is it for Calcite comparison operations on list types?)

@Override
public Object get(Object o) {
try {
return converterMethod.invoke( null, delegate.get( o ) );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor: the catch block is broad (Exception). Consider catching InvocationTargetException | IllegalAccessException specifically so unexpected runtime exceptions aren't silently wrapped.

@@ -0,0 +1,158 @@
/*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This test class (and GcpBucketTests, GoogleWorkSpaceTests, TestObjects) is in the default package (no package declaration). This works but is unconventional and can cause issues with some tooling. Consider adding a package.

- Make GoogleChromeOsDevice and GoogleMobileDevice extend GoogleWrapper
  for consistent resourceId/payload API across all connectors
- Add workspace-base dependency to endpoint-verification module
- Move test classes from default package to proper package
- Update test queries to use payload accessor (d.payload.status)
- Use device ID as resourceId instead of customer ID
- Revert unrelated Hibernate version bump (will be separate PR)
@maxhov
maxhov merged commit ac21dd1 into Blazebit:main Mar 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0