Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Proto Columns to Connection API #2495

Conversation

harshachinta
Copy link
Contributor

Adds support for Proto Columns feature in the Connection API. This is needed to support Proto Columns in the JDBC driver PR-1252.

@harshachinta harshachinta requested review from a team as code owners June 13, 2023 06:19
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner API. labels Jun 13, 2023
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Jun 13, 2023
}

/** Converter for converting String that take in file path as input to String */
static class ProtoDescriptorsFileConverter implements ClientSideStatementValueConverter<String> {
Copy link
Contributor

Choose a reason for hiding this comment

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

We supporting reading from the file here? If Yes where should file be located just on resources or local path ?
We had similar discussion on #2277 (comment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we are supporting reading from a file path given through a client side statement. This is needed to support ORM's and other frameworks. This discussion is available in the design doc.
Just a small brief, in PR#2277, we were treating file as a resource which brings in complications as they rely on class path. However, in this method we instead used File system to read from relative or absolute path.

}

@Override
public byte[] convert(String value) {
Copy link
Contributor

@rajatbhatta rajatbhatta Jun 15, 2023

Choose a reason for hiding this comment

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

Let's also add a NonNull annotation to the argument here. Similarly in other places wherever a null value is not expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These convert methods are not used by customers and is getting called from link. We generally use this annotation to warn users when they pass null. But here it is used in code internally and as users don't use this function, I guess it is not needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is being called from the same package and not meant to be public to customers. Then, should we make the methods package-protected?

Copy link
Collaborator

Choose a reason for hiding this comment

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

These methods cannot be package-private, because they implement a method from an interface. The class itself is package-private, which protects the class and all its methods from being used by 'outside' users.

}

/**
* @return The proto descriptor that will be used with the next DDL statement (single or batch)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @return The proto descriptor that will be used with the next DDL statement (single or batch)
* @return The proto descriptor that will be used only with the next DDL statement (single or batch)

@harshachinta harshachinta requested a review from rajatbhatta June 15, 2023 13:50
}

@Override
public byte[] convert(String value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These methods cannot be package-private, because they implement a method from an interface. The class itself is package-private, which protects the class and all its methods from being used by 'outside' users.

@harshachinta harshachinta deleted the branch googleapis:proto-column-enhancement-alpha January 26, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants