mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-01-27 13:23:11 +00:00
Progressed on port from dotnet to java
This commit is contained in:
@@ -11,6 +11,7 @@ import com.azure.data.cosmos.serialization.hybridrow.Result;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap;
|
import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap;
|
||||||
@@ -11,10 +11,13 @@ import com.azure.data.cosmos.serialization.hybridrow.Result;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowWriter;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowWriter;
|
||||||
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
public final class SegmentSerializer {
|
public final class SegmentSerializer {
|
||||||
@@ -32,15 +35,15 @@ public final class SegmentSerializer {
|
|||||||
|
|
||||||
segment.set(new Segment(null, null));
|
segment.set(new Segment(null, null));
|
||||||
|
|
||||||
final Out<Utf8String> comment = new Out<>();
|
final Out<String> comment = new Out<>();
|
||||||
final Out<Integer> length = new Out<>();
|
final Out<Integer> length = new Out<>();
|
||||||
final Out<Utf8String> sdl = new Out<>();
|
final Out<String> sdl = new Out<>();
|
||||||
|
|
||||||
while (reader.read()) {
|
while (reader.read()) {
|
||||||
|
|
||||||
// TODO: Use Path tokens here.
|
// TODO: Use Path tokens here.
|
||||||
|
|
||||||
switch (reader.path().toString()) {
|
switch (Objects.requireNonNull(reader.path().toUtf16())) {
|
||||||
|
|
||||||
case "length": {
|
case "length": {
|
||||||
|
|
||||||
@@ -61,7 +64,7 @@ public final class SegmentSerializer {
|
|||||||
case "comment": {
|
case "comment": {
|
||||||
|
|
||||||
Result result = reader.readString(comment);
|
Result result = reader.readString(comment);
|
||||||
segment.get().comment(comment.get().toUtf16());
|
segment.get().comment(comment.get());
|
||||||
|
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
@@ -72,7 +75,7 @@ public final class SegmentSerializer {
|
|||||||
case "sdl": {
|
case "sdl": {
|
||||||
|
|
||||||
Result result = reader.readString(sdl);
|
Result result = reader.readString(sdl);
|
||||||
segment.get().sdl(sdl.get().toUtf16());
|
segment.get().sdl(sdl.get());
|
||||||
|
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
@@ -6,15 +6,15 @@ package com.azure.data.cosmos.serialization.hybridrow;
|
|||||||
/**
|
/**
|
||||||
* The literal null value.
|
* The literal null value.
|
||||||
* <p>
|
* <p>
|
||||||
* May be stored hybrid row to indicate the literal null value. Typically this value should
|
* May be stored hybrid row to indicate the literal null value. Typically this value should not be used and the
|
||||||
* not be used and the corresponding column should be absent from the row.
|
* corresponding column should be absent from the row.
|
||||||
*/
|
*/
|
||||||
public final class NullValue {
|
public final class NullValue {
|
||||||
/**
|
/**
|
||||||
* The default null literal.
|
* The default null literal.
|
||||||
* This is the same value as default({@link NullValue}).
|
* This is the same value as default({@link NullValue}).
|
||||||
*/
|
*/
|
||||||
public static final NullValue Default = new NullValue();
|
public static final NullValue DEFAULT = new NullValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this is the same value as {@code other}.
|
* Returns true if this is the same value as {@code other}.
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ public final class RowBuffer {
|
|||||||
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.NULL);
|
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.NULL);
|
||||||
edit.endOffset(edit.valueOffset());
|
edit.endOffset(edit.valueOffset());
|
||||||
|
|
||||||
return NullValue.Default;
|
return NullValue.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Utf8String readSparsePath(@Nonnull final RowCursor edit) {
|
public Utf8String readSparsePath(@Nonnull final RowCursor edit) {
|
||||||
@@ -843,22 +843,22 @@ public final class RowBuffer {
|
|||||||
*
|
*
|
||||||
* @param edit The iterator to advance.
|
* @param edit The iterator to advance.
|
||||||
*
|
*
|
||||||
* <paramref name="edit.Path">
|
* {@code edit.Path}
|
||||||
* On success, the path of the field at the given offset, otherwise
|
* On success, the path of the field at the given offset, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.MetaOffset">
|
* {@code edit.MetaOffset}
|
||||||
* If found, the offset to the metadata of the field, otherwise a
|
* If found, the offset to the metadata of the field, otherwise a
|
||||||
* location to insert the field.
|
* location to insert the field.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.cellType">
|
* {@code edit.cellType}
|
||||||
* If found, the layout code of the matching field found, otherwise
|
* If found, the layout code of the matching field found, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.ValueOffset">
|
* {@code edit.ValueOffset}
|
||||||
* If found, the offset to the value of the field, otherwise
|
* If found, the offset to the value of the field, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>.
|
*.
|
||||||
*
|
*
|
||||||
* @return {@code true} if there is another field; {@code false} if there is not.
|
* @return {@code true} if there is another field; {@code false} if there is not.
|
||||||
*/
|
*/
|
||||||
@@ -2814,26 +2814,26 @@ public final class RowBuffer {
|
|||||||
*
|
*
|
||||||
* @param edit The edit structure to fill in.
|
* @param edit The edit structure to fill in.
|
||||||
*
|
*
|
||||||
* <paramref name="edit.Path">
|
* {@code edit.Path}
|
||||||
* On success, the path of the field at the given offset, otherwise
|
* On success, the path of the field at the given offset, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.MetaOffset">
|
* {@code edit.MetaOffset}
|
||||||
* On success, the offset to the metadata of the field, otherwise a
|
* On success, the offset to the metadata of the field, otherwise a
|
||||||
* location to insert the field.
|
* location to insert the field.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.cellType">
|
* {@code edit.cellType}
|
||||||
* On success, the layout code of the existing field, otherwise
|
* On success, the layout code of the existing field, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.TypeArgs">
|
* {@code edit.TypeArgs}
|
||||||
* On success, the type args of the existing field, otherwise
|
* On success, the type args of the existing field, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>
|
*
|
||||||
* <paramref name="edit.ValueOffset">
|
* {@code edit.ValueOffset}
|
||||||
* On success, the offset to the value of the field, otherwise
|
* On success, the offset to the value of the field, otherwise
|
||||||
* undefined.
|
* undefined.
|
||||||
* </paramref>.
|
*.
|
||||||
*/
|
*/
|
||||||
private void readSparseMetadata(@Nonnull final RowCursor edit) {
|
private void readSparseMetadata(@Nonnull final RowCursor edit) {
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursors;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursors;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutSpanReadable;
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUtf8Readable;
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBinary;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBinary;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBoolean;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBoolean;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
||||||
@@ -30,7 +28,9 @@ import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt64;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt8;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt8;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNull;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNull;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNullable;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNullable;
|
||||||
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutListReadable;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypePrimitive;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUDT;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUDT;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt16;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt16;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt32;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt32;
|
||||||
@@ -126,7 +126,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length {@code MongoDbObjectId} value
|
* Read the current field as a fixed length {@code MongoDbObjectId} value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result ReadMongoDbObjectId(Out<?/* MongoDbObjectID */> value) {
|
public Result ReadMongoDbObjectId(Out<?/* MongoDbObjectID */> value) {
|
||||||
// TODO: DANOBLE: Resurrect this method
|
// TODO: DANOBLE: Resurrect this method
|
||||||
@@ -150,22 +150,6 @@ public final class RowReader {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Read the current field as a variable length, UTF-8 encoded string value
|
|
||||||
*
|
|
||||||
* @param value On success, receives the value, undefined otherwise
|
|
||||||
* @return Success if the read is successful, an error code otherwise
|
|
||||||
*/
|
|
||||||
public Result ReadString(Out<String> value) {
|
|
||||||
|
|
||||||
Out<Utf8String> string = new Out<>();
|
|
||||||
Result result = this.readString(string);
|
|
||||||
value.set((result == Result.SUCCESS) ? string.get().toUtf16() : null);
|
|
||||||
string.get().release();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code true} if field has a value--if positioned on a field--undefined otherwise
|
* {@code true} if field has a value--if positioned on a field--undefined otherwise
|
||||||
* <p>
|
* <p>
|
||||||
@@ -264,64 +248,54 @@ public final class RowReader {
|
|||||||
*/
|
*/
|
||||||
public boolean read() {
|
public boolean read() {
|
||||||
|
|
||||||
switch (this.state) {
|
for (; ; ) {
|
||||||
|
|
||||||
case NONE: {
|
switch (this.state) {
|
||||||
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
|
||||||
this.state = States.SCHEMATIZED;
|
case NONE: {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
this.state = this.cursor.scopeType() instanceof LayoutUDT ? States.SCHEMATIZED : States.SPARSE;
|
||||||
// goto case States.Schematized;
|
break;
|
||||||
} else {
|
|
||||||
this.state = States.SPARSE;
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
|
||||||
// goto case States.Sparse;
|
|
||||||
}
|
}
|
||||||
}
|
case SCHEMATIZED: {
|
||||||
case SCHEMATIZED: {
|
|
||||||
|
|
||||||
this.columnIndex++;
|
this.columnIndex++;
|
||||||
|
|
||||||
if (this.columnIndex >= this.schematizedCount) {
|
if (this.columnIndex >= this.schematizedCount) {
|
||||||
this.state = States.SPARSE;
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
this.state = States.SPARSE;
|
||||||
// goto case States.Sparse;
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
checkState(this.cursor.scopeType() instanceof LayoutUDT);
|
||||||
|
LayoutColumn column = this.columns.get(this.columnIndex);
|
||||||
|
|
||||||
|
if (!this.row.readBit(this.cursor.start(), column.nullBit())) {
|
||||||
|
break; // to skip schematized values if they aren't present
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
case SPARSE: {
|
||||||
|
|
||||||
checkState(this.cursor.scopeType() instanceof LayoutUDT);
|
if (!RowCursors.moveNext(this.cursor, this.row)) {
|
||||||
LayoutColumn column = this.columns.get(this.columnIndex);
|
this.state = States.DONE;
|
||||||
|
break;
|
||||||
if (!this.row.readBit(this.cursor.start(), column.nullBit())) {
|
}
|
||||||
// Skip schematized values if they aren't present
|
return true;
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
|
||||||
// goto case States.Schematized;
|
|
||||||
}
|
}
|
||||||
|
case DONE: {
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
case SPARSE: {
|
|
||||||
|
|
||||||
if (!RowCursors.moveNext(this.cursor, this.row)) {
|
|
||||||
this.state = States.DONE;
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
|
||||||
// goto case States.Done;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DONE: {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a variable length, sequence of bytes
|
* Read the current field as a variable length, sequence of bytes
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readBinary(Out<ByteBuf> value) {
|
public Result readBinary(Out<ByteBuf> value) {
|
||||||
|
|
||||||
@@ -336,6 +310,7 @@ public final class RowReader {
|
|||||||
value.set(null);
|
value.set(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.set(this.row.readSparseBinary(this.cursor));
|
value.set(this.row.readSparseBinary(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
@@ -349,7 +324,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a variable length, sequence of bytes
|
* Read the current field as a variable length, sequence of bytes
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readBinaryArray(Out<byte[]> value) {
|
public Result readBinaryArray(Out<byte[]> value) {
|
||||||
|
|
||||||
@@ -369,7 +344,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a {@link Boolean}
|
* Read the current field as a {@link Boolean}
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readBoolean(Out<Boolean> value) {
|
public Result readBoolean(Out<Boolean> value) {
|
||||||
|
|
||||||
@@ -397,7 +372,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length {@code DateTime} value
|
* Read the current field as a fixed length {@code DateTime} value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readDateTime(Out<OffsetDateTime> value) {
|
public Result readDateTime(Out<OffsetDateTime> value) {
|
||||||
|
|
||||||
@@ -425,7 +400,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length decimal value
|
* Read the current field as a fixed length decimal value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readDecimal(Out<BigDecimal> value) {
|
public Result readDecimal(Out<BigDecimal> value) {
|
||||||
|
|
||||||
@@ -452,7 +427,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 128-bit, IEEE-encoded floating point value
|
* Read the current field as a fixed length, 128-bit, IEEE-encoded floating point value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readFloat128(Out<Float128> value) {
|
public Result readFloat128(Out<Float128> value) {
|
||||||
|
|
||||||
@@ -479,7 +454,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 32-bit, IEEE-encoded floating point value
|
* Read the current field as a fixed length, 32-bit, IEEE-encoded floating point value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readFloat32(Out<Float> value) {
|
public Result readFloat32(Out<Float> value) {
|
||||||
|
|
||||||
@@ -506,7 +481,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 64-bit, IEEE-encoded floating point value
|
* Read the current field as a fixed length, 64-bit, IEEE-encoded floating point value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readFloat64(Out<Double> value) {
|
public Result readFloat64(Out<Double> value) {
|
||||||
|
|
||||||
@@ -533,7 +508,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length GUID value
|
* Read the current field as a fixed length GUID value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readGuid(Out<UUID> value) {
|
public Result readGuid(Out<UUID> value) {
|
||||||
|
|
||||||
@@ -561,7 +536,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 16-bit, signed integer
|
* Read the current field as a fixed length, 16-bit, signed integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readInt16(Out<Short> value) {
|
public Result readInt16(Out<Short> value) {
|
||||||
|
|
||||||
@@ -588,7 +563,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 32-bit, signed integer
|
* Read the current field as a fixed length, 32-bit, signed integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readInt32(Out<Integer> value) {
|
public Result readInt32(Out<Integer> value) {
|
||||||
|
|
||||||
@@ -615,7 +590,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 64-bit, signed integer
|
* Read the current field as a fixed length, 64-bit, signed integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readInt64(Out<Long> value) {
|
public Result readInt64(Out<Long> value) {
|
||||||
|
|
||||||
@@ -642,7 +617,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 8-bit, signed integer
|
* Read the current field as a fixed length, 8-bit, signed integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readInt8(Out<Byte> value) {
|
public Result readInt8(Out<Byte> value) {
|
||||||
|
|
||||||
@@ -669,7 +644,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a null
|
* Read the current field as a null
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readNull(Out<NullValue> value) {
|
public Result readNull(Out<NullValue> value) {
|
||||||
|
|
||||||
@@ -693,7 +668,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a nested, structured, sparse scope
|
* Read the current field as a nested, structured, sparse scope.
|
||||||
* <p>
|
* <p>
|
||||||
* Child readers can be used to read all sparse scope types including typed and untyped objects, arrays, tuples,
|
* Child readers can be used to read all sparse scope types including typed and untyped objects, arrays, tuples,
|
||||||
* set, and maps.
|
* set, and maps.
|
||||||
@@ -717,9 +692,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a nested, structured, sparse scope
|
* Read the current field as a nested, structured, sparse scope
|
||||||
* <p>
|
* <p>
|
||||||
* Child readers can be used to read all sparse scope types including typed and untyped objects, arrays, tuples,
|
* Child readers can be used to read all sparse scope types including typed and untyped objects, arrays, tuples,
|
||||||
* set, and maps.
|
* set, and maps. Nested child readers are independent of their parent.
|
||||||
* <p>
|
|
||||||
* Nested child readers are independent of their parent.
|
|
||||||
*/
|
*/
|
||||||
public @Nonnull RowReader readScope() {
|
public @Nonnull RowReader readScope() {
|
||||||
RowCursor newScope = this.row.sparseIteratorReadScope(this.cursor, true);
|
RowCursor newScope = this.row.sparseIteratorReadScope(this.cursor, true);
|
||||||
@@ -727,12 +700,28 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a variable length, UTF-8 encoded, string value
|
* Read the current field as a variable length, UTF-8 encoded string value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readString(Out<Utf8String> value) {
|
public Result readString(Out<String> value) {
|
||||||
|
|
||||||
|
Out<Utf8String> string = new Out<>();
|
||||||
|
Result result = this.readUtf8String(string);
|
||||||
|
value.set((result == Result.SUCCESS) ? string.get().toUtf16() : null);
|
||||||
|
string.get().release();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the current field as a variable length, UTF-8 encoded, string value.
|
||||||
|
*
|
||||||
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
|
*/
|
||||||
|
public Result readUtf8String(Out<Utf8String> value) {
|
||||||
|
|
||||||
switch (this.state) {
|
switch (this.state) {
|
||||||
|
|
||||||
@@ -754,10 +743,10 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a fixed length, 16-bit, unsigned integer
|
* Read the current field as a fixed length, 16-bit, unsigned integer.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readUInt16(Out<Integer> value) {
|
public Result readUInt16(Out<Integer> value) {
|
||||||
|
|
||||||
@@ -784,7 +773,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 32-bit, unsigned integer
|
* Read the current field as a fixed length, 32-bit, unsigned integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readUInt32(Out<Long> value) {
|
public Result readUInt32(Out<Long> value) {
|
||||||
|
|
||||||
@@ -812,7 +801,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 64-bit, unsigned integer
|
* Read the current field as a fixed length, 64-bit, unsigned integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readUInt64(Out<Long> value) {
|
public Result readUInt64(Out<Long> value) {
|
||||||
|
|
||||||
@@ -839,7 +828,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length, 8-bit, unsigned integer
|
* Read the current field as a fixed length, 8-bit, unsigned integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readUInt8(Out<Short> value) {
|
public Result readUInt8(Out<Short> value) {
|
||||||
|
|
||||||
@@ -866,7 +855,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a fixed length {@link UnixDateTime} value
|
* Read the current field as a fixed length {@link UnixDateTime} value
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readUnixDateTime(Out<UnixDateTime> value) {
|
public Result readUnixDateTime(Out<UnixDateTime> value) {
|
||||||
|
|
||||||
@@ -893,7 +882,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a variable length, 7-bit encoded, signed integer
|
* Read the current field as a variable length, 7-bit encoded, signed integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readVarInt(Out<Long> value) {
|
public Result readVarInt(Out<Long> value) {
|
||||||
|
|
||||||
@@ -920,7 +909,7 @@ public final class RowReader {
|
|||||||
* Read the current field as a variable length, 7-bit encoded, unsigned integer
|
* Read the current field as a variable length, 7-bit encoded, unsigned integer
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result readVarUInt(Out<Long> value) {
|
public Result readVarUInt(Out<Long> value) {
|
||||||
|
|
||||||
@@ -1012,14 +1001,14 @@ public final class RowReader {
|
|||||||
* Reads a generic schematized field value via the scope's layout
|
* Reads a generic schematized field value via the scope's layout
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TValue> Result readPrimitiveValue(Out<TValue> value) {
|
private <TValue> Result readPrimitiveValue(Out<TValue> value) {
|
||||||
|
|
||||||
final LayoutColumn column = this.columns.get(this.columnIndex);
|
final LayoutColumn column = this.columns.get(this.columnIndex);
|
||||||
final LayoutType type = this.columns.get(this.columnIndex).type();
|
final LayoutType type = this.columns.get(this.columnIndex).type();
|
||||||
|
|
||||||
if (!(type instanceof LayoutType<TValue>)) {
|
if (!(type instanceof LayoutTypePrimitive)) {
|
||||||
value.set(null);
|
value.set(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
@@ -1028,42 +1017,9 @@ public final class RowReader {
|
|||||||
|
|
||||||
switch (storage) {
|
switch (storage) {
|
||||||
case FIXED:
|
case FIXED:
|
||||||
return type.<LayoutType<TValue>>typeAs().readFixed(this.row, this.cursor, column, value);
|
return type.<LayoutTypePrimitive<TValue>>typeAs().readFixed(this.row, this.cursor, column, value);
|
||||||
case VARIABLE:
|
case VARIABLE:
|
||||||
return type.<LayoutType<TValue>>typeAs().readVariable(this.row, this.cursor, column, value);
|
return type.<LayoutTypePrimitive<TValue>>typeAs().readVariable(this.row, this.cursor, column, value);
|
||||||
default:
|
|
||||||
assert false : lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
|
||||||
value.set(null);
|
|
||||||
return Result.FAILURE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a generic schematized field value via the scope's layout
|
|
||||||
*
|
|
||||||
* @param value On success, receives the value, undefined otherwise
|
|
||||||
* @return {@link Result#SUCCESS} if the read is successful; an error {@link Result} otherwise
|
|
||||||
*/
|
|
||||||
private Result readPrimitiveValue(Out<Utf8String> value) {
|
|
||||||
|
|
||||||
LayoutColumn column = this.columns.get(this.columnIndex);
|
|
||||||
LayoutType type = this.columns.get(this.columnIndex).type();
|
|
||||||
|
|
||||||
if (!(type instanceof LayoutUtf8Readable)) {
|
|
||||||
value.set(null);
|
|
||||||
return Result.TYPE_MISMATCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
StorageKind storage = column == null ? StorageKind.NONE : column.storage();
|
|
||||||
|
|
||||||
switch (storage) {
|
|
||||||
|
|
||||||
case FIXED:
|
|
||||||
return type.<LayoutUtf8Readable>typeAs().readFixed(this.row, this.cursor, column, value);
|
|
||||||
|
|
||||||
case VARIABLE:
|
|
||||||
return type.<LayoutUtf8Readable>typeAs().readVariable(this.row, this.cursor, column, value);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert false : lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
assert false : lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
||||||
value.set(null);
|
value.set(null);
|
||||||
@@ -1071,19 +1027,52 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Reads a generic schematized field value via the scope's layout
|
||||||
|
// *
|
||||||
|
// * @param value On success, receives the value, undefined otherwise
|
||||||
|
// * @return {@link Result#SUCCESS} if the read is successful; an error {@link Result} otherwise
|
||||||
|
// */
|
||||||
|
// private Result readPrimitiveValue(Out<Utf8String> value) {
|
||||||
|
//
|
||||||
|
// LayoutColumn column = this.columns.get(this.columnIndex);
|
||||||
|
// LayoutType type = this.columns.get(this.columnIndex).type();
|
||||||
|
//
|
||||||
|
// if (!(type instanceof LayoutUtf8Readable)) {
|
||||||
|
// value.set(null);
|
||||||
|
// return Result.TYPE_MISMATCH;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// StorageKind storage = column == null ? StorageKind.NONE : column.storage();
|
||||||
|
//
|
||||||
|
// switch (storage) {
|
||||||
|
//
|
||||||
|
// case FIXED:
|
||||||
|
// return type.<LayoutUtf8Readable>typeAs().readFixed(this.row, this.cursor, column, value);
|
||||||
|
//
|
||||||
|
// case VARIABLE:
|
||||||
|
// return type.<LayoutUtf8Readable>typeAs().readVariable(this.row, this.cursor, column, value);
|
||||||
|
//
|
||||||
|
// default:
|
||||||
|
// assert false : lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
||||||
|
// value.set(null);
|
||||||
|
// return Result.FAILURE;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
/**
|
/**
|
||||||
* Reads a generic schematized field value via the scope's layout
|
* Reads a generic schematized field value via the scope's layout
|
||||||
*
|
*
|
||||||
* @param <TElement> The sub-element type of the field
|
* @param <TElement> The sub-element type of the field
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return Success if the read is successful, an error code otherwise
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TElement> Result readPrimitiveValue(Out<List<TElement>> value) {
|
private <TElement> Result readPrimitiveValueList(Out<List<TElement>> value) {
|
||||||
|
|
||||||
LayoutColumn column = this.columns.get(this.columnIndex);
|
LayoutColumn column = this.columns.get(this.columnIndex);
|
||||||
LayoutType type = this.columns.get(this.columnIndex).type();
|
LayoutType type = this.columns.get(this.columnIndex).type();
|
||||||
|
|
||||||
if (!(type instanceof LayoutSpanReadable<?>)) {
|
if (!(type instanceof LayoutListReadable<?>)) {
|
||||||
value.set(null);
|
value.set(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
@@ -1093,10 +1082,10 @@ public final class RowReader {
|
|||||||
switch (storage) {
|
switch (storage) {
|
||||||
|
|
||||||
case FIXED:
|
case FIXED:
|
||||||
return type.<LayoutSpanReadable<TElement>>typeAs().readFixed(this.row, this.cursor, column, value);
|
return type.<LayoutListReadable<TElement>>typeAs().readFixedList(this.row, this.cursor, column, value);
|
||||||
|
|
||||||
case VARIABLE:
|
case VARIABLE:
|
||||||
return type.<LayoutSpanReadable<TElement>>typeAs().readVariable(this.row, this.cursor, column, value);
|
return type.<LayoutListReadable<TElement>>typeAs().readVariableList(this.row, this.cursor, column, value);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert false : lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
assert false : lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public final class RowReaderExtensions {
|
|||||||
/**
|
/**
|
||||||
* Read the current field as a nested, structured, sparse scope containing a linear collection of zero or more
|
* Read the current field as a nested, structured, sparse scope containing a linear collection of zero or more
|
||||||
* items.
|
* items.
|
||||||
* <typeparam name="TItem">The type of the items within the collection.</typeparam>
|
* @param <TItem> The type of the items within the collection.
|
||||||
*
|
*
|
||||||
* @param reader A forward-only cursor for reading the collection.
|
* @param reader A forward-only cursor for reading the collection.
|
||||||
* @param deserializer A function that reads one item from the collection.
|
* @param deserializer A function that reads one item from the collection.
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ import com.azure.data.cosmos.serialization.hybridrow.RowCursors;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
||||||
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutListWritable;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNullable;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNullable;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutSpanWritable;
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypePrimitive;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedMap;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedMap;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypes;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypes;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUDT;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUDT;
|
||||||
@@ -30,10 +31,12 @@ import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.UpdateOptions;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.UpdateOptions;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind;
|
import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public final class RowWriter {
|
public final class RowWriter {
|
||||||
|
|
||||||
@@ -80,11 +83,10 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteBinary(UtfAnyString path, byte[] value) {
|
public Result WriteBinary(UtfAnyString path, byte[] value) {
|
||||||
return this.writePrimitive(path, value, LayoutTypes.BINARY,
|
return this.WriteBinary(path, Unpooled.wrappedBuffer(value));
|
||||||
(ref RowWriter w, byte[] v) -> w.row.writeSparseBinary(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,24 +94,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteBinary(UtfAnyString path, ByteBuf value) {
|
public Result WriteBinary(UtfAnyString path, ByteBuf value) {
|
||||||
return this.writePrimitive(path, value, LayoutTypes.BINARY,
|
return this.writePrimitive(path, value, LayoutTypes.BINARY, (ByteBuf v) ->
|
||||||
(ref RowWriter w, ByteBuf v) -> w.row.writeSparseBinary(ref w.cursor, v, UpdateOptions.UPSERT));
|
this.row.writeSparseBinary(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a field as a variable length, sequence of bytes.
|
|
||||||
*
|
|
||||||
* @param path The scope-relative path of the field to write.
|
|
||||||
* @param value The value to write.
|
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
|
||||||
*/
|
|
||||||
public Result WriteBinary(UtfAnyString path, ReadOnlySequence<Byte> value) {
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.BINARY,
|
|
||||||
(ref RowWriter w, ReadOnlySequence<Byte> v) -> w.row.writeSparseBinary(ref w.cursor, v,
|
|
||||||
UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,21 +106,21 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteBoolean(UtfAnyString path, boolean value) {
|
public Result WriteBoolean(UtfAnyString path, boolean value) {
|
||||||
return this.writePrimitive(path, value, LayoutTypes.BOOLEAN,
|
return this.writePrimitive(path, value, LayoutTypes.BOOLEAN, (Boolean v) ->
|
||||||
(ref RowWriter w, boolean v) -> w.row.writeSparseBool(ref w.cursor, v, UpdateOptions.UPSERT));
|
this.row.writeSparseBoolean(this.cursor, value, UpdateOptions.UPSERT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write an entire row in a streaming left-to-right way.
|
* Write an entire row in a streaming left-to-right way.
|
||||||
* <typeparam name="TContext">The type of the context value to pass to <paramref name="func" />.</typeparam>
|
|
||||||
*
|
*
|
||||||
* @param row The row to write.
|
* @param <TContext> The type of the context value to pass to {@code func}.
|
||||||
* @param context A context value to pass to <paramref name="func" />.
|
* @param row The row to write.
|
||||||
* @param func A function to write the entire row.
|
* @param context A context value to pass to {@code func}.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @param func A function to write the entire row.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public static <TContext> Result WriteBuffer(
|
public static <TContext> Result WriteBuffer(
|
||||||
Reference<RowBuffer> row, TContext context, WriterFunc<TContext> func) {
|
Reference<RowBuffer> row, TContext context, WriterFunc<TContext> func) {
|
||||||
@@ -152,35 +141,27 @@ public final class RowWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a field as a fixed length {@link DateTime} value.
|
* Write a field as a fixed length {@code DateTime} value.
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteDateTime(UtfAnyString path, LocalDateTime value) {
|
public Result writeDateTime(UtfAnyString path, OffsetDateTime value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.DATE_TIME, (OffsetDateTime v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseDateTime(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.DATE_TIME,
|
|
||||||
(ref RowWriter w, LocalDateTime v) -> w.row.writeSparseDateTime(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a field as a fixed length {@link decimal} value.
|
* Write a field as a fixed length {@code Decimal} value.
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteDecimal(UtfAnyString path, BigDecimal value) {
|
public Result writeDecimal(UtfAnyString path, BigDecimal value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.DECIMAL, (BigDecimal v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseDecimal(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.DECIMAL,
|
|
||||||
(ref RowWriter w, BigDecimal v) -> w.row.writeSparseDecimal(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,15 +169,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteFloat128(UtfAnyString path, Float128 value) {
|
public Result writeFloat128(UtfAnyString path, Float128 value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.FLOAT_128, (Float128 v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseFloat128(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.FLOAT_128,
|
|
||||||
(ref RowWriter w, Float128 v) -> w.row.writeSparseFloat128(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,15 +181,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteFloat32(UtfAnyString path, float value) {
|
public Result writeFloat32(UtfAnyString path, float value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.FLOAT_32, (Float v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseFloat32(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.FLOAT_32,
|
|
||||||
(ref RowWriter w, float v) -> w.row.writeSparseFloat32(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,31 +193,23 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteFloat64(UtfAnyString path, double value) {
|
public Result writeFloat64(UtfAnyString path, double value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.FLOAT_64, (Double v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseFloat64(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.FLOAT_64,
|
|
||||||
(ref RowWriter w, double v) -> w.row.writeSparseFloat64(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a field as a fixed length {@link Guid} value.
|
* Write a field as a fixed length {@code Guid} value.
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteGuid(UtfAnyString path, UUID value) {
|
public Result writeGuid(UtfAnyString path, UUID value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.GUID, (UUID v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseGuid(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.GUID,
|
|
||||||
(ref RowWriter w, UUID v) -> w.row.writeSparseGuid(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,31 +217,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteInt16(UtfAnyString path, short value) {
|
public Result writeInt16(UtfAnyString path, short value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.INT_16, (Short v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseInt16(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.INT_16,
|
|
||||||
(ref RowWriter w, short v) -> w.row.writeSparseInt16(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a field as a fixed length, 32-bit, signed integer.
|
|
||||||
*
|
|
||||||
* @param path The scope-relative path of the field to write.
|
|
||||||
* @param value The value to write.
|
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
|
||||||
*/
|
|
||||||
public Result writeInt32(UtfAnyString path, int value) {
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
|
||||||
// converted by C# to Java Converter:
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.INT_32,
|
|
||||||
(ref RowWriter w, int v) -> w.row.writeSparseInt32(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,15 +229,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteInt64(UtfAnyString path, long value) {
|
public Result writeInt64(UtfAnyString path, long value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.INT_64, (Long v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseInt64(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.INT_64,
|
|
||||||
(ref RowWriter w, long v) -> w.row.writeSparseInt64(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -300,15 +241,22 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result WriteInt8(UtfAnyString path, byte value) {
|
public Result writeInt8(UtfAnyString path, byte value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.INT_8, (Byte v) ->
|
||||||
// converted by C# to Java Converter:
|
this.row.writeSparseInt8(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
}
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.INT_8,
|
/**
|
||||||
(ref RowWriter w, byte v) -> w.row.writeSparseInt8(ref w.cursor, v, UpdateOptions.UPSERT));
|
* Write a field as a {@code null}.
|
||||||
|
*
|
||||||
|
* @param path The scope-relative path of the field to write.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
|
*/
|
||||||
|
public Result writeNull(UtfAnyString path) {
|
||||||
|
return this.writePrimitive(path, NullValue.DEFAULT, LayoutTypes.NULL, (NullValue v) ->
|
||||||
|
this.row.writeSparseNull(this.cursor, v, UpdateOptions.UPSERT));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: DANOBLE: Resurrect this method
|
// TODO: DANOBLE: Resurrect this method
|
||||||
@@ -317,27 +265,18 @@ public final class RowWriter {
|
|||||||
// *
|
// *
|
||||||
// * @param path The scope-relative path of the field to write.
|
// * @param path The scope-relative path of the field to write.
|
||||||
// * @param value The value to write.
|
// * @param value The value to write.
|
||||||
// * @return Success if the write is successful, an error code otherwise.
|
// * @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
// */
|
// */
|
||||||
// public Result WriteMongoDbObjectId(UtfAnyString path, MongoDbObjectId value) {
|
// public Result WriteMongoDbObjectId(UtfAnyString path, MongoDbObjectId value) {
|
||||||
// throw new UnsupportedOperationException();
|
// throw new UnsupportedOperationException();
|
||||||
// // return this.writePrimitive(path, value, LayoutTypes.MongoDbObjectId, (ref RowWriter w, MongoDbObjectId v) -> w.row.writeSparseMongoDbObjectId(ref w.cursor, v, UpdateOptions.UPSERT));
|
// // return this.writePrimitive(path, value, LayoutTypes.MongoDbObjectId, (ref RowWriter w, MongoDbObjectId v) -> w.row.writeSparseMongoDbObjectId(ref w.cursor, v, UpdateOptions.UPSERT));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
public <TContext> Result WriteScope(
|
||||||
* Write a field as a {@link t:null}.
|
UtfAnyString path, TypeArgument typeArg, TContext context, WriterFunc<TContext> func) {
|
||||||
*
|
|
||||||
* @param path The scope-relative path of the field to write.
|
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
|
||||||
*/
|
|
||||||
public Result WriteNull(UtfAnyString path) {
|
|
||||||
return this.writePrimitive(path, NullValue.Default, LayoutTypes.NULL,
|
|
||||||
(ref RowWriter w, NullValue v) -> w.row.writeSparseNull(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
|
||||||
|
|
||||||
public <TContext> Result WriteScope(UtfAnyString path, TypeArgument typeArg, TContext context,
|
|
||||||
WriterFunc<TContext> func) {
|
|
||||||
LayoutType type = typeArg.type();
|
LayoutType type = typeArg.type();
|
||||||
|
|
||||||
Result result = this.prepareSparseWrite(path, typeArg);
|
Result result = this.prepareSparseWrite(path, typeArg);
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
@@ -543,16 +482,15 @@ public final class RowWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a field as a variable length, UTF8 encoded, string value.
|
* Write a field as a fixed length, 32-bit, signed integer.
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result writeString(UtfAnyString path, String value) {
|
public Result writeInt32(UtfAnyString path, int value) {
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UTF_8,
|
return this.writePrimitive(path, value, LayoutTypes.INT_32, (RowWriter writer, int v) ->
|
||||||
(ref RowWriter w, String v) -> w.row.writeSparseString(ref w.cursor, Utf8Span.TranscodeUtf16(v),
|
writer.row.writeSparseInt32(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -560,15 +498,30 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
|
*/
|
||||||
|
public Result writeString(UtfAnyString path, String value) {
|
||||||
|
// TODO: DANOBLE: RowBuffer should support writing String values directly (without conversion to Utf8String)
|
||||||
|
Utf8String string = Utf8String.transcodeUtf16(value);
|
||||||
|
assert string != null;
|
||||||
|
try {
|
||||||
|
return this.writePrimitive(path, value, LayoutTypes.UTF_8, (RowWriter writer, String v) ->
|
||||||
|
writer.row.writeSparseString(writer.cursor, string, UpdateOptions.UPSERT));
|
||||||
|
} finally {
|
||||||
|
string.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a field as a variable length, UTF8 encoded, string value.
|
||||||
|
*
|
||||||
|
* @param path The scope-relative path of the field to write.
|
||||||
|
* @param value The value to write.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result writeString(UtfAnyString path, Utf8String value) {
|
public Result writeString(UtfAnyString path, Utf8String value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.UTF_8, (RowWriter writer, Utf8String v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseString(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UTF_8,
|
|
||||||
(ref RowWriter w, Utf8Span v) -> w.row.writeSparseString(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -576,20 +529,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: public Result WriteUInt16(UtfAnyString path, ushort value)
|
|
||||||
public Result writeUInt16(UtfAnyString path, short value) {
|
public Result writeUInt16(UtfAnyString path, short value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.UINT_16, (RowWriter writer, short v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseUInt16(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: return this.writePrimitive(path, value, LayoutTypes.UInt16, (ref RowWriter w, ushort v) => w
|
|
||||||
// .row.writeSparseUInt16(ref w.cursor, v, UpdateOptions.Upsert));
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UINT_16,
|
|
||||||
(ref RowWriter w, short v) -> w.row.writeSparseUInt16(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -597,20 +541,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: public Result WriteUInt32(UtfAnyString path, uint value)
|
|
||||||
public Result writeUInt32(UtfAnyString path, int value) {
|
public Result writeUInt32(UtfAnyString path, int value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.UINT_32, (RowWriter writer, int v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseUInt32(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: return this.writePrimitive(path, value, LayoutTypes.UInt32, (ref RowWriter w, uint v) => w
|
|
||||||
// .row.writeSparseUInt32(ref w.cursor, v, UpdateOptions.Upsert));
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UINT_32,
|
|
||||||
(ref RowWriter w, int v) -> w.row.writeSparseUInt32(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -618,20 +553,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: public Result WriteUInt64(UtfAnyString path, ulong value)
|
|
||||||
public Result writeUInt64(UtfAnyString path, long value) {
|
public Result writeUInt64(UtfAnyString path, long value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.UINT_64, (RowWriter writer, long v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseUInt64(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: return this.writePrimitive(path, value, LayoutTypes.UInt64, (ref RowWriter w, ulong v) => w
|
|
||||||
// .row.writeSparseUInt64(ref w.cursor, v, UpdateOptions.Upsert));
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UINT_64,
|
|
||||||
(ref RowWriter w, long v) -> w.row.writeSparseUInt64(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -639,20 +565,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: public Result WriteUInt8(UtfAnyString path, byte value)
|
|
||||||
public Result writeUInt8(UtfAnyString path, byte value) {
|
public Result writeUInt8(UtfAnyString path, byte value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.UINT_8, (RowWriter writer, byte v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseUInt8(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: return this.writePrimitive(path, value, LayoutTypes.UInt8, (ref RowWriter w, byte v) => w.row
|
|
||||||
// .writeSparseUInt8(ref w.cursor, v, UpdateOptions.Upsert));
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UINT_8,
|
|
||||||
(ref RowWriter w, byte v) -> w.row.writeSparseUInt8(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -660,16 +577,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result writeUnixDateTime(UtfAnyString path, UnixDateTime value) {
|
public Result writeUnixDateTime(UtfAnyString path, UnixDateTime value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.UNIX_DATE_TIME, (RowWriter writer, UnixDateTime v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseUnixDateTime(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.UNIX_DATE_TIME,
|
|
||||||
(ref RowWriter w, UnixDateTime v) -> w.row.writeSparseUnixDateTime(ref w.cursor, v,
|
|
||||||
UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -677,15 +589,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
public Result writeVarInt(UtfAnyString path, long value) {
|
public Result writeVarInt(UtfAnyString path, long value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.VAR_INT, (RowWriter writer, long v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseVarInt(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.VAR_INT,
|
|
||||||
(ref RowWriter w, long v) -> w.row.writeSparseVarInt(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -693,20 +601,11 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: public Result WriteVarUInt(UtfAnyString path, ulong value)
|
|
||||||
public Result writeVarUInt(UtfAnyString path, long value) {
|
public Result writeVarUInt(UtfAnyString path, long value) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
return this.writePrimitive(path, value, LayoutTypes.VAR_UINT, (RowWriter writer, long v) ->
|
||||||
// converted by C# to Java Converter:
|
writer.row.writeSparseVarUInt(writer.cursor, v, UpdateOptions.UPSERT));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
|
||||||
//ORIGINAL LINE: return this.writePrimitive(path, value, LayoutTypes.VarUInt, (ref RowWriter w, ulong v) => w
|
|
||||||
// .row.writeSparseVarUInt(ref w.cursor, v, UpdateOptions.Upsert));
|
|
||||||
return this.writePrimitive(path, value, LayoutTypes.VAR_UINT,
|
|
||||||
(ref RowWriter w, long v) -> w.row.writeSparseVarUInt(ref w.cursor, v, UpdateOptions.UPSERT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -740,15 +639,57 @@ public final class RowWriter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for writing a primitive value.
|
* Helper for writing a primitive value.
|
||||||
* <typeparam name="TLayoutType">The type of layout type.</typeparam>
|
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param <TLayoutType> The type of layout type.
|
||||||
* @param value The value to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param type The layout type.
|
* @param value The value to write.
|
||||||
* @param sparse The {@link RowBuffer} access method for <paramref name="type" />.
|
* @param type The layout type.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @param sparse The {@link RowBuffer} access method for {@code type}.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TLayoutType extends LayoutType<String> & LayoutUtf8Writable> Result writePrimitive(UtfAnyString path, Utf8String value, TLayoutType type, AccessUtf8SpanMethod sparse) {
|
private <TLayoutType extends LayoutTypePrimitive<String> & LayoutUtf8Writable>
|
||||||
|
Result writePrimitive(UtfAnyString path, Utf8String value, TLayoutType type, AccessUtf8SpanMethod sparse) {
|
||||||
|
|
||||||
|
Result result = Result.NOT_FOUND;
|
||||||
|
|
||||||
|
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
||||||
|
result = this.writeSchematizedValue(path, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == Result.NOT_FOUND) {
|
||||||
|
// Write sparse value.
|
||||||
|
result = this.prepareSparseWrite(path, type.typeArg());
|
||||||
|
if (result != Result.SUCCESS) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference<RowWriter> tempReference_this =
|
||||||
|
new Reference<RowWriter>(this);
|
||||||
|
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
||||||
|
sparse(ref this, value)
|
||||||
|
this = tempReference_this.get();
|
||||||
|
Reference<RowBuffer> tempReference_row =
|
||||||
|
new Reference<RowBuffer>(this.row);
|
||||||
|
RowCursors.moveNext(this.cursor,
|
||||||
|
tempReference_row);
|
||||||
|
this.row = tempReference_row.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for writing a primitive value.
|
||||||
|
*
|
||||||
|
* @param <TLayoutType> The type of layout type.
|
||||||
|
* @param <TElement> The sub-element type of the field.
|
||||||
|
* @param path The scope-relative path of the field to write.
|
||||||
|
* @param value The value to write.
|
||||||
|
* @param type The layout type.
|
||||||
|
* @param sparse The {@link RowBuffer} access method for {@code type}.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
|
*/
|
||||||
|
private <TLayoutType extends LayoutType<TElement[]> & LayoutListWritable<TElement>, TElement> Result writePrimitive(UtfAnyString path, ReadOnlySpan<TElement> value, TLayoutType type, AccessReadOnlySpanMethod<TElement> sparse) {
|
||||||
Result result = Result.NOT_FOUND;
|
Result result = Result.NOT_FOUND;
|
||||||
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
||||||
result = this.writeSchematizedValue(path, value);
|
result = this.writeSchematizedValue(path, value);
|
||||||
@@ -778,117 +719,33 @@ public final class RowWriter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper for writing a primitive value.
|
* Helper for writing a primitive value.
|
||||||
* <typeparam name="TLayoutType">The type of layout type.</typeparam>
|
|
||||||
* <typeparam name="TElement">The sub-element type of the field.</typeparam>
|
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param <TValue> The type of the primitive value.
|
||||||
* @param value The value to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param type The layout type.
|
* @param value The value to write.
|
||||||
* @param sparse The {@link RowBuffer} access method for <paramref name="type" />.
|
* @param type The layout type.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @param sparse The {@link RowBuffer} access method for {@code type}.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TLayoutType extends LayoutType<TElement[]> & LayoutSpanWritable<TElement>, TElement> Result writePrimitive(UtfAnyString path, ReadOnlySpan<TElement> value, TLayoutType type, AccessReadOnlySpanMethod<TElement> sparse) {
|
private <TValue> Result writePrimitive(
|
||||||
|
UtfAnyString path, TValue value, LayoutTypePrimitive<TValue> type, Consumer<TValue> sparse) {
|
||||||
|
|
||||||
Result result = Result.NOT_FOUND;
|
Result result = Result.NOT_FOUND;
|
||||||
|
|
||||||
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
||||||
result = this.writeSchematizedValue(path, value);
|
result = this.writeSchematizedValue(path, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == Result.NOT_FOUND) {
|
if (result == Result.NOT_FOUND) {
|
||||||
// Write sparse value.
|
|
||||||
result = this.prepareSparseWrite(path, type.typeArg());
|
result = this.prepareSparseWrite(path, type.typeArg());
|
||||||
|
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<RowWriter> tempReference_this =
|
sparse.accept(this, value);
|
||||||
new Reference<RowWriter>(this);
|
RowCursors.moveNext(this.cursor, this.row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
|
||||||
sparse(ref this, value)
|
|
||||||
this = tempReference_this.get();
|
|
||||||
Reference<RowBuffer> tempReference_row =
|
|
||||||
new Reference<RowBuffer>(this.row);
|
|
||||||
RowCursors.moveNext(this.cursor,
|
|
||||||
tempReference_row);
|
|
||||||
this.row = tempReference_row.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper for writing a primitive value.
|
|
||||||
* <typeparam name="TLayoutType">The type of layout type.</typeparam>
|
|
||||||
* <typeparam name="TElement">The sub-element type of the field.</typeparam>
|
|
||||||
*
|
|
||||||
* @param path The scope-relative path of the field to write.
|
|
||||||
* @param value The value to write.
|
|
||||||
* @param type The layout type.
|
|
||||||
* @param sparse The {@link RowBuffer} access method for <paramref name="type" />.
|
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
|
||||||
*/
|
|
||||||
private <TLayoutType extends LayoutType<TElement[]> & ILayoutSequenceWritable<TElement>, TElement> Result writePrimitive(UtfAnyString path, ReadOnlySequence<TElement> value, TLayoutType type, AccessMethod<ReadOnlySequence<TElement>> sparse) {
|
|
||||||
Result result = Result.NOT_FOUND;
|
|
||||||
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
|
||||||
result = this.writeSchematizedValue(path, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == Result.NOT_FOUND) {
|
|
||||||
// Write sparse value.
|
|
||||||
result = this.prepareSparseWrite(path, type.typeArg());
|
|
||||||
if (result != Result.SUCCESS) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference<RowWriter> tempReference_this =
|
|
||||||
new Reference<RowWriter>(this);
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
|
||||||
sparse(ref this, value)
|
|
||||||
this = tempReference_this.get();
|
|
||||||
Reference<RowBuffer> tempReference_row =
|
|
||||||
new Reference<RowBuffer>(this.row);
|
|
||||||
RowCursors.moveNext(this.cursor,
|
|
||||||
tempReference_row);
|
|
||||||
this.row = tempReference_row.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper for writing a primitive value.
|
|
||||||
* <typeparam name="TValue">The type of the primitive value.</typeparam>
|
|
||||||
*
|
|
||||||
* @param path The scope-relative path of the field to write.
|
|
||||||
* @param value The value to write.
|
|
||||||
* @param type The layout type.
|
|
||||||
* @param sparse The {@link RowBuffer} access method for <paramref name="type" />.
|
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
|
||||||
*/
|
|
||||||
private <TValue> Result writePrimitive(UtfAnyString path, TValue value, LayoutType<TValue> type,
|
|
||||||
AccessMethod<TValue> sparse) {
|
|
||||||
Result result = Result.NOT_FOUND;
|
|
||||||
if (this.cursor.scopeType() instanceof LayoutUDT) {
|
|
||||||
result = this.writeSchematizedValue(path, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == Result.NOT_FOUND) {
|
|
||||||
// Write sparse value.
|
|
||||||
|
|
||||||
result = this.prepareSparseWrite(path, type.typeArg());
|
|
||||||
if (result != Result.SUCCESS) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference<RowWriter> tempReference_this =
|
|
||||||
new Reference<RowWriter>(this);
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
|
||||||
sparse(ref this, value)
|
|
||||||
this = tempReference_this.get();
|
|
||||||
Reference<RowBuffer> tempReference_row =
|
|
||||||
new Reference<RowBuffer>(this.row);
|
|
||||||
RowCursors.moveNext(this.cursor,
|
|
||||||
tempReference_row);
|
|
||||||
this.row = tempReference_row.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -896,11 +753,11 @@ public final class RowWriter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a generic schematized field value via the scope's layout.
|
* Write a generic schematized field value via the scope's layout.
|
||||||
* <typeparam name="TValue">The expected type of the field.</typeparam>
|
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param <TValue> The expected type of the field.
|
||||||
* @param value The value to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @param value The value to write.
|
||||||
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TValue> Result writeSchematizedValue(UtfAnyString path, TValue value) {
|
private <TValue> Result writeSchematizedValue(UtfAnyString path, TValue value) {
|
||||||
LayoutColumn col;
|
LayoutColumn col;
|
||||||
@@ -943,7 +800,7 @@ public final class RowWriter {
|
|||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private Result writeSchematizedValue(UtfAnyString path, Utf8String value) {
|
private Result writeSchematizedValue(UtfAnyString path, Utf8String value) {
|
||||||
LayoutColumn col;
|
LayoutColumn col;
|
||||||
@@ -987,11 +844,11 @@ public final class RowWriter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a generic schematized field value via the scope's layout.
|
* Write a generic schematized field value via the scope's layout.
|
||||||
* <typeparam name="TElement">The sub-element type of the field.</typeparam>
|
* @param <TElement> The sub-element type of the field.
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TElement> Result writeSchematizedValue(UtfAnyString path, ReadOnlySpan<TElement> value) {
|
private <TElement> Result writeSchematizedValue(UtfAnyString path, ReadOnlySpan<TElement> value) {
|
||||||
LayoutColumn col;
|
LayoutColumn col;
|
||||||
@@ -1027,11 +884,11 @@ public final class RowWriter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a generic schematized field value via the scope's layout.
|
* Write a generic schematized field value via the scope's layout.
|
||||||
* <typeparam name="TElement">The sub-element type of the field.</typeparam>
|
* @param <TElement> The sub-element type of the field.
|
||||||
*
|
*
|
||||||
* @param path The scope-relative path of the field to write.
|
* @param path The scope-relative path of the field to write.
|
||||||
* @param value The value to write.
|
* @param value The value to write.
|
||||||
* @return Success if the write is successful, an error code otherwise.
|
* @return {@link Result#SUCCESS} if the write is successful, an error {@link Result} otherwise.
|
||||||
*/
|
*/
|
||||||
private <TElement> Result writeSchematizedValue(UtfAnyString path, ReadOnlySequence<TElement> value) {
|
private <TElement> Result writeSchematizedValue(UtfAnyString path, ReadOnlySequence<TElement> value) {
|
||||||
LayoutColumn col;
|
LayoutColumn col;
|
||||||
@@ -1066,23 +923,22 @@ public final class RowWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private interface AccessMethod<TValue> {
|
private interface AccessMethod<TValue> extends Consumer<TValue> {
|
||||||
void invoke(Reference<RowWriter> writer, TValue value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private interface AccessReadOnlySpanMethod<T> {
|
private interface AccessReadOnlySpanMethod<T> {
|
||||||
void invoke(Reference<RowWriter> writer, ReadOnlySpan value);
|
void invoke(RowWriter writer, ReadOnlySpan value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private interface AccessUtf8SpanMethod {
|
private interface AccessUtf8SpanMethod {
|
||||||
void invoke(Reference<RowWriter> writer, Utf8String value);
|
void invoke(RowWriter writer, Utf8String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function to write content into a {@link RowBuffer}.
|
* A function to write content into a {@link RowBuffer}.
|
||||||
* <typeparam name="TContext">The type of the context value passed by the caller.</typeparam>
|
* @param <TContext> The type of the context value passed by the caller.
|
||||||
*
|
*
|
||||||
* @param writer A forward-only cursor for writing content.
|
* @param writer A forward-only cursor for writing content.
|
||||||
* @param typeArg The type of the current scope.
|
* @param typeArg The type of the current scope.
|
||||||
@@ -1091,6 +947,6 @@ public final class RowWriter {
|
|||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface WriterFunc<TContext> {
|
public interface WriterFunc<TContext> {
|
||||||
Result invoke(Reference<RowWriter> writer, TypeArgument typeArg, TContext context);
|
Result invoke(RowWriter writer, TypeArgument typeArg, TContext context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.recordio;
|
package com.azure.data.cosmos.serialization.hybridrow.io;
|
||||||
|
|
||||||
public final class Segment {
|
public final class Segment {
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
|
|
||||||
public final class LayoutBinary extends LayoutTypePrimitive<byte[]> {
|
public final class LayoutBinary extends LayoutTypePrimitive<byte[]> {
|
||||||
// implements
|
// implements
|
||||||
// LayoutSpanWritable<Byte>,
|
// LayoutListWritable<Byte>,
|
||||||
// LayoutSpanReadable<Byte>,
|
// LayoutListReadable<Byte>,
|
||||||
// ILayoutSequenceWritable<Byte> {
|
// ILayoutSequenceWritable<Byte> {
|
||||||
|
|
||||||
public LayoutBinary() {
|
public LayoutBinary() {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import javax.annotation.Nonnull;
|
|||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public final class LayoutBoolean extends LayoutType<Boolean> {
|
public final class LayoutBoolean extends LayoutTypePrimitive<Boolean> implements ILayoutType {
|
||||||
|
|
||||||
public LayoutBoolean(boolean value) {
|
public LayoutBoolean(boolean value) {
|
||||||
super(value ? LayoutCode.BOOLEAN : LayoutCode.BOOLEAN_FALSE, 0);
|
super(value ? LayoutCode.BOOLEAN : LayoutCode.BOOLEAN_FALSE, 0);
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @param <TElement> The sub-element type to be written
|
* @param <TElement> The sub-element type to be written
|
||||||
*/
|
*/
|
||||||
public interface LayoutSpanReadable<TElement> extends ILayoutType {
|
public interface LayoutListReadable<TElement> extends ILayoutType {
|
||||||
|
|
||||||
Result readFixed(RowBuffer buffer, RowCursor scope, LayoutColumn column, Out<List<TElement>> value);
|
Result readFixedList(RowBuffer buffer, RowCursor scope, LayoutColumn column, Out<List<TElement>> value);
|
||||||
|
|
||||||
Result readSparse(RowBuffer buffer, RowCursor scope, Out<List<TElement>> value);
|
Result readSparseList(RowBuffer buffer, RowCursor scope, Out<List<TElement>> value);
|
||||||
|
|
||||||
Result readVariable(RowBuffer buffer, RowCursor scope, LayoutColumn column, Out<List<TElement>> value);
|
Result readVariableList(RowBuffer buffer, RowCursor scope, LayoutColumn column, Out<List<TElement>> value);
|
||||||
}
|
}
|
||||||
@@ -14,13 +14,13 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @param <TElement> The sub-element type to be written
|
* @param <TElement> The sub-element type to be written
|
||||||
*/
|
*/
|
||||||
public interface LayoutSpanWritable<TElement> extends ILayoutType {
|
public interface LayoutListWritable<TElement> extends ILayoutType {
|
||||||
|
|
||||||
Result writeFixed(RowBuffer buffer, RowCursor scope, LayoutColumn column, List<TElement> value);
|
Result writeFixedList(RowBuffer buffer, RowCursor scope, LayoutColumn column, List<TElement> value);
|
||||||
|
|
||||||
Result writeSparse(RowBuffer buffer, RowCursor edit, TElement value);
|
Result writeSparseList(RowBuffer buffer, RowCursor edit, TElement value);
|
||||||
|
|
||||||
Result writeSparse(RowBuffer buffer, RowCursor edit, List<TElement> value, UpdateOptions options);
|
Result writeSparseList(RowBuffer buffer, RowCursor edit, List<TElement> value, UpdateOptions options);
|
||||||
|
|
||||||
Result writeVariable(RowBuffer buffer, RowCursor scope, LayoutColumn column, List<TElement> value);
|
Result writeVariableList(RowBuffer buffer, RowCursor scope, LayoutColumn column, List<TElement> value);
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ import javax.annotation.Nonnull;
|
|||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
public final class LayoutNull extends LayoutType<NullValue> {
|
public final class LayoutNull extends LayoutTypePrimitive<NullValue> implements ILayoutType {
|
||||||
|
|
||||||
public LayoutNull() {
|
public LayoutNull() {
|
||||||
super(LayoutCode.NULL, 0);
|
super(LayoutCode.NULL, 0);
|
||||||
@@ -36,7 +36,7 @@ public final class LayoutNull extends LayoutType<NullValue> {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public Result readFixed(RowBuffer buffer, RowCursor scope, LayoutColumn column, Out<NullValue> value) {
|
public Result readFixed(RowBuffer buffer, RowCursor scope, LayoutColumn column, Out<NullValue> value) {
|
||||||
checkArgument(scope.scopeType() instanceof LayoutUDT);
|
checkArgument(scope.scopeType() instanceof LayoutUDT);
|
||||||
value.set(NullValue.Default);
|
value.set(NullValue.DEFAULT);
|
||||||
if (!buffer.readBit(scope.start(), column.nullBit())) {
|
if (!buffer.readBit(scope.start(), column.nullBit())) {
|
||||||
return Result.NOT_FOUND;
|
return Result.NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ public abstract class LayoutType /*implements ILayoutType*/ {
|
|||||||
* The physical layout type of the field cast to the specified type.
|
* The physical layout type of the field cast to the specified type.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public final <T extends LayoutType> T typeAs() {
|
public final <T extends ILayoutType> T typeAs() {
|
||||||
return (T)this;
|
return (T)this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import javax.annotation.Nonnull;
|
|||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public abstract class LayoutTypePrimitive<T> extends LayoutType {
|
public abstract class LayoutTypePrimitive<T> extends LayoutType implements ILayoutType {
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the {@link LayoutType<T>} class.
|
* Initializes a new instance of the {@link LayoutType<T>} class.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,9 +37,15 @@ public final class LayoutUtf8 extends LayoutTypePrimitive<String> implements Lay
|
|||||||
@Nonnull final LayoutColumn column,
|
@Nonnull final LayoutColumn column,
|
||||||
@Nonnull final Out<String> value) {
|
@Nonnull final Out<String> value) {
|
||||||
|
|
||||||
|
checkNotNull(buffer, "expected non-null buffer");
|
||||||
|
checkNotNull(scope, "expected non-null scope");
|
||||||
|
checkNotNull(column, "expected non-null column");
|
||||||
|
checkNotNull(value, "expected non-null value");
|
||||||
|
|
||||||
Out<Utf8String> span = new Out<>();
|
Out<Utf8String> span = new Out<>();
|
||||||
Result result = this.readFixedSpan(buffer, scope, column, span);
|
Result result = this.readFixedSpan(buffer, scope, column, span);
|
||||||
value.set(result == Result.SUCCESS ? span.get().toUtf16() : null);
|
value.set(result == Result.SUCCESS ? span.get().toUtf16() : null);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An optional interface that indicates a {@link LayoutType{T}} can also read using a {@link Utf8String}.
|
* An optional interface that indicates a {@link LayoutType{T}} can also be read as a {@link Utf8String}.
|
||||||
*/
|
*/
|
||||||
public interface LayoutUtf8Readable extends ILayoutType {
|
public interface LayoutUtf8Readable extends ILayoutType {
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolverNamespace;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolverNamespace;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.Segment;
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public final class JsonModelRowGenerator {
|
|||||||
new Reference<RowBuffer>(this.row);
|
new Reference<RowBuffer>(this.row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
Result tempVar = RowWriter.WriteBuffer(tempReference_row, value, (ref RowWriter writer, TypeArgument typeArg,
|
Result tempVar = RowWriter.WriteBuffer(tempReference_row, value, (RowWriter RowWriter writer, TypeArgument typeArg,
|
||||||
HashMap<Utf8String, Object> dict) ->
|
HashMap<Utf8String, Object> dict) ->
|
||||||
{
|
{
|
||||||
for ((Utf8String propPath,Object propValue) :dict)
|
for ((Utf8String propPath,Object propValue) :dict)
|
||||||
@@ -113,7 +113,7 @@ public final class JsonModelRowGenerator {
|
|||||||
private static Result JsonModelSwitch(Reference<RowWriter> writer, Utf8String path, Object value) {
|
private static Result JsonModelSwitch(Reference<RowWriter> writer, Utf8String path, Object value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case null:
|
case null:
|
||||||
return writer.get().WriteNull(path);
|
return writer.get().writeNull(path);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case bool x:
|
//ORIGINAL LINE: case bool x:
|
||||||
case
|
case
|
||||||
@@ -123,12 +123,12 @@ public final class JsonModelRowGenerator {
|
|||||||
//ORIGINAL LINE: case long x:
|
//ORIGINAL LINE: case long x:
|
||||||
case
|
case
|
||||||
long x:
|
long x:
|
||||||
return writer.get().WriteInt64(path, x);
|
return writer.get().writeInt64(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case double x:
|
//ORIGINAL LINE: case double x:
|
||||||
case
|
case
|
||||||
double x:
|
double x:
|
||||||
return writer.get().WriteFloat64(path, x);
|
return writer.get().writeFloat64(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case string x:
|
//ORIGINAL LINE: case string x:
|
||||||
case String
|
case String
|
||||||
@@ -156,7 +156,7 @@ public final class JsonModelRowGenerator {
|
|||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these
|
||||||
// are not converted by C# to Java Converter:
|
// are not converted by C# to Java Converter:
|
||||||
return writer.get().WriteScope(path, new TypeArgument(LayoutType.Object), x,
|
return writer.get().WriteScope(path, new TypeArgument(LayoutType.Object), x,
|
||||||
(ref RowWriter writer2, TypeArgument typeArg, HashMap<Utf8String, Object> dict) ->
|
(RowWriter RowWriter writer2, TypeArgument typeArg, HashMap<Utf8String, Object> dict) ->
|
||||||
{
|
{
|
||||||
for ((Utf8String propPath,Object propValue) :dict)
|
for ((Utf8String propPath,Object propValue) :dict)
|
||||||
{
|
{
|
||||||
@@ -172,7 +172,7 @@ public final class JsonModelRowGenerator {
|
|||||||
//ORIGINAL LINE: case List<object> x:
|
//ORIGINAL LINE: case List<object> x:
|
||||||
case ArrayList < Object > x:
|
case ArrayList < Object > x:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
return writer.get().WriteScope(path, new TypeArgument(LayoutType.Array), x, (ref RowWriter writer2, TypeArgument typeArg, ArrayList<Object> list) ->
|
return writer.get().WriteScope(path, new TypeArgument(LayoutType.Array), x, (RowWriter RowWriter writer2, TypeArgument typeArg, ArrayList<Object> list) ->
|
||||||
{
|
{
|
||||||
for (Object elm : list) {
|
for (Object elm : list) {
|
||||||
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer2 = new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer2);
|
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer2 = new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer2);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.Segment;
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ package com.azure.data.cosmos.serialization.hybridrow.unit;
|
|||||||
|
|
||||||
import Newtonsoft.Json.*;
|
import Newtonsoft.Json.*;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.NullValue;
|
import com.azure.data.cosmos.serialization.hybridrow.NullValue;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
@@ -80,7 +79,7 @@ public final class CrossVersioningUnitTests {
|
|||||||
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
||||||
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
||||||
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
||||||
Tuple.Create(NullValue.Default, Tuple.Create((byte)-86, (byte)-86)))
|
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)))
|
||||||
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
||||||
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
||||||
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
||||||
@@ -276,7 +275,7 @@ public final class CrossVersioningUnitTests {
|
|||||||
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
||||||
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
||||||
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
||||||
Tuple.Create(NullValue.Default, Tuple.Create((byte)-86, (byte)-86)))
|
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)))
|
||||||
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
||||||
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
||||||
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
||||||
@@ -443,7 +442,7 @@ public final class CrossVersioningUnitTests {
|
|||||||
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
||||||
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
||||||
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
||||||
Tuple.Create(NullValue.Default, Tuple.Create((byte)-86, (byte)-86)))
|
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)))
|
||||||
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
||||||
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
||||||
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class LayoutCompilerUnitTests {
|
|||||||
RoundTripFixed.Expected tempVar = new RoundTripFixed.Expected();
|
RoundTripFixed.Expected tempVar = new RoundTripFixed.Expected();
|
||||||
tempVar.TypeName = "null";
|
tempVar.TypeName = "null";
|
||||||
tempVar.Default = new NullValue();
|
tempVar.Default = new NullValue();
|
||||||
tempVar.Value = NullValue.Default;
|
tempVar.Value = NullValue.DEFAULT;
|
||||||
RoundTripFixed.Expected tempVar2 = new RoundTripFixed.Expected();
|
RoundTripFixed.Expected tempVar2 = new RoundTripFixed.Expected();
|
||||||
tempVar2.TypeName = "bool";
|
tempVar2.TypeName = "bool";
|
||||||
tempVar2.Default = false;
|
tempVar2.Default = false;
|
||||||
@@ -1858,7 +1858,7 @@ private final static class RoundTripSparseArray extends TestActionDispatcher<Rou
|
|||||||
// Overwrite the whole scope.
|
// Overwrite the whole scope.
|
||||||
Reference<RowCursor> tempReference_field3 =
|
Reference<RowCursor> tempReference_field3 =
|
||||||
new Reference<RowCursor>(field);
|
new Reference<RowCursor>(field);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_field3, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_field3, NullValue.DEFAULT);
|
||||||
field = tempReference_field3.get();
|
field = tempReference_field3.get();
|
||||||
ResultAssert.IsSuccess(r, tag);
|
ResultAssert.IsSuccess(r, tag);
|
||||||
Reference<RowCursor> tempReference_field4 =
|
Reference<RowCursor> tempReference_field4 =
|
||||||
@@ -2049,7 +2049,7 @@ private final static class RoundTripSparseObject extends TestActionDispatcher<Ro
|
|||||||
// Overwrite the whole scope.
|
// Overwrite the whole scope.
|
||||||
Reference<RowCursor> tempReference_field4 =
|
Reference<RowCursor> tempReference_field4 =
|
||||||
new Reference<RowCursor>(field);
|
new Reference<RowCursor>(field);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_field4, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_field4, NullValue.DEFAULT);
|
||||||
field = tempReference_field4.get();
|
field = tempReference_field4.get();
|
||||||
ResultAssert.IsSuccess(r, "Json: {0}", expected.Json);
|
ResultAssert.IsSuccess(r, "Json: {0}", expected.Json);
|
||||||
Reference<RowCursor> tempReference_field5 =
|
Reference<RowCursor> tempReference_field5 =
|
||||||
@@ -2187,7 +2187,7 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch
|
|||||||
} else {
|
} else {
|
||||||
Reference<RowCursor> tempReference_nestedField2 =
|
Reference<RowCursor> tempReference_nestedField2 =
|
||||||
new Reference<RowCursor>(nestedField);
|
new Reference<RowCursor>(nestedField);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_nestedField2, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_nestedField2, NullValue.DEFAULT);
|
||||||
nestedField = tempReference_nestedField2.get();
|
nestedField = tempReference_nestedField2.get();
|
||||||
ResultAssert.IsSuccess(r, tag);
|
ResultAssert.IsSuccess(r, tag);
|
||||||
}
|
}
|
||||||
@@ -2260,7 +2260,7 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch
|
|||||||
// Overwrite the nested field.
|
// Overwrite the nested field.
|
||||||
Reference<RowCursor> tempReference_nestedField4 =
|
Reference<RowCursor> tempReference_nestedField4 =
|
||||||
new Reference<RowCursor>(nestedField);
|
new Reference<RowCursor>(nestedField);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_nestedField4, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_nestedField4, NullValue.DEFAULT);
|
||||||
nestedField = tempReference_nestedField4.get();
|
nestedField = tempReference_nestedField4.get();
|
||||||
ResultAssert.IsSuccess(r, tag);
|
ResultAssert.IsSuccess(r, tag);
|
||||||
|
|
||||||
@@ -2381,7 +2381,7 @@ private final static class RoundTripSparseObjectNested extends TestActionDispatc
|
|||||||
} else {
|
} else {
|
||||||
Reference<RowCursor> tempReference_field2 =
|
Reference<RowCursor> tempReference_field2 =
|
||||||
new Reference<RowCursor>(field);
|
new Reference<RowCursor>(field);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_field2, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_field2, NullValue.DEFAULT);
|
||||||
field = tempReference_field2.get();
|
field = tempReference_field2.get();
|
||||||
ResultAssert.IsSuccess(r, tag);
|
ResultAssert.IsSuccess(r, tag);
|
||||||
}
|
}
|
||||||
@@ -2517,7 +2517,7 @@ private final static class RoundTripSparseOrdering extends TestActionDispatcher<
|
|||||||
} else {
|
} else {
|
||||||
Reference<RowCursor> tempReference_field2 =
|
Reference<RowCursor> tempReference_field2 =
|
||||||
new Reference<RowCursor>(field);
|
new Reference<RowCursor>(field);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_field2, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_field2, NullValue.DEFAULT);
|
||||||
field = tempReference_field2.get();
|
field = tempReference_field2.get();
|
||||||
ResultAssert.IsSuccess(r, "Json: {0}", json);
|
ResultAssert.IsSuccess(r, "Json: {0}", json);
|
||||||
Out<TValue> tempOut_value3 = new Out<TValue>();
|
Out<TValue> tempOut_value3 = new Out<TValue>();
|
||||||
@@ -2835,7 +2835,7 @@ private final static class RoundTripSparseSet extends TestActionDispatcher<Round
|
|||||||
|
|
||||||
// Overwrite the whole scope.
|
// Overwrite the whole scope.
|
||||||
Reference<RowCursor> tempReference_field9 = new Reference<RowCursor>(field);
|
Reference<RowCursor> tempReference_field9 = new Reference<RowCursor>(field);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_field9, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_field9, NullValue.DEFAULT);
|
||||||
field = tempReference_field9.get();
|
field = tempReference_field9.get();
|
||||||
ResultAssert.IsSuccess(r, tag);
|
ResultAssert.IsSuccess(r, tag);
|
||||||
Reference<RowCursor> tempReference_field10 = new Reference<RowCursor>(field);
|
Reference<RowCursor> tempReference_field10 = new Reference<RowCursor>(field);
|
||||||
@@ -2982,7 +2982,7 @@ private final static class RoundTripSparseSimple extends TestActionDispatcher<Ro
|
|||||||
} else {
|
} else {
|
||||||
Reference<RowCursor> tempReference_field2 =
|
Reference<RowCursor> tempReference_field2 =
|
||||||
new Reference<RowCursor>(field);
|
new Reference<RowCursor>(field);
|
||||||
r = LayoutType.Null.writeSparse(row, tempReference_field2, NullValue.Default);
|
r = LayoutType.Null.writeSparse(row, tempReference_field2, NullValue.DEFAULT);
|
||||||
field = tempReference_field2.get();
|
field = tempReference_field2.get();
|
||||||
ResultAssert.IsSuccess(r, "Json: {0}", expected.Json);
|
ResultAssert.IsSuccess(r, "Json: {0}", expected.Json);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import com.azure.data.cosmos.serialization.hybridrow.Result;
|
|||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.Segment;
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.unit.customerschema.Address;
|
import com.azure.data.cosmos.serialization.hybridrow.unit.customerschema.Address;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ public final class RowOperationDispatcher {
|
|||||||
switch (type.LayoutCode) {
|
switch (type.LayoutCode) {
|
||||||
case Null:
|
case Null:
|
||||||
Reference<RowOperationDispatcher> tempReference_this = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutNull, NullValue>Dispatch(tempReference_this, scope, col, type, NullValue.Default);
|
this.dispatcher.<LayoutNull, NullValue>Dispatch(tempReference_this, scope, col, type, NullValue.DEFAULT);
|
||||||
this = tempReference_this.get();
|
this = tempReference_this.get();
|
||||||
break;
|
break;
|
||||||
case Boolean:
|
case Boolean:
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public final class RowReaderUnitTests {
|
|||||||
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
||||||
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
||||||
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
||||||
Tuple.Create(NullValue.Default, Tuple.Create((byte)-86, (byte)-86)))
|
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)))
|
||||||
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
||||||
d.LayoutCodeSwitch("nullable<int32,int64>", value:Tuple.Create(null, (Long)123L))
|
d.LayoutCodeSwitch("nullable<int32,int64>", value:Tuple.Create(null, (Long)123L))
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public final class RowWriterUnitTests {
|
|||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempReference_row, null, (ref RowWriter writer,
|
ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempReference_row, null, (RowWriter RowWriter writer,
|
||||||
TypeArgument rootTypeArg, Object ignored) ->
|
TypeArgument rootTypeArg, Object ignored) ->
|
||||||
{
|
{
|
||||||
ResultAssert.IsSuccess(writer.WriteNull("null"));
|
ResultAssert.IsSuccess(writer.WriteNull("null"));
|
||||||
@@ -198,7 +198,7 @@ public final class RowWriterUnitTests {
|
|||||||
assert layout.TryFind("tuple<null,tuple<int8,int8>>", tempOut_col5);
|
assert layout.TryFind("tuple<null,tuple<int8,int8>>", tempOut_col5);
|
||||||
col = tempOut_col5.get();
|
col = tempOut_col5.get();
|
||||||
ResultAssert.IsSuccess(writer.WriteScope(col.path(), col.typeArg().clone(),
|
ResultAssert.IsSuccess(writer.WriteScope(col.path(), col.typeArg().clone(),
|
||||||
Tuple.Create(NullValue.Default, Tuple.Create((byte)-86, (byte)-86)), (ref RowWriter writer2,
|
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)), (ref RowWriter writer2,
|
||||||
TypeArgument typeArg,
|
TypeArgument typeArg,
|
||||||
Tuple<NullValue, Tuple<Byte,
|
Tuple<NullValue, Tuple<Byte,
|
||||||
Byte>> values) ->
|
Byte>> values) ->
|
||||||
@@ -240,20 +240,20 @@ public final class RowWriterUnitTests {
|
|||||||
ResultAssert.IsSuccess(writer.WriteScope(col.path(), col.typeArg().clone(), Tuple.Create(null,
|
ResultAssert.IsSuccess(writer.WriteScope(col.path(), col.typeArg().clone(), Tuple.Create(null,
|
||||||
(Long)123L), (ref RowWriter writer2, TypeArgument typeArg, Tuple<Integer, Long> values) ->
|
(Long)123L), (ref RowWriter writer2, TypeArgument typeArg, Tuple<Integer, Long> values) ->
|
||||||
{
|
{
|
||||||
RowWriter.WriterFunc<Integer> f0 = (Reference<RowWriter> writer, TypeArgument typeArg,
|
RowWriter.WriterFunc<Integer> f0 = (com.azure.data.cosmos.serialization.hybridrow.io.RowWriter writer, TypeArgument typeArg,
|
||||||
Integer context) -> null.invoke(writer, typeArg.clone(), context);
|
Integer context) -> null.invoke(writer, typeArg.clone(), context);
|
||||||
if (values.Item1 != null) {
|
if (values.Item1 != null) {
|
||||||
f0 = (ref RowWriter writer3, TypeArgument typeArg2, Integer value) -> writer3.WriteInt32(null,
|
f0 = (com.azure.data.cosmos.serialization.hybridrow.io.RowWriter RowWriter writer3, TypeArgument typeArg2, Integer value) -> writer3.WriteInt32(null,
|
||||||
value.intValue());
|
value.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultAssert.IsSuccess(writer2.WriteScope(null, typeArg.getTypeArgs().get(0).clone(), values.Item1,
|
ResultAssert.IsSuccess(writer2.WriteScope(null, typeArg.getTypeArgs().get(0).clone(), values.Item1,
|
||||||
f0));
|
f0));
|
||||||
|
|
||||||
RowWriter.WriterFunc<Long> f1 = (Reference<RowWriter> writer, TypeArgument typeArg,
|
RowWriter.WriterFunc<Long> f1 = (com.azure.data.cosmos.serialization.hybridrow.io.RowWriter writer, TypeArgument typeArg,
|
||||||
Long context) -> null.invoke(writer, typeArg.clone(), context);
|
Long context) -> null.invoke(writer, typeArg.clone(), context);
|
||||||
if (values.Item2 != null) {
|
if (values.Item2 != null) {
|
||||||
f1 = (ref RowWriter writer3, TypeArgument typeArg2, Long value) -> writer3.WriteInt64(null,
|
f1 = (com.azure.data.cosmos.serialization.hybridrow.io.RowWriter RowWriter writer3, TypeArgument typeArg2, Long value) -> writer3.WriteInt64(null,
|
||||||
value.longValue());
|
value.longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public final class SerializerUnitTest {
|
|||||||
break;
|
break;
|
||||||
case "resourcePath":
|
case "resourcePath":
|
||||||
Out<String> tempOut_ResourcePath = new Out<String>();
|
Out<String> tempOut_ResourcePath = new Out<String>();
|
||||||
r = reader.get().readString(tempOut_ResourcePath);
|
r = reader.get().readUtf8String(tempOut_ResourcePath);
|
||||||
retval.ResourcePath = tempOut_ResourcePath.get();
|
retval.ResourcePath = tempOut_ResourcePath.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public final class AddressSerializer {
|
|||||||
switch (reader.get().path()) {
|
switch (reader.get().path()) {
|
||||||
case "street":
|
case "street":
|
||||||
Out<String> tempOut_Street = new Out<String>();
|
Out<String> tempOut_Street = new Out<String>();
|
||||||
r = reader.get().readString(tempOut_Street);
|
r = reader.get().readUtf8String(tempOut_Street);
|
||||||
obj.get().argValue.Street = tempOut_Street.get();
|
obj.get().argValue.Street = tempOut_Street.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
@@ -26,7 +26,7 @@ public final class AddressSerializer {
|
|||||||
break;
|
break;
|
||||||
case "city":
|
case "city":
|
||||||
Out<String> tempOut_City = new Out<String>();
|
Out<String> tempOut_City = new Out<String>();
|
||||||
r = reader.get().readString(tempOut_City);
|
r = reader.get().readUtf8String(tempOut_City);
|
||||||
obj.get().argValue.City = tempOut_City.get();
|
obj.get().argValue.City = tempOut_City.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
@@ -35,7 +35,7 @@ public final class AddressSerializer {
|
|||||||
break;
|
break;
|
||||||
case "state":
|
case "state":
|
||||||
Out<String> tempOut_State = new Out<String>();
|
Out<String> tempOut_State = new Out<String>();
|
||||||
r = reader.get().readString(tempOut_State);
|
r = reader.get().readUtf8String(tempOut_State);
|
||||||
obj.get().argValue.State = tempOut_State.get();
|
obj.get().argValue.State = tempOut_State.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public final class PostalCodeSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj.Plus4.HasValue) {
|
if (obj.Plus4.HasValue) {
|
||||||
r = writer.get().WriteInt16("plus4", obj.Plus4.Value);
|
r = writer.get().writeInt16("plus4", obj.Plus4.Value);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user