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

Initializes PartiQLCursor and PartiQLValueLoader #1467

Closed
wants to merge 5 commits into from

Conversation

johnedquinn
Copy link
Member

@johnedquinn johnedquinn commented May 16, 2024

Relevant Issues

Description

  • This PR adds a PartiQLCursor to represent a stream of PartiQL data.
  • This has already been approved for the KOW branch. This is a cherry-pick plus the apiDump. See the above linked PR for the original description.

Other Information

  • See linked PR

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@johnedquinn johnedquinn marked this pull request as ready for review May 16, 2024 19:06
@johnedquinn johnedquinn requested a review from RCHowell May 20, 2024 22:40
@@ -1176,7 +1177,7 @@ class PartiQLEngineDefaultTest {
throw returned.cause
}
}
val output = result.value
val output = PartiQLValueLoader.standard().load(result.value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there anything other than "standard"?

* This is only applicable when the current value's type is {@link PartiQLValueType#CHAR}.
*/
@NotNull
String getCharValue();
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
String getCharValue();
Char getCharValue();

Copy link
Member Author

Choose a reason for hiding this comment

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

This method will be deleted in accordance with your other suggestion of following the JVM names. Also, side note, the CHAR datatype in SQL acts more like Java's String.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as PQLValue I was thinking

char --> char(1) -- fixed-length char 1

It should return char[] be called getChars() — at a minimum it should be plural.

/**
* @return a basic implementation of {@link PartiQLValueLoader}.
*/
static PartiQLValueLoader standard() {
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
static PartiQLValueLoader standard() {
static PartiQLValueLoader default() {

Copy link
Member Author

Choose a reason for hiding this comment

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

"default" is a Java keyword. Found this out recently when I was writing Java and was trying to use a method named default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes me wonder if we should be changing the 1.0 builder names ...

Copy link
Contributor

@RCHowell RCHowell left a comment

Choose a reason for hiding this comment

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

One minor change, otherwise looks good.

Comment on lines 103 to 125
/**
* This is applicable to the following types:
* {@link PartiQLValueType#BLOB}
* @return a value representing the applicable PartiQL value
* @throws UnsupportedOperationException when this method is not applicable to the type returned by {@link PartiQLCursor#getType()}
* @throws NullPointerException if this method is invoked when {@link PartiQLCursor#isNull()} returns true
* @apiNote <b>! ! ! EXPERIMENTAL ! ! !</b> This is an experimental API under development by the PartiQL maintainers.
* Please abstain from using this API until given notice otherwise. This may break between iterations without prior notice.
*/
@NotNull
public Blob getBlob() throws UnsupportedOperationException, NullPointerException;

/**
* This is applicable to the following types:
* {@link PartiQLValueType#CLOB}
* @return a value representing the applicable PartiQL value
* @throws UnsupportedOperationException when this method is not applicable to the type returned by {@link PartiQLCursor#getType()}
* @throws NullPointerException if this method is invoked when {@link PartiQLCursor#isNull()} returns true
* @apiNote <b>! ! ! EXPERIMENTAL ! ! !</b> This is an experimental API under development by the PartiQL maintainers.
* Please abstain from using this API until given notice otherwise. This may break between iterations without prior notice.
*/
@NotNull
public Clob getClob() throws UnsupportedOperationException, NullPointerException;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure these are necessary considering you can use getBytes(). I would remove them for the time being so this package has to java.sql dependency.

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK. Just updated to remove for now.

/**
* @return a basic implementation of {@link PartiQLValueLoader}.
*/
static PartiQLValueLoader standard() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes me wonder if we should be changing the 1.0 builder names ...

@johnedquinn johnedquinn requested a review from RCHowell May 31, 2024 17:00
@johnedquinn
Copy link
Member Author

I'd like PartiQLCursor to exist -- however, after some thought, I'd like it to exist in another package (maybe partiql-client). Since users of partiql-eval are supposed to be implementing a PartiQL Server per-se, I figured that the consumption of data over the wire should be exposed by a PartiQL Client. Closing this for now, though this logic can be used in the future.

@johnedquinn johnedquinn closed this Jun 5, 2024
@johnedquinn johnedquinn deleted the v1-cursor branch June 11, 2024 22:10
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