-
Notifications
You must be signed in to change notification settings - Fork 66
[V1] Defines source and sink APIs for PartiQL data streams. #1655
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
partiql-spi/src/main/java/org/partiql/spi/stream/PSink.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package org.partiql.spi.stream; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.partiql.types.PType; | ||
import org.partiql.value.datetime.Date; | ||
import org.partiql.value.datetime.Time; | ||
import org.partiql.value.datetime.Timestamp; | ||
|
||
import java.math.BigDecimal; | ||
|
||
/** | ||
* This is a PartiQL value stream sink. | ||
* <br> | ||
* Developer Note: | ||
* - There should be a method for every Datum *java* value and all PType arguments. | ||
* - Method names are derived from PType.Kind as pascal case. | ||
*/ | ||
public interface PSink { | ||
|
||
default void close() { | ||
// no-op | ||
} | ||
|
||
default void finish() { | ||
// no-op | ||
} | ||
|
||
default void flush() { | ||
// no-op | ||
} | ||
|
||
void writeNull(); | ||
|
||
void writeMissing(); | ||
|
||
void writeBool(boolean value); | ||
|
||
void writeTinyint(byte value); | ||
|
||
void writeSmallint(short value); | ||
|
||
void writeInt(int value); | ||
|
||
void writeBigint(long value); | ||
|
||
void writeNumeric(@NotNull BigDecimal value); | ||
|
||
void writeNumeric(@NotNull BigDecimal value, int precision); | ||
|
||
void writeNumeric(@NotNull BigDecimal value, int precision, int scale); | ||
|
||
void writeDecimal(@NotNull BigDecimal value); | ||
|
||
void writeDecimal(@NotNull BigDecimal value, int precision); | ||
|
||
void writeDecimal(@NotNull BigDecimal value, int precision, int scale); | ||
|
||
void writeReal(float value); | ||
|
||
void writeDouble(double value); | ||
|
||
void writeChar(@NotNull String value, int length); | ||
|
||
void writeVarchar(@NotNull String value, int length); | ||
|
||
void writeString(@NotNull String value); | ||
|
||
void writeBlob(@NotNull byte[] value, int length); | ||
|
||
void writeClob(@NotNull byte[] value, int length); | ||
|
||
void writeDate(@NotNull Date value); | ||
|
||
void writeTime(@NotNull Time value, int precision); | ||
|
||
void writeTimez(@NotNull Time value, int precision); | ||
|
||
void writeTimestamp(@NotNull Timestamp value, int precision); | ||
|
||
void writeTimestampz(@NotNull Timestamp value, int precision); | ||
|
||
<T> void writeVariant(@NotNull T value); | ||
|
||
void writeVariant(@NotNull String value, @NotNull String encoding); | ||
|
||
void writeVariant(@NotNull byte[] value, @NotNull String encoding); | ||
|
||
void writeField(@NotNull String name); | ||
|
||
void stepIn(@NotNull PType container); | ||
|
||
void stepOut(); | ||
} |
86 changes: 86 additions & 0 deletions
86
partiql-spi/src/main/java/org/partiql/spi/stream/PSource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package org.partiql.spi.stream; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.partiql.types.PType; | ||
import org.partiql.value.datetime.Date; | ||
import org.partiql.value.datetime.Time; | ||
import org.partiql.value.datetime.Timestamp; | ||
|
||
import java.math.BigDecimal; | ||
|
||
/** | ||
* This is a PartiQL value stream source. | ||
* <br> | ||
* Developer Note: | ||
* - There should be a method for every Datum *java* value and all PType arguments. | ||
* - Method names are derived from PType.Kind as pascal case. | ||
*/ | ||
public interface PSource { | ||
|
||
default void close() { | ||
// no-op | ||
} | ||
|
||
/** | ||
* Positions the source to the next value, return its type. | ||
*/ | ||
PType next(); | ||
|
||
void readNull(); | ||
|
||
void readMissing(); | ||
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likely not necessary as these have no effect |
||
|
||
boolean readBool(); | ||
|
||
byte readTinyint(); | ||
|
||
short readSmallint(); | ||
|
||
int readInt(); | ||
|
||
long readBigint(); | ||
|
||
@NotNull | ||
BigDecimal readDecimal(); | ||
|
||
Comment on lines
+43
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing
|
||
float readReal(); | ||
|
||
double readDouble(); | ||
|
||
@NotNull | ||
String readChar(); | ||
|
||
@NotNull | ||
String readVarchar(); | ||
|
||
@NotNull | ||
String readString(); | ||
|
||
@NotNull | ||
byte[] readBlob(); | ||
|
||
@NotNull | ||
byte[] readClob(); | ||
|
||
@NotNull | ||
Date readDate(); | ||
|
||
@NotNull | ||
Time readTime(); | ||
|
||
@NotNull | ||
Time readTimez(); | ||
|
||
@NotNull | ||
Timestamp readTimestamp(); | ||
|
||
@NotNull | ||
Timestamp readTimestampz(); | ||
|
||
@NotNull | ||
String readField(@NotNull String name); | ||
|
||
void stepIn(); | ||
|
||
void stepOut(); | ||
} |
File renamed without changes.
Empty file.
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annotate as nullable