mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-01-25 12:23:15 +00:00
RowReaderTest against RootSegment.json/RootSegment.hybridrow succeeds
This commit is contained in:
@@ -77,17 +77,17 @@ public final class RowReader {
|
|||||||
private int columnIndex;
|
private int columnIndex;
|
||||||
private List<LayoutColumn> columns;
|
private List<LayoutColumn> columns;
|
||||||
private RowCursor cursor;
|
private RowCursor cursor;
|
||||||
private RowBuffer row;
|
private RowBuffer buffer;
|
||||||
private int schematizedCount;
|
private int schematizedCount;
|
||||||
private States state;
|
private States state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the {@link RowReader} class.
|
* Initializes a new instance of the {@link RowReader} class.
|
||||||
*
|
*
|
||||||
* @param row The row to be read
|
* @param buffer The row to be read
|
||||||
*/
|
*/
|
||||||
public RowReader(@Nonnull RowBuffer row) {
|
public RowReader(@Nonnull RowBuffer buffer) {
|
||||||
this(row, RowCursor.create(row));
|
this(buffer, RowCursor.create(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +101,7 @@ public final class RowReader {
|
|||||||
checkNotNull(buffer, "expected non-null buffer");
|
checkNotNull(buffer, "expected non-null buffer");
|
||||||
checkNotNull(checkpoint, "expected non-null checkpoint");
|
checkNotNull(checkpoint, "expected non-null checkpoint");
|
||||||
|
|
||||||
this.row = buffer;
|
this.buffer = buffer;
|
||||||
this.columns = checkpoint.cursor().layout().columns();
|
this.columns = checkpoint.cursor().layout().columns();
|
||||||
this.schematizedCount = checkpoint.cursor().layout().numFixed() + checkpoint.cursor().layout().numVariable();
|
this.schematizedCount = checkpoint.cursor().layout().numFixed() + checkpoint.cursor().layout().numVariable();
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public final class RowReader {
|
|||||||
checkNotNull(scope, "expected non-null scope");
|
checkNotNull(scope, "expected non-null scope");
|
||||||
|
|
||||||
this.cursor = scope;
|
this.cursor = scope;
|
||||||
this.row = buffer;
|
this.buffer = buffer;
|
||||||
this.columns = this.cursor.layout().columns();
|
this.columns = this.cursor.layout().columns();
|
||||||
this.schematizedCount = this.cursor.layout().numFixed() + this.cursor.layout().numVariable();
|
this.schematizedCount = this.cursor.layout().numFixed() + this.cursor.layout().numVariable();
|
||||||
|
|
||||||
@@ -181,8 +181,8 @@ public final class RowReader {
|
|||||||
|
|
||||||
case SPARSE:
|
case SPARSE:
|
||||||
if (this.cursor.cellType() instanceof LayoutNullable) {
|
if (this.cursor.cellType() instanceof LayoutNullable) {
|
||||||
RowCursor nullableScope = this.row.sparseIteratorReadScope(this.cursor, true);
|
RowCursor nullableScope = this.buffer.sparseIteratorReadScope(this.cursor, true);
|
||||||
return LayoutNullable.hasValue(this.row, nullableScope) == Result.SUCCESS;
|
return LayoutNullable.hasValue(this.buffer, nullableScope) == Result.SUCCESS;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ public final class RowReader {
|
|||||||
* @return length of the current row in bytes.
|
* @return length of the current row in bytes.
|
||||||
*/
|
*/
|
||||||
public int length() {
|
public int length() {
|
||||||
return this.row.length();
|
return this.buffer.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,7 +226,7 @@ public final class RowReader {
|
|||||||
case SCHEMATIZED:
|
case SCHEMATIZED:
|
||||||
return this.columns.get(this.columnIndex).path();
|
return this.columns.get(this.columnIndex).path();
|
||||||
case SPARSE:
|
case SPARSE:
|
||||||
return this.row.readSparsePath(this.cursor);
|
return this.buffer.readSparsePath(this.cursor);
|
||||||
default:
|
default:
|
||||||
return Utf8String.NULL;
|
return Utf8String.NULL;
|
||||||
}
|
}
|
||||||
@@ -259,7 +259,7 @@ public final class RowReader {
|
|||||||
checkState(this.cursor.scopeType() instanceof LayoutUDT);
|
checkState(this.cursor.scopeType() instanceof LayoutUDT);
|
||||||
LayoutColumn column = this.columns.get(this.columnIndex);
|
LayoutColumn column = this.columns.get(this.columnIndex);
|
||||||
|
|
||||||
if (!this.row.readBit(this.cursor.start(), column.nullBit())) {
|
if (!this.buffer.readBit(this.cursor.start(), column.nullBit())) {
|
||||||
break; // to skip schematized values if they aren't present
|
break; // to skip schematized values if they aren't present
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
case SPARSE: {
|
case SPARSE: {
|
||||||
|
|
||||||
if (!RowCursors.moveNext(this.cursor, this.row)) {
|
if (!RowCursors.moveNext(this.cursor, this.buffer)) {
|
||||||
this.state = States.DONE;
|
this.state = States.DONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ public final class RowReader {
|
|||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.set(this.row.readSparseBinary(this.cursor));
|
value.set(this.buffer.readSparseBinary(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -347,7 +347,7 @@ public final class RowReader {
|
|||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.set(this.row.readSparseBoolean(this.cursor));
|
value.set(this.buffer.readSparseBoolean(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -375,7 +375,7 @@ public final class RowReader {
|
|||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.set(this.row.readSparseDateTime(this.cursor));
|
value.set(this.buffer.readSparseDateTime(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -402,7 +402,7 @@ public final class RowReader {
|
|||||||
value.set(new BigDecimal(0));
|
value.set(new BigDecimal(0));
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseDecimal(this.cursor));
|
value.set(this.buffer.readSparseDecimal(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -429,7 +429,7 @@ public final class RowReader {
|
|||||||
value.setAndGet(null);
|
value.setAndGet(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.setAndGet(this.row.readSparseFloat128(this.cursor));
|
value.setAndGet(this.buffer.readSparseFloat128(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -456,7 +456,7 @@ public final class RowReader {
|
|||||||
value.set(0F);
|
value.set(0F);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseFloat32(this.cursor));
|
value.set(this.buffer.readSparseFloat32(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -483,7 +483,7 @@ public final class RowReader {
|
|||||||
value.set(0D);
|
value.set(0D);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseFloat64(this.cursor));
|
value.set(this.buffer.readSparseFloat64(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -511,7 +511,7 @@ public final class RowReader {
|
|||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.set(this.row.readSparseGuid(this.cursor));
|
value.set(this.buffer.readSparseGuid(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -538,7 +538,7 @@ public final class RowReader {
|
|||||||
value.set((short)0);
|
value.set((short)0);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseInt16(this.cursor));
|
value.set(this.buffer.readSparseInt16(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -565,7 +565,7 @@ public final class RowReader {
|
|||||||
value.set(0);
|
value.set(0);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseInt32(this.cursor));
|
value.set(this.buffer.readSparseInt32(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -592,7 +592,7 @@ public final class RowReader {
|
|||||||
value.setAndGet(0L);
|
value.setAndGet(0L);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.setAndGet(this.row.readSparseInt64(this.cursor));
|
value.setAndGet(this.buffer.readSparseInt64(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -619,7 +619,7 @@ public final class RowReader {
|
|||||||
value.set((byte)0);
|
value.set((byte)0);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseInt8(this.cursor));
|
value.set(this.buffer.readSparseInt8(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -646,7 +646,7 @@ public final class RowReader {
|
|||||||
value.set(null);
|
value.set(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseNull(this.cursor));
|
value.set(this.buffer.readSparseNull(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -669,15 +669,15 @@ public final class RowReader {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public <TContext> Result readScope(@Nullable final TContext context, @Nullable final ReaderFunc<TContext> func) {
|
public <TContext> Result readScope(@Nullable final TContext context, @Nullable final ReaderFunc<TContext> func) {
|
||||||
|
|
||||||
final RowCursor childScope = this.row.sparseIteratorReadScope(this.cursor, true);
|
final RowCursor childScope = this.buffer.sparseIteratorReadScope(this.cursor, true);
|
||||||
final RowReader nestedReader = new RowReader(this.row, childScope);
|
final RowReader nestedReader = new RowReader(this.buffer, childScope);
|
||||||
final Result result = func == null ? null : func.invoke(nestedReader, context);
|
final Result result = func == null ? null : func.invoke(nestedReader, context);
|
||||||
|
|
||||||
if (!(result == null || result == Result.SUCCESS)) {
|
if (!(result == null || result == Result.SUCCESS)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
RowCursors.skip(childScope, this.row, nestedReader.cursor);
|
RowCursors.skip(this.cursor, this.buffer, nestedReader.cursor);
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,8 +690,8 @@ public final class RowReader {
|
|||||||
* @return a new {@link RowReader}.
|
* @return a new {@link RowReader}.
|
||||||
*/
|
*/
|
||||||
public @Nonnull RowReader readScope() {
|
public @Nonnull RowReader readScope() {
|
||||||
RowCursor newScope = this.row.sparseIteratorReadScope(this.cursor, true);
|
RowCursor newScope = this.buffer.sparseIteratorReadScope(this.cursor, true);
|
||||||
return new RowReader(this.row, newScope);
|
return new RowReader(this.buffer, newScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -728,7 +728,7 @@ public final class RowReader {
|
|||||||
value.set(null);
|
value.set(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseString(this.cursor));
|
value.set(this.buffer.readSparseString(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -755,7 +755,7 @@ public final class RowReader {
|
|||||||
value.set(0);
|
value.set(0);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseUInt16(this.cursor));
|
value.set(this.buffer.readSparseUInt16(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -783,7 +783,7 @@ public final class RowReader {
|
|||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.set(this.row.readSparseUInt32(this.cursor));
|
value.set(this.buffer.readSparseUInt32(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -810,7 +810,7 @@ public final class RowReader {
|
|||||||
value.set(0L);
|
value.set(0L);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseUInt64(this.cursor));
|
value.set(this.buffer.readSparseUInt64(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -840,7 +840,7 @@ public final class RowReader {
|
|||||||
value.set((short)0);
|
value.set((short)0);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseUInt8(this.cursor));
|
value.set(this.buffer.readSparseUInt8(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -893,7 +893,7 @@ public final class RowReader {
|
|||||||
value.set(null);
|
value.set(null);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseUnixDateTime(this.cursor));
|
value.set(this.buffer.readSparseUnixDateTime(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -920,7 +920,7 @@ public final class RowReader {
|
|||||||
value.set(0L);
|
value.set(0L);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseVarInt(this.cursor));
|
value.set(this.buffer.readSparseVarInt(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -947,7 +947,7 @@ public final class RowReader {
|
|||||||
value.set(0L);
|
value.set(0L);
|
||||||
return Result.TYPE_MISMATCH;
|
return Result.TYPE_MISMATCH;
|
||||||
}
|
}
|
||||||
value.set(this.row.readSparseVarUInt(this.cursor));
|
value.set(this.buffer.readSparseVarUInt(this.cursor));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -974,7 +974,7 @@ public final class RowReader {
|
|||||||
if (nestedReader.cursor.start() != this.cursor.valueOffset()) {
|
if (nestedReader.cursor.start() != this.cursor.valueOffset()) {
|
||||||
return Result.FAILURE;
|
return Result.FAILURE;
|
||||||
}
|
}
|
||||||
RowCursors.skip(this.cursor, this.row, nestedReader.cursor);
|
RowCursors.skip(this.cursor, this.buffer, nestedReader.cursor);
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,9 +1050,9 @@ public final class RowReader {
|
|||||||
|
|
||||||
switch (storage) {
|
switch (storage) {
|
||||||
case FIXED:
|
case FIXED:
|
||||||
return type.<LayoutTypePrimitive<TValue>>typeAs().readFixed(this.row, this.cursor, column, value);
|
return type.<LayoutTypePrimitive<TValue>>typeAs().readFixed(this.buffer, this.cursor, column, value);
|
||||||
case VARIABLE:
|
case VARIABLE:
|
||||||
return type.<LayoutTypePrimitive<TValue>>typeAs().readVariable(this.row, this.cursor, column, value);
|
return type.<LayoutTypePrimitive<TValue>>typeAs().readVariable(this.buffer, this.cursor, column, value);
|
||||||
default:
|
default:
|
||||||
String message = lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
String message = lenientFormat("expected FIXED or VARIABLE column storage, not %s", storage);
|
||||||
throw new IllegalStateException(message);
|
throw new IllegalStateException(message);
|
||||||
@@ -1114,10 +1114,10 @@ public final class RowReader {
|
|||||||
switch (storage) {
|
switch (storage) {
|
||||||
|
|
||||||
case FIXED:
|
case FIXED:
|
||||||
return type.<LayoutListReadable<TElement>>typeAs().readFixedList(this.row, this.cursor, column, value);
|
return type.<LayoutListReadable<TElement>>typeAs().readFixedList(this.buffer, this.cursor, column, value);
|
||||||
|
|
||||||
case VARIABLE:
|
case VARIABLE:
|
||||||
return type.<LayoutListReadable<TElement>>typeAs().readVariableList(this.row, this.cursor, column, value);
|
return type.<LayoutListReadable<TElement>>typeAs().readVariableList(this.buffer, 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,6 +14,7 @@ import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolverNames
|
|||||||
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.schemas.Namespace;
|
import com.azure.data.cosmos.serialization.hybridrow.schemas.Namespace;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.ByteBufUtil;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Factory;
|
import org.testng.annotations.Factory;
|
||||||
@@ -68,7 +69,12 @@ public class RowReaderTest {
|
|||||||
LayoutResolver resolver = new LayoutResolverNamespace(this.namespace);
|
LayoutResolver resolver = new LayoutResolverNamespace(this.namespace);
|
||||||
RowBuffer buffer = new RowBuffer(data, HybridRowVersion.V1, resolver);
|
RowBuffer buffer = new RowBuffer(data, HybridRowVersion.V1, resolver);
|
||||||
RowReader reader = new RowReader(buffer);
|
RowReader reader = new RowReader(buffer);
|
||||||
visitFields(reader, 0);
|
|
||||||
|
try {
|
||||||
|
visitFields(reader, 0);
|
||||||
|
} catch (IllegalStateException error) {
|
||||||
|
fail(lenientFormat("row reader on %s failed due to %s", this.dataFile, error));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result visitFields(RowReader reader, int level) {
|
private static Result visitFields(RowReader reader, int level) {
|
||||||
@@ -84,12 +90,18 @@ public class RowReaderTest {
|
|||||||
fail(lenientFormat("path: %s, type: %s", path, type));
|
fail(lenientFormat("path: %s, type: %s", path, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(lenientFormat("%s%s : %s", Strings.repeat(" ", level), path, type.name()));
|
|
||||||
|
|
||||||
Result result = Result.SUCCESS;
|
Result result = Result.SUCCESS;
|
||||||
out.set(null);
|
out.set(null);
|
||||||
|
|
||||||
switch (type.layoutCode()) {
|
switch (type.layoutCode()) {
|
||||||
|
case BOOLEAN: {
|
||||||
|
result = reader.readBoolean(out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case INT_16: {
|
||||||
|
result = reader.readInt16(out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case INT_32: {
|
case INT_32: {
|
||||||
result = reader.readInt32(out);
|
result = reader.readInt32(out);
|
||||||
break;
|
break;
|
||||||
@@ -110,15 +122,17 @@ public class RowReaderTest {
|
|||||||
result = reader.readUInt64(out);
|
result = reader.readUInt64(out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BINARY: {
|
||||||
|
result = reader.readBinary(out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GUID: {
|
case GUID: {
|
||||||
result = reader.readGuid(out);
|
result = reader.readGuid(out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NULL:
|
case NULL:
|
||||||
case BOOLEAN:
|
|
||||||
case BOOLEAN_FALSE:
|
case BOOLEAN_FALSE:
|
||||||
case INT_8:
|
case INT_8:
|
||||||
case INT_16:
|
|
||||||
case UINT_16:
|
case UINT_16:
|
||||||
case VAR_INT:
|
case VAR_INT:
|
||||||
case VAR_UINT:
|
case VAR_UINT:
|
||||||
@@ -128,8 +142,7 @@ public class RowReaderTest {
|
|||||||
case DECIMAL:
|
case DECIMAL:
|
||||||
case DATE_TIME:
|
case DATE_TIME:
|
||||||
case UNIX_DATE_TIME:
|
case UNIX_DATE_TIME:
|
||||||
case UTF_8:
|
case UTF_8: {
|
||||||
case BINARY: {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NULLABLE_SCOPE:
|
case NULLABLE_SCOPE:
|
||||||
@@ -174,10 +187,19 @@ public class RowReaderTest {
|
|||||||
case TYPED_TUPLE_SCOPE:
|
case TYPED_TUPLE_SCOPE:
|
||||||
case IMMUTABLE_TYPED_TUPLE_SCOPE: {
|
case IMMUTABLE_TYPED_TUPLE_SCOPE: {
|
||||||
|
|
||||||
|
System.out.print(Strings.repeat(" ", level));
|
||||||
|
System.out.println(lenientFormat("%s: %s", path, type.name()));
|
||||||
|
|
||||||
result = reader.readScope(null, (RowReader child, Object ignored) -> visitFields(child, level + 1));
|
result = reader.readScope(null, (RowReader child, Object ignored) -> visitFields(child, level + 1));
|
||||||
|
|
||||||
|
System.out.print(Strings.repeat(" ", level));
|
||||||
|
System.out.println("end");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case END_SCOPE: {
|
||||||
|
fail(lenientFormat("unexpected layout type: %s", type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case END_SCOPE:
|
|
||||||
case INVALID:
|
case INVALID:
|
||||||
case MONGODB_OBJECT_ID: {
|
case MONGODB_OBJECT_ID: {
|
||||||
fail(lenientFormat("unsupported layout type: %s", type));
|
fail(lenientFormat("unsupported layout type: %s", type));
|
||||||
@@ -188,9 +210,18 @@ public class RowReaderTest {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (out.isPresent()) {
|
||||||
|
Object value = out.get();
|
||||||
|
System.out.print(Strings.repeat(" ", level));
|
||||||
|
System.out.println(lenientFormat("%s: %s = %s",
|
||||||
|
path, type.name(), value instanceof ByteBuf ? ByteBufUtil.hexDump((ByteBuf)value) : value)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user