Added, revised, and debugged some tests and test issues. Updated javadocs and pom.xml. We now add SystemSchema.json to azure-cosmos-serialization.jar. Javadocs don't currently build.

This commit is contained in:
David Noble
2019-09-16 23:32:26 -07:00
parent 446d44b24b
commit dee374eacc
38 changed files with 1835 additions and 1966 deletions

View File

@@ -132,6 +132,7 @@ Licensed under the MIT License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
</configuration>
</plugin>
@@ -187,8 +188,31 @@ Licensed under the MIT License.
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<configuration>
<classpathContainers>
<classpathContainer>
org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8
</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<inherited>true</inherited>
<version>3.1.1</version>
<!--inherited>true</inherited-->
<configuration>
<quiet>true</quiet>
<verbose>false</verbose>
@@ -207,9 +231,33 @@ Licensed under the MIT License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../schemas</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>attach-sources</id>
@@ -219,27 +267,7 @@ Licensed under the MIT License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<classpathContainers>
<classpathContainer>
org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8
</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<plugin>
<!--plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
@@ -255,7 +283,7 @@ Licensed under the MIT License.
</goals>
</execution>
</executions>
</plugin>
</plugin-->
</plugins>
</build>

View File

@@ -4,25 +4,17 @@
package com.azure.data.cosmos.serialization.hybridrow;
/**
* An IEEE 128-bit floating point value.
* Represents an IEEE 754-2008 128-bit decimal floating point number.
* <p>
* A binary integer decimal representation of a 128-bit decimal value, supporting 34 decimal digits of
* significand and an exponent range of -6143 to +6144.
* <list type="table">
* <listheader>
* <term>Source</term> <description>Link</description>
* </listheader> <item>
* <term>Wikipedia:</term>
* <description>https: //en.wikipedia.org/wiki/Decimal128_floating-point_format</description>
* </item> <item>
* <term>The spec:</term> <description>https: //ieeexplore.ieee.org/document/4610935</description>
* </item> <item>
* <term>Decimal Encodings:</term> <description>http: //speleotrove.com/decimal/decbits.html</description>
* </item>
* </list>
* The {@link Float128} represents an IEEE 754-2008 floating point number as a pair of {@code long} values:
* {@link #high} and {@link #low}.
*
* @see <a href="https://en.wikipedia.org/wiki/Decimal128_floating-point_format">decimal128 floating-point format</a>
* @see <a href="https://ieeexplore.ieee.org/document/4610935">754-2008: IEEE Standard for Floating-Point Arithmetic</a>
* @see <a href="http://speleotrove.com/decimal/decbits.html">Decimal Arithmetic Encodings Version 1.01 7 Apr 2009</a>
*/
public final class Float128 {
/**
* The size (in bytes) of a {@link Float128}.
*/
@@ -45,6 +37,8 @@ public final class Float128 {
/**
* The high-order 64 bits of the IEEE 754-2008 128-bit decimal floating point, using the BID encoding scheme.
*
* @return the high-order 64 bits of the IEEE 754-2008 128-bit floating point number represented by this object.
*/
public long high() {
return this.high;
@@ -52,6 +46,8 @@ public final class Float128 {
/**
* The low-order 64 bits of the IEEE 754-2008 128-bit decimal floating point, using the BID encoding scheme.
*
* @return the low-order 64 bits of the IEEE 754-2008 128-bit floating point number represented by this object.
*/
public long low() {
return this.low;

View File

@@ -27,14 +27,18 @@ public final class HybridRowHeader {
}
/**
* The unique identifier of the schema whose layout was used to write this row.
* The unique identifier of the schema whose layout was used to write this {@link HybridRowHeader}.
*
* @return unique identifier of the schema whose layout was used to write this {@link HybridRowHeader}.
*/
public SchemaId schemaId() {
return this.schemaId;
}
/**
* The version of the HybridRow library used to write this row.
* The version of the HybridRow serialization library used to write this {@link HybridRowHeader}.
*
* @return version of the HybridRow serialization library used to write this {@link HybridRowHeader}.
*/
public HybridRowVersion version() {
return this.version;

View File

@@ -198,8 +198,8 @@ public final class RowBuffer {
/**
* Compute the number of bytes necessary to store the unsigned 32-bit integer value using the varuint encoding.
*
* @param value The value to be encoded
* @return The number of bytes needed to store the varuint encoding of {@code value}
* @param value the value to be encoded
* @return the number of bytes needed to store the varuint encoding of {@code value}
*/
public static int count7BitEncodedUInt(long value) {
checkArgument(0 <= value && value <= 0x00000000FFFFFFFFL, "value: %s", value);
@@ -212,6 +212,12 @@ public final class RowBuffer {
return i;
}
/**
* Decrement the unsigned 32-bit integer value at the given {@code offset} in this {@link RowBuffer}.
*
* @param offset offset of a 32-bit unsigned integer value in this {@link RowBuffer}.
* @param decrement the decrement value.
*/
public void decrementUInt32(int offset, long decrement) {
long value = this.buffer.getUnsignedIntLE(offset);
this.buffer.setIntLE(offset, (int) (value - decrement));
@@ -266,7 +272,9 @@ public final class RowBuffer {
}
/**
* The root header for the row.
* The root header of this {@link RowBuffer}.
*
* @return root header of this {@link RowBuffer}.
*/
public HybridRowHeader header() {
return this.readHeader();
@@ -291,6 +299,12 @@ public final class RowBuffer {
// this.buffer.writerIndex(this.length() + shift);
// }
/**
* Decrement the unsigned 32-bit integer value at the given {@code offset} in this {@link RowBuffer}.
*
* @param offset offset of a 32-bit unsigned integer value in this {@link RowBuffer}.
* @param increment the increment value.
*/
public void incrementUInt32(final int offset, final long increment) {
final long value = this.buffer.getUnsignedIntLE(offset);
this.buffer.setIntLE(offset, (int) (value + increment));
@@ -320,6 +334,8 @@ public final class RowBuffer {
/**
* The length of this {@link RowBuffer} in bytes.
*
* @return The length of this {@link RowBuffer} in bytes.
*/
public int length() {
return this.buffer.writerIndex();
@@ -378,21 +394,13 @@ public final class RowBuffer {
return dstEdit;
}
public long read7BitEncodedInt(int offset) {
Item<Long> item = this.read(this::read7BitEncodedInt, offset);
return item.value();
}
public long read7BitEncodedUInt(int offset) {
Item<Long> item = this.read(this::read7BitEncodedUInt, offset);
return item.value();
}
// TODO: DANOBLE: resurrect this method
// public MongoDbObjectId ReadMongoDbObjectId(int offset) {
// return MemoryMarshal.<MongoDbObjectId>Read(this.buffer.Slice(offset));
// }
/**
* Read the value of a bit within the bit field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a bit field within this {@link RowBuffer}.
* @param bit the bit to read.
* @return {@code true} if the {@code bit} is set, otherwise {@code false}.
*/
public boolean readBit(final int offset, @Nonnull final LayoutBit bit) {
checkNotNull(bit, "expected non-null bit");
@@ -405,31 +413,89 @@ public final class RowBuffer {
return item.value();
}
/**
* Read the value of the {@code DateTime} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code DateTime} field within this {@link RowBuffer}.
* @return the {@code DateTime} value read.
*/
public OffsetDateTime readDateTime(int offset) {
Item<OffsetDateTime> item = this.read(() -> DateTimeCodec.decode(this.buffer), offset);
return item.value();
}
// TODO: DANOBLE: resurrect this method
// public MongoDbObjectId ReadMongoDbObjectId(int offset) {
// return MemoryMarshal.<MongoDbObjectId>Read(this.buffer.Slice(offset));
// }
/**
* Read the value of the {@code Decimal} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Decimal} field within this {@link RowBuffer}.
* @return the {@code Decimal} value read.
*/
public BigDecimal readDecimal(int offset) {
Item<BigDecimal> item = this.read(() -> DecimalCodec.decode(this.buffer), offset);
return item.value();
}
/**
* Read the value of a {@code FixedBinary} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code FixedBinary} field within this {@link RowBuffer}.
* @return the {@code FixedBinary} value read.
*/
public ByteBuf readFixedBinary(int offset, int length) {
Item<ByteBuf> item = this.read(() -> this.buffer.readSlice(length), offset);
return item.value();
}
/**
* Read the value of a {@code FixedString} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code FixedString} field within this {@link RowBuffer}.
* @param length number of bytes in the {@code FixedString} field.
* @return the {@code FixedString} value read.
*/
public Utf8String readFixedString(int offset, int length) {
Item<Utf8String> item = this.read(this::readFixedString, offset, length);
return item.value();
}
/**
* Read the value of a {@code Float128} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Float128} field within this {@link RowBuffer}.
* @return the {@code Float128} value read.
*/
public Float128 readFloat128(int offset) {
Item<Float128> item = this.read(this::readFloat128, offset);
return item.value();
}
/**
* Read the value of a {@code Float32} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Float32} field within this {@link RowBuffer}.
* @return the {@code Float32} value read.
*/
public float readFloat32(int offset) {
Item<Float> item = this.read(this.buffer::readFloatLE, offset);
return item.value();
}
/**
* Read the value of a {@code Float64} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Float64} field within this {@link RowBuffer}.
* @return the {@code Float64} value read.
*/
public double readFloat64(int offset) {
Item<Double> item = this.read(this.buffer::readDoubleLE, offset);
return item.value();
}
// TODO: DANOBLE: resurrect this method
// public MongoDbObjectId ReadSparseMongoDbObjectId(Reference<RowCursor> edit) {
// this.readSparsePrimitiveTypeCode(edit, MongoDbObjectId);
@@ -437,16 +503,6 @@ public final class RowBuffer {
// return this.ReadMongoDbObjectId(edit.valueOffset()).clone();
// }
public float readFloat32(int offset) {
Item<Float> item = this.read(this.buffer::readFloatLE, offset);
return item.value();
}
public double readFloat64(int offset) {
Item<Double> item = this.read(this.buffer::readDoubleLE, offset);
return item.value();
}
/**
* Reads in the contents of the current {@link RowBuffer} from an {@link InputStream}.
* <p>
@@ -513,104 +569,218 @@ public final class RowBuffer {
return this.validateHeader(version);
}
/**
* Read the value of a {@code Guid} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Guid} field within this {@link RowBuffer}.
* @return the {@code Guid} value read.
*/
public UUID readGuid(int offset) {
return this.read(() -> GuidCodec.decode(this.buffer), offset).value();
}
/**
* Read the value of a {@code Header} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Header} field within this {@link RowBuffer}.
* @return the {@code Header} value read.
*/
public HybridRowHeader readHeader(int offset) {
return this.read(this::readHeader, offset).value();
}
/**
* Read the value of a {@code Int16} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Int16} field within this {@link RowBuffer}.
* @return the {@code Int16} value read.
*/
public short readInt16(int offset) {
return this.read(this.buffer::readShortLE, offset).value();
}
/**
* Read the value of a {@code Int32} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Int32} field within this {@link RowBuffer}.
* @return the {@code Int32} value read.
*/
public int readInt32(int offset) {
Item<Integer> item = this.read(this.buffer::readIntLE, offset);
return item.value();
}
/**
* Read the value of a {@code Int64} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Int64} field within this {@link RowBuffer}.
* @return the {@code Int64} value read.
*/
public long readInt64(int offset) {
Item<Long> item = this.read(this.buffer::readLongLE, offset);
return item.value();
}
/**
* Read the value of a {@code Int8} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code Int8} field within this {@link RowBuffer}.
* @return the {@code Int8} value read.
*/
public byte readInt8(int offset) {
Item<Byte> item = this.read(this.buffer::readByte, offset);
return item.value();
}
/**
* Read the value of a {@code SchemaId} field at the given {@code offset} within this {@link RowBuffer}.
*
* @param offset offset of a {@code SchemaId} field within this {@link RowBuffer}.
* @return the {@code SchemaId} value read.
*/
public SchemaId readSchemaId(int offset) {
Item<SchemaId> item = this.read(() -> SchemaId.from(this.buffer.readIntLE()), offset);
return item.value();
}
/**
* Read the value of a {@code SparseBinary} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseBinary} field within this {@link RowBuffer}.
* @return the {@code SparseBinary} value read.
*/
public ByteBuf readSparseBinary(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.BINARY);
Item<ByteBuf> item = this.read(this::readVariableBinary, edit);
return item.value();
}
/**
* Read the value of a {@code SparseBoolean} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseBoolean} field within this {@link RowBuffer}.
* @return the {@code SparseBoolean} value read.
*/
public boolean readSparseBoolean(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.BOOLEAN);
edit.endOffset(edit.valueOffset());
return edit.cellType() == LayoutTypes.BOOLEAN;
}
/**
* Read the value of a {@code SparseDateTime} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseDateTime} field within this {@link RowBuffer}.
* @return the {@code SparseDateTime} value read.
*/
public OffsetDateTime readSparseDateTime(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.DATE_TIME);
edit.endOffset(edit.valueOffset() + Long.SIZE);
return this.readDateTime(edit.valueOffset());
}
/**
* Read the value of a {@code SparseDecimal} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseDecimal} field within this {@link RowBuffer}.
* @return the {@code SparseDecimal} value read.
*/
public BigDecimal readSparseDecimal(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.DECIMAL);
Item<BigDecimal> item = this.read(this::readDecimal, edit);
return item.value();
}
/**
* Read the value of a {@code SparseFloat128} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseFloat128} field within this {@link RowBuffer}.
* @return the {@code SparseFloat128} value read.
*/
public Float128 readSparseFloat128(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.FLOAT_128);
Item<Float128> item = this.read(this::readFloat128, edit);
return item.value();
}
/**
* Read the value of a {@code SparseFloat32} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseFloat32} field within this {@link RowBuffer}.
* @return the {@code SparseFloat32} value read.
*/
public float readSparseFloat32(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.FLOAT_32);
Item<Float> item = this.read(this.buffer::readFloatLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseFloat64} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseFloat64} field within this {@link RowBuffer}.
* @return the {@code SparseFloat64} value read.
*/
public double readSparseFloat64(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.FLOAT_64);
Item<Double> item = this.read(this.buffer::readDoubleLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseGuid} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseGuid} field within this {@link RowBuffer}.
* @return the {@code SparseGuid} value read.
*/
public UUID readSparseGuid(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.GUID);
Item<UUID> item = this.read(this::readGuid, edit);
return item.value();
}
/**
* Read the value of a {@code SparseInt16} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseInt16} field within this {@link RowBuffer}.
* @return the {@code SparseInt16} value read.
*/
public short readSparseInt16(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.INT_16);
Item<Short> item = this.read(this.buffer::readShortLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseInt32} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseInt32} field within this {@link RowBuffer}.
* @return the {@code SparseInt32} value read.
*/
public int readSparseInt32(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.INT_32);
Item<Integer> item = this.read(this.buffer::readIntLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseInt64} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseInt64} field within this {@link RowBuffer}.
* @return the {@code SparseInt64} value read.
*/
public long readSparseInt64(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.INT_64);
Item<Long> item = this.read(this.buffer::readLongLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseInt8} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseInt8} field within this {@link RowBuffer}.
* @return the {@code SparseInt8} value read.
*/
public byte readSparseInt8(RowCursor edit) {
// TODO: Remove calls to readSparsePrimitiveTypeCode once moved to V2 read.
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.INT_8);
@@ -618,6 +788,12 @@ public final class RowBuffer {
return item.value();
}
/**
* Read the value of a {@code SparseNull} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseNull} field within this {@link RowBuffer}.
* @return the {@code SparseNull} value read.
*/
public NullValue readSparseNull(@Nonnull RowCursor edit) {
checkNotNull(edit, "expected non-null edit");
@@ -628,6 +804,12 @@ public final class RowBuffer {
return NullValue.DEFAULT;
}
/**
* Read the value of a {@code SparsePath} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparsePath} field within this {@link RowBuffer}.
* @return the {@code SparsePath} value read.
*/
public Utf8String readSparsePath(@Nonnull final RowCursor edit) {
checkNotNull(edit, "expected non-null edit");
@@ -645,6 +827,15 @@ public final class RowBuffer {
return item.value();
}
/**
* Read the value of a {@code SparseLen} field at the given {@code offset} position.
*
* @param layout
* @param offset position of a {@code SparseLen} field within this {@link RowBuffer}.
* @param pathLenInBytes
* @param pathOffset
* @return the {@code SparseLen} value read.
*/
public int readSparsePathLen(
@Nonnull final Layout layout, final int offset, @Nonnull final Out<Integer> pathLenInBytes,
@Nonnull final Out<Integer> pathOffset) {
@@ -668,103 +859,218 @@ public final class RowBuffer {
return token;
}
/**
* Read the value of a {@code SparseString} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseString} field within this {@link RowBuffer}.
* @return the {@code SparseString} value read.
*/
public Utf8String readSparseString(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.UTF_8);
Item<Utf8String> item = this.read(this::readUtf8String, edit);
return item.value();
}
/**
* Read the value of a {@code SparseTypeCode} field at the given {@code offset} position.
*
* @param offset position of a {@code SparseTypeCode} field within this {@link RowBuffer}.
* @return the {@code SparseTypeCode} value read.
*/
public LayoutType readSparseTypeCode(int offset) {
return LayoutType.fromCode(LayoutCode.from(this.readInt8(offset)));
}
/**
* Read the value of a {@code SparseUInt16} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseUInt16} field within this {@link RowBuffer}.
* @return the {@code SparseUInt16} value read.
*/
public int readSparseUInt16(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.UINT_16);
Item<Integer> item = this.read(this.buffer::readUnsignedShortLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseUInt32} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseUInt32} field within this {@link RowBuffer}.
* @return the {@code SparseUInt32} value read.
*/
public long readSparseUInt32(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.UINT_32);
Item<Long> item = this.read(this.buffer::readUnsignedIntLE, edit);
return item.value();
}
/**
* Read the value of a {@code SparseUInt64} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseUInt64} field within this {@link RowBuffer}.
* @return the {@code SparseUInt64} value read.
*/
public long readSparseUInt64(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.UINT_64);
Item<Long> item = this.read(this.buffer::readLongLE, edit);
return item.value;
}
/**
* Read the value of a {@code SparseUInt8} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseUInt8} field within this {@link RowBuffer}.
* @return the {@code SparseUInt8} value read.
*/
public short readSparseUInt8(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.UINT_8);
Item<Short> item = this.read(this.buffer::readUnsignedByte, edit);
return item.value;
}
/**
* Read the value of a {@code SparseUnixDateTime} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseUnixDateTime} field within this {@link RowBuffer}.
* @return the {@code SparseUnixDateTime} value read.
*/
public UnixDateTime readSparseUnixDateTime(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.UNIX_DATE_TIME);
Item<UnixDateTime> item = this.read(this::readUnixDateTime, edit);
return item.value();
}
/**
* Read the value of a {@code SparseVarInt} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseVarInt} field within this {@link RowBuffer}.
* @return the {@code SparseVarInt} value read.
*/
public long readSparseVarInt(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.VAR_INT);
Item<Long> item = this.read(this::read7BitEncodedInt, edit);
return item.value();
}
/**
* Read the value of a {@code SparseVarUInt} field at the given {@link RowCursor edit} position.
*
* @param edit {@link RowCursor edit} position of a {@code SparseVarUInt} field within this {@link RowBuffer}.
* @return the {@code SparseVarUInt} value read.
*/
public long readSparseVarUInt(RowCursor edit) {
this.readSparsePrimitiveTypeCode(edit, LayoutTypes.VAR_UINT);
Item<Long> item = this.read(this::read7BitEncodedUInt, edit);
return item.value();
}
/**
* Read the value of a {@code UInt16} field at the given {@code offset} position.
*
* @param offset position of a {@code UInt16} field within this {@link RowBuffer}.
* @return the {@code UInt16} value read.
*/
public int readUInt16(int offset) {
Item<Integer> item = this.read(this.buffer::readUnsignedShortLE, offset);
return item.value();
}
/**
* Read the value of a {@code UInt32} field at the given {@code offset} position.
*
* @param offset position of a {@code UInt32} field within this {@link RowBuffer}.
* @return the {@code UInt32} value read.
*/
public long readUInt32(int offset) {
Item<Long> item = this.read(this.buffer::readUnsignedIntLE, offset);
return item.value();
}
/**
* Read the value of a {@code UInt64} field at the given {@code offset} position.
*
* @param offset position of a {@code UInt64} field within this {@link RowBuffer}.
* @return the {@code UInt64} value read.
*/
public long readUInt64(int offset) {
Item<Long> item = this.read(this.buffer::readLongLE, offset);
return item.value();
}
/**
* Read the value of a {@code UInt8} field at the given {@code offset} position.
*
* @param offset position of a {@code UInt8} field within this {@link RowBuffer}.
* @return the {@code UInt8} value read.
*/
public short readUInt8(int offset) {
Item<Short> item = this.read(this.buffer::readUnsignedByte, offset);
return item.value();
}
/**
* Read the value of a {@code UnixDateTime} field at the given {@code offset} position.
*
* @param offset position of a {@code UnixDateTime} field within this {@link RowBuffer}.
* @return the {@code UnixDateTime} value read.
*/
public UnixDateTime readUnixDateTime(int offset) {
Item<UnixDateTime> item = this.read(this::readUnixDateTime, offset);
return item.value();
}
/**
* Read the value of a {@code VariableBinary} field at the given {@code offset} position.
*
* @param offset position of a {@code VariableBinary} field within this {@link RowBuffer}.
* @return the {@code VariableBinary} value read.
*/
public ByteBuf readVariableBinary(int offset) {
Item<ByteBuf> item = this.read(this::readVariableBinary, offset);
return item.value();
}
/**
* Read the value of a {@code VariableInt} field at the given {@code offset} position.
*
* @param offset position of a {@code VariableInt} field within this {@link RowBuffer}.
* @return the {@code VariableInt} value read.
*/
public long readVariableInt(int offset) {
Item<Long> item = this.read(this::read7BitEncodedInt, offset);
return item.value();
}
/**
* Read the value of a {@code VariableString} field at the given {@code offset} position.
*
* @param offset position of a {@code VariableString} field within this {@link RowBuffer}.
* @return the {@code VariableString} value read.
*/
public Utf8String readVariableString(final int offset) {
Item<Utf8String> item = this.read(this::readUtf8String, offset);
return item.value();
}
/**
* Read the value of a {@code VariableUInt} field at the given {@code offset} position.
*
* @param offset position of a {@code VariableUInt} field within this {@link RowBuffer}.
* @return the {@code VariableUInt} value read.
*/
public long readVariableUInt(final int offset) {
Item<Long> item = this.read(this::read7BitEncodedUInt, offset);
return item.value();
}
/**
* Read the value of a {@code VariableUInt} field at the given {@code offset} position.
*
* @param offset position of a {@code VariableUInt} field within this {@link RowBuffer}.
* @param length on return, the number of bytes read.
* @return the {@code VariableUInt} value read.
*/
public long readVariableUInt(final int offset, @Nonnull final Out<Integer> length) {
Item<Long> item = this.read(this::read7BitEncodedUInt, offset);
length.set(item.length());
@@ -786,14 +1092,6 @@ public final class RowBuffer {
return this.resolver;
}
// TODO: DANOBLE: Support MongoDbObjectId values
// public void WriteMongoDbObjectId(int offset, MongoDbObjectId value) {
// Reference<azure.data.cosmos.serialization.hybridrow.MongoDbObjectId> tempReference_value =
// new Reference<azure.data.cosmos.serialization.hybridrow.MongoDbObjectId>(value);
// MemoryMarshal.Write(this.buffer.Slice(offset), tempReference_value);
// value = tempReference_value.get();
// }
/**
* Rotates the sign bit of a two's complement value to the least significant bit.
*
@@ -801,15 +1099,11 @@ public final class RowBuffer {
* @return An unsigned value encoding the same value but with the sign bit in the LSB.
* <p>
* Moves the signed bit of a two's complement value to the least significant bit (LSB) by:
* <list type="number">
* <item>
* <description>If negative, take the two's complement.</description>
* </item><item>
* <description>Left shift the value by 1 bit.</description>
* </item><item>
* <description>If negative, set the LSB to 1.</description>
* </item>
* </list>
* <ol>
* <li>If negative, take the two's complement.
* <li>Left shift the value by 1 bit.
* <li>If negative, set the LSB to 1.
* </ol>
*/
public static long rotateSignToLsb(long value) {
boolean isNegative = value < 0;
@@ -829,6 +1123,14 @@ public final class RowBuffer {
return isNegative ? (~(unsignedValue >>> 1) + 1) | 0x8000000000000000L : unsignedValue >>> 1;
}
// TODO: DANOBLE: Support MongoDbObjectId values
// public void WriteMongoDbObjectId(int offset, MongoDbObjectId value) {
// Reference<azure.data.cosmos.serialization.hybridrow.MongoDbObjectId> tempReference_value =
// new Reference<azure.data.cosmos.serialization.hybridrow.MongoDbObjectId>(value);
// MemoryMarshal.Write(this.buffer.Slice(offset), tempReference_value);
// value = tempReference_value.get();
// }
public void setBit(final int offset, @Nonnull final LayoutBit bit) {
checkNotNull(bit, "expected non-null bit");
if (bit.isInvalid()) {
@@ -1065,28 +1367,20 @@ public final class RowBuffer {
* @param scope The sparse scope to rebuild an index for.
* @return Success if the index could be built, an error otherwise.
* <p>
* The <paramref name="scope" /> MUST be a set or map scope.
* The {@code scope} MUST be a set or map scope.
* <p>
* The scope may have been built (e.g. via RowWriter) with relaxed uniqueness constraint checking.
* This operation rebuilds an index to support verification of uniqueness constraints during
* subsequent partial updates. If the appropriate uniqueness constraints cannot be established (i.e.
* a duplicate exists), this operation fails. Before continuing, the resulting scope should either:
* <list type="number">
* <item>
* <description>
* Be repaired (e.g. by deleting duplicates) and the index rebuild operation should be
* run again.
* </description>
* </item> <item>
* <description>Be deleted. The entire scope should be removed including its items.</description>
* </item>
* </list> Failure to perform one of these actions will leave the row is potentially in a corrupted
* state where partial updates may subsequent fail.
* </p>
* <ol>
* <li>Be repaired (e.g. by deleting duplicates) and the index rebuild operation should be run again.
* <li>Be deleted. The entire scope should be removed including its items.
* </ol>
* Failure to perform one of these actions will leave the row is potentially in a corrupted state where partial
* updates may subsequent fail.
* <p>
* The target <paramref name="scope" /> may or may not have already been indexed. This
* operation is idempotent.
* </p>
* The target {@code scope} may or may not have already been indexed. This operation is idempotent.
*/
@Nonnull
public Result typedCollectionUniqueIndexRebuild(@Nonnull final RowCursor scope) {
@@ -2762,10 +3056,20 @@ public final class RowBuffer {
return Item.of(value, offset, actualLength);
}
private long read7BitEncodedInt(int offset) {
Item<Long> item = this.read(this::read7BitEncodedInt, offset);
return item.value();
}
private long read7BitEncodedInt() {
return RowBuffer.rotateSignToMsb(this.read7BitEncodedUInt());
}
private long read7BitEncodedUInt(int offset) {
Item<Long> item = this.read(this::read7BitEncodedUInt, offset);
return item.value();
}
private long read7BitEncodedUInt() {
long b = this.buffer.readByte() & 0xFFL;

View File

@@ -79,23 +79,39 @@ public final class RowCursor implements Cloneable {
/**
* If existing, the layout code of the existing field, otherwise undefined.
*
* @return layout code.
*/
public LayoutType cellType() {
return this.cellType;
}
public RowCursor cellType(LayoutType cellType) {
this.cellType = cellType;
/**
* Sets the layout type of an existing field.
*
* @param value a {@link LayoutType layout type}.
* @return a reference to this {@link RowCursor}.
*/
public RowCursor cellType(LayoutType value) {
this.cellType = value;
return this;
}
/**
* For types with generic parameters (e.g. {@link LayoutTuple}, the type parameters.
*
* @return a {@link TypeArgumentList type argument argument list} or {@code null}.
*/
public TypeArgumentList cellTypeArgs() {
return this.cellTypeArgs;
}
/**
* Sets the layout type arguments of an existing field.
*
* @param value a {@link TypeArgumentList type argument argument list}.
* @return a reference to this {@link RowCursor}.
*/
public RowCursor cellTypeArgs(TypeArgumentList value) {
this.cellTypeArgs = value;
return this;
@@ -103,48 +119,81 @@ public final class RowCursor implements Cloneable {
/**
* For sized scopes (e.g. Typed Array), the number of elements.
*
* @return the number of elements or zero.
*/
public int count() {
return this.count;
}
/**
* Sets the number of elements for a sized scope.
*
* @param count the number of elements for a sized scope.
* @return a reference to this {@link RowCursor}.
*/
public RowCursor count(int count) {
this.count = count;
return this;
}
/**
* If true, this scope is an unique index scope whose index will be built after its items are written.
* If true, this scope is a unique index scope whose index will be built after its items are written.
*
* @return {@code true}, if this cursor identifies a unique index scope, otherwise {@code false}.
*/
public boolean deferUniqueIndex() {
return this.deferUniqueIndex;
}
/**
* Sets a value that indicates whether this cursor identifies a unique index scope.
*
* @param value {@code true}, if this cursor identifies a unique index scope, otherwise {@code false}.
* @return a reference to this {@link RowCursor}.
*/
public RowCursor deferUniqueIndex(boolean value) {
this.deferUniqueIndex = value;
return this;
}
/**
* If existing, the offset to the end of the existing field. Used as a hint when skipping.
* forward.
* If existing, the offset to the end of the existing field.
* <p>
* This value is used as a hint when skipping forward.
*
* @return offset of the end of an existing field.
*/
public int endOffset() {
return this.endOffset;
}
/**
* Sets a value that indicates whether this cursor identifies a unique index scope.
*
* @param value {@code true}, if this cursor identifies a unique index scope, otherwise {@code false}.
* @return a reference to this {@link RowCursor}.
*/
public RowCursor endOffset(int value) {
this.endOffset = value;
return this;
}
/**
* True if an existing field matching the search criteria was found.
* {@code true} if an existing field matching the search criteria was found.
*
* @return {@code true} if an existing field matching the search criteria was found, otherwise {@code false}.
*/
public boolean exists() {
return this.exists;
}
/**
* Sets a value that indicates whether this cursor identifies a field matching search criteria.
*
* @param value {@code true}, if this cursor identifies a field matching search criteria, otherwise {@code false}.
* @return a reference to this {@link RowCursor}.
*/
public RowCursor exists(boolean value) {
this.exists = value;
return this;

View File

@@ -39,7 +39,7 @@ public final class SchemaId implements Comparable<SchemaId> {
private final int value;
/**
* Initializes a new instance of the {@link SchemaId} struct.
* Initializes a new instance of the {@link SchemaId} class.
*
* @param value The underlying globally unique identifier of the schema.
*/
@@ -78,9 +78,10 @@ public final class SchemaId implements Comparable<SchemaId> {
}
/**
* Returns a {@link SchemaId} from a specified underlying integer value.
* Returns a {@link SchemaId} with the given underlying integer value.
*
* @return The integer value of this {@link SchemaId}
* @param value an integer.
* @return a {@link SchemaId} with the given underlying integer {@code value}.
*/
public static SchemaId from(int value) {
return cache.computeIfAbsent(value, SchemaId::new);

View File

@@ -24,23 +24,23 @@ public final class UnixDateTime {
private long milliseconds;
/**
* Initializes a new instance of the {@link UnixDateTime} struct.
*
* @param milliseconds The number of milliseconds since {@link EPOCH}.
*/
private UnixDateTime() {
}
/**
* Initializes a new instance of the {@link UnixDateTime} class.
*
* @param milliseconds The number of milliseconds since {@link #EPOCH}.
*/
public UnixDateTime(long milliseconds) {
this.milliseconds = milliseconds;
}
/**
* {@code> true} if this value is the same as another value
* {@code> true} if this value is the same as another value.
*
* @param other value to compare
* @return {code true} if this value is the same as the {code other}
* @param other value to compare.
* @return {code true} if this value is the same as the {code other}, {@code false} otherwise.
*/
public boolean equals(UnixDateTime other) {
if (other == null) {
@@ -66,9 +66,11 @@ public final class UnixDateTime {
}
/**
* The number of milliseconds since {@link #EPOCH}
* The number of milliseconds since {@link #EPOCH}.
* <p>
* This value may be negative
* This value may be negative.
*
* @return the number of milliseconds since {@link #EPOCH}.
*/
public long milliseconds() {
return this.milliseconds;

View File

@@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*
* {@link OffsetDateTime} values are serialized as unsigned 64-bit integers:
*
* <table>
* <table summary="Layout of field value">
* <tbody>
* <tr><td>
* Bits 01-62

View File

@@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* {@link UUID}s are serialized like {@code System.Guid}s read and written by {@code MemoryMarshal.Read} and
* {@code MemoryMarshal.Write}.
*
* <table>
* <table summary="Layout of field value">
* <tbody>
* <tr><td>
* Bits 00-31

View File

@@ -3,7 +3,6 @@
package com.azure.data.cosmos.serialization.hybridrow.io;
import com.azure.data.cosmos.core.Reference;
import com.azure.data.cosmos.serialization.hybridrow.Result;
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
@@ -18,5 +17,5 @@ public interface IRowSerializable {
* @param typeArg The schematized layout type, if a schema is available
* @return Success if the write is successful, the error code otherwise
*/
Result write(Reference<RowWriter> writer, TypeArgument typeArg);
Result write(RowWriter writer, TypeArgument typeArg);
}

View File

@@ -156,6 +156,8 @@ public final class RowReader {
* If the current field is a Nullable scope, this method return true if the value is not null. If the current field
* is a nullable Null primitive value, this method return true if the value is set (even though its values is set
* to null).
*
* @return {@code true} if field has a value, {@code false} otherwise.
*/
public boolean hasValue() {
@@ -181,6 +183,7 @@ public final class RowReader {
* <p>
* When enumerating a non-indexed scope, this value is always zero.
*
* @return zero-based index of the field relative to the scope, if positioned on a field; otherwise undefined.
* @see #path
*/
public int index() {
@@ -189,6 +192,8 @@ public final class RowReader {
/**
* The length of row in bytes.
*
* @return length of the current row in bytes.
*/
public int length() {
return this.row.length();
@@ -197,8 +202,9 @@ public final class RowReader {
/**
* The path, relative to the scope, of the field--if positioned on a field--undefined otherwise.
* <p>
* When enumerating an indexed scope, this value is always null.
* When enumerating an indexed scope, this value is always {@code null}.
*
* @return path of the field relative to the scope, if positioned on a field; otherwise undefined.
* @see #index
*/
public UtfAnyString path() {
@@ -228,6 +234,7 @@ public final class RowReader {
* <p>
* When enumerating an indexed scope, this value is always null.
*
* @return path of the field relative to the scope, if positioned on a field; otherwise undefined.
* @see #index
*/
public Utf8String pathSpan() {
@@ -244,7 +251,7 @@ public final class RowReader {
/**
* Advances the reader to the next field.
*
* @return {@code true}, if there is another field to be read; {@code false} otherwise
* @return {@code true}, if there is another field to be read; {@code false} otherwise.
*/
public boolean read() {
@@ -505,7 +512,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.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
@@ -533,7 +540,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.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
@@ -560,7 +567,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.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
@@ -587,7 +594,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.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
@@ -614,7 +621,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.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
@@ -641,7 +648,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.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
@@ -672,6 +679,11 @@ public final class RowReader {
* <p>
* Child readers can be used to read all sparse scope types including typed and untyped objects, arrays, tuples,
* set, and maps.
*
* @param <TContext> a reader context type.
* @param context a reader context.
* @param func a reader function.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
@Nonnull
public <TContext> Result readScope(@Nullable final TContext context, @Nullable final ReaderFunc<TContext> func) {
@@ -689,10 +701,12 @@ 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>
* Child readers can be used to read all sparse scope types including typed and untyped objects, arrays, tuples,
* set, and maps. Nested child readers are independent of their parent.
*
* @return a new {@link RowReader}.
*/
public @Nonnull RowReader readScope() {
RowCursor newScope = this.row.sparseIteratorReadScope(this.cursor, true);
@@ -700,9 +714,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readString(Out<String> value) {
@@ -770,9 +784,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readUInt32(Out<Long> value) {
@@ -798,9 +812,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readUInt64(Out<Long> value) {
@@ -825,9 +839,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readUInt8(Out<Short> value) {
@@ -852,9 +866,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readUnixDateTime(Out<UnixDateTime> value) {
@@ -879,9 +893,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readVarInt(Out<Long> value) {
@@ -906,9 +920,9 @@ 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 {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result readVarUInt(Out<Long> value) {
@@ -937,13 +951,14 @@ public final class RowReader {
}
/**
* Advance a reader to the end of a child reader
* Advance a reader to the end of a child reader.
* <p>
* The child reader is also advanced to the end of its scope. The reader must not have been advanced since the child
* reader was created with {@link #readScope}. This method can be used when the overload of {@link #readScope} that
* takes a {@link ReaderFunc{TContext} is not an option.
* takes a {@link ReaderFunc} is not an option.
*
* @param nestedReader nested (child) reader to be advanced
* @param nestedReader nested (child) reader to be advanced.
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
*/
public Result skipScope(@Nonnull final RowReader nestedReader) {
if (nestedReader.cursor.start() != this.cursor.valueOffset()) {
@@ -954,7 +969,9 @@ public final class RowReader {
}
/**
* The storage placement of the field--if positioned on a field--undefined otherwise
* The storage placement of the field--if positioned on a field--undefined otherwise.
*
* @return storage kind.
*/
public StorageKind storage() {
switch (this.state) {
@@ -968,7 +985,9 @@ public final class RowReader {
}
/**
* The type of the field--if positioned on a field--undefined otherwise
* The type of the field--if positioned on a field--undefined otherwise.
*
* @return layout type.
*/
public LayoutType type() {
@@ -983,7 +1002,9 @@ public final class RowReader {
}
/**
* The type arguments of the field (if positioned on a field, undefined otherwise)
* The type arguments of the field, if positioned on a field, undefined otherwise.
*
* @return type argument list.
*/
public TypeArgumentList typeArgs() {

View File

@@ -72,6 +72,8 @@ public final class RowWriter {
/**
* The active layout of the current writer scope.
*
* @return layout of the current writer scope.
*/
public Layout layout() {
return this.cursor.layout();
@@ -79,6 +81,8 @@ public final class RowWriter {
/**
* The length of row in bytes.
*
* @return length of the row in bytes.
*/
public int length() {
return this.row.length();
@@ -86,6 +90,8 @@ public final class RowWriter {
/**
* The resolver for UDTs.
*
* @return the resolver of UDTs.
*/
public LayoutResolver resolver() {
return this.row.resolver();

View File

@@ -20,7 +20,7 @@ public final class RowReaderJsonExtensions {
* Project a JSON document from a HybridRow {@link RowReader}.
*
* @param reader The reader to project to JSON.
* @param string If {@link Result#SUCCESS}, the JSON document that corresponds to the {@code reader).
* @param string If {@link Result#SUCCESS}, the JSON document that corresponds to the {@code reader}.
* @return The result.
*/
@Nonnull
@@ -33,7 +33,7 @@ public final class RowReaderJsonExtensions {
*
* @param reader The reader to project to JSON.
* @param settings Settings that control how the JSON document is formatted.
* @param string If {@link Result#SUCCESS}, the JSON document that corresponds to the {@code reader).
* @param string If {@link Result#SUCCESS}, the JSON document that corresponds to the {@code reader}.
* @return The result.
*/
@Nonnull

View File

@@ -4,11 +4,10 @@
package com.azure.data.cosmos.serialization.hybridrow.json;
public final class RowReaderJsonSettings {
private String indentChars;
private char quoteChar;
public RowReaderJsonSettings(String indentChars) {
this(indentChars, '"');
}
@@ -24,14 +23,19 @@ public final class RowReaderJsonSettings {
/**
* If non-null then child objects are indented by one copy of this string per level.
*
* @return indentation characters.
*/
public String indentChars() {
return this.indentChars;
}
/**
* The quote character to use.
* May be <see cref="lang:\""/> or {@link '}.
* The current quote character.
* <p>
* May be double or single quote.
*
* @return quote character.
*/
public char quoteChar() {
return this.quoteChar;

View File

@@ -34,7 +34,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
public final class Layout {
public static final Layout EMPTY = SystemSchema.layoutResolver.resolve(SystemSchema.EMPTY_SCHEMA_ID);
public static final Layout EMPTY = SystemSchema.layoutResolver().resolve(SystemSchema.EMPTY_SCHEMA_ID);
private final String name;
private final int numBitmaskBytes;

View File

@@ -5,6 +5,7 @@ package com.azure.data.cosmos.serialization.hybridrow.layouts;
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
import com.azure.data.cosmos.serialization.hybridrow.schemas.Namespace;
import com.google.common.base.Suppliers;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -12,8 +13,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.function.Supplier;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.lenientFormat;
public final class SystemSchema {
@@ -27,45 +30,36 @@ public final class SystemSchema {
* SchemaId of HybridRow RecordIO Record Headers.
*/
public static final SchemaId RECORD_SCHEMA_ID = SchemaId.from(2147473649);
/**
* SchemaId of HybridRow RecordIO Segments.
*/
public static final SchemaId SEGMENT_SCHEMA_ID = SchemaId.from(2147473648);
public static final LayoutResolver layoutResolver = SystemSchema.loadSchema();
@SuppressWarnings("StatementWithEmptyBody")
private static final Supplier<LayoutResolver> layoutResolver = Suppliers.memoize(() -> {
final String json;
try (final InputStream stream = SystemSchema.class.getResourceAsStream("SystemSchema.json")) {
ByteBuf buffer = Unpooled.buffer();
while (buffer.writeBytes(stream, 8192) == 8192) { }
json = buffer.readCharSequence(buffer.readableBytes(), StandardCharsets.UTF_8).toString();
} catch (IOException cause) {
String message = lenientFormat("failed to load SystemSchema.json due to %s", cause);
throw new IllegalStateException(message, cause);
}
Optional<Namespace> namespace = Namespace.parse(json);
checkState(namespace.isPresent(), "failed to load SystemSchema.json");
return new LayoutResolverNamespace(namespace.get());
});
private SystemSchema() {
}
/*
private static String FormatResourceName(Assembly assembly, String resourceName) {
return assembly.GetName().Name + "." + resourceName.replace(" ", "_").replace("\\", ".").replace("/", ".");
}
*/
static LayoutResolver loadSchema() {
final String json;
try {
json = SystemSchema.readFromResourceFile("system-schema.json");
} catch (IOException cause) {
throw new IllegalStateException("failed to load system-schema.json", cause);
}
Optional<Namespace> ns = Namespace.parse(json);
checkState(ns.isPresent(), "failed to load system-schema.json");
return new LayoutResolverNamespace(ns.get());
}
@SuppressWarnings("StatementWithEmptyBody")
private static String readFromResourceFile(String name) throws IOException {
try (final InputStream stream = SystemSchema.class.getResourceAsStream(name)) {
ByteBuf buffer = Unpooled.buffer();
while (buffer.writeBytes(stream, 8192) == 8192) {
}
return buffer.readCharSequence(buffer.readableBytes(), StandardCharsets.UTF_8).toString();
}
public static LayoutResolver layoutResolver() {
return layoutResolver.get();
}
}

View File

@@ -10,6 +10,7 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Optional;
@@ -52,7 +53,7 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testCodePoints(UnicodeTextItem item) {
public void testCodePoints(UnicodeText item) {
Utf8String value = Utf8String.transcodeUtf16(item.value());
assertEquals(value.codePoints().iterator(), item.value().codePoints().iterator());
}
@@ -71,7 +72,7 @@ public class Utf8StringTest {
@SuppressWarnings("EqualsWithItself")
@Test(dataProvider = "unicodeTextDataProvider")
public void testCompareTo(UnicodeTextItem item) {
public void testCompareTo(UnicodeText item) {
Utf8String value = Utf8String.transcodeUtf16(item.value());
assertEquals(value.compareTo(value), 0);
@@ -100,7 +101,7 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testEncodedLength(UnicodeTextItem item) {
public void testEncodedLength(UnicodeText item) {
final int encodedLength = item.buffer.length;
assertEquals(Utf8String.from(item.byteBuf()).orElseThrow(AssertionError::new).encodedLength(), encodedLength);
assertEquals(Utf8String.fromUnsafe(item.byteBuf()).encodedLength(), encodedLength);
@@ -108,7 +109,7 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testTestEquals(UnicodeTextItem item) {
public void testTestEquals(UnicodeText item) {
TestEquals testEquals = new TestEquals(item);
@@ -136,7 +137,7 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testFrom(UnicodeTextItem item) {
public void testFrom(UnicodeText item) {
Optional<Utf8String> value = Utf8String.from(item.byteBuf());
assertTrue(value.isPresent());
assertTrue(value.get().equals(value.get()));
@@ -145,7 +146,7 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testFromUnsafe(UnicodeTextItem item) {
public void testFromUnsafe(UnicodeText item) {
Utf8String value = Utf8String.fromUnsafe(item.byteBuf());
assertTrue(value.equals(value));
assertTrue(value.equals(item.value()));
@@ -153,13 +154,13 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testHashCode(UnicodeTextItem item) {
public void testHashCode(UnicodeText item) {
Utf8String value = Utf8String.fromUnsafe(item.byteBuf());
assertEquals(value.hashCode(), item.byteBuf().hashCode());
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testLength(UnicodeTextItem item) {
public void testLength(UnicodeText item) {
assertEquals(Utf8String.fromUnsafe(item.byteBuf()).length(), item.value().length());
}
@@ -168,12 +169,12 @@ public class Utf8StringTest {
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testToUtf16(UnicodeTextItem item) {
public void testToUtf16(UnicodeText item) {
assertEquals(Utf8String.fromUnsafe(item.byteBuf()).toUtf16(), item.value());
}
@Test(dataProvider = "unicodeTextDataProvider")
public void testTranscodeUtf16(UnicodeTextItem item) {
public void testTranscodeUtf16(UnicodeText item) {
assertEquals(Utf8String.transcodeUtf16(item.value()).toUtf16(), item.value());
}
@@ -203,31 +204,31 @@ public class Utf8StringTest {
@DataProvider(name = "unicodeTextDataProvider")
private static Iterator<Object[]> unicodeTextData() {
ImmutableList<UnicodeTextItem> items = ImmutableList.of(
ImmutableList<UnicodeText> items = ImmutableList.of(
// US ASCII (7-bit encoding)
// ..English
new UnicodeTextItem("The quick brown fox jumps over the lazy dog."),
new UnicodeText("The quick brown fox jumps over the lazy dog."),
// ISO-8859-1 (8-bit encoding)
// ..German
new UnicodeTextItem("Der schnelle braune Fuchs springt über den faulen Hund."),
new UnicodeText("Der schnelle braune Fuchs springt über den faulen Hund."),
// ..Icelandic
new UnicodeTextItem("Skjótur brúni refurinn hoppar yfir lata hundinn."),
new UnicodeText("Skjótur brúni refurinn hoppar yfir lata hundinn."),
// ..Spanish
new UnicodeTextItem("El rápido zorro marrón salta sobre el perro perezoso."),
new UnicodeText("El rápido zorro marrón salta sobre el perro perezoso."),
// ISO 8859-7 (11-bit encoding)
// ..Greek
new UnicodeTextItem("Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο σκυλί."),
new UnicodeText("Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο σκυλί."),
// Katakana code block (16-bit encoding)
// ..Japanese
new UnicodeTextItem("速い茶色のキツネは怠laな犬を飛び越えます。"),
new UnicodeText("速い茶色のキツネは怠laな犬を飛び越えます。"),
// Deseret code block (21-bit encoding containing an English alphabet invented by the LDS Church)
// ..Deseret
new UnicodeTextItem("\uD801\uDC10\uD801\uDC2F\uD801\uDC4A\uD801\uDC2C, \uD801\uDC38\uD801\uDC35 \uD801\uDC2A\uD801\uDC49 \uD801\uDC4F?")
new UnicodeText("\uD801\uDC10\uD801\uDC2F\uD801\uDC4A\uD801\uDC2C, \uD801\uDC38\uD801\uDC35 \uD801\uDC2A\uD801\uDC49 \uD801\uDC4F?")
);
return items.stream().map(item -> new Object[] { item }).iterator();
@@ -235,10 +236,10 @@ public class Utf8StringTest {
private static class TestEquals {
private final UnicodeTextItem item;
private final UnicodeText item;
private final Utf8String[] variants;
public TestEquals(UnicodeTextItem item) {
public TestEquals(UnicodeText item) {
this.item = item;
@@ -276,10 +277,10 @@ public class Utf8StringTest {
private static class TestNotEquals {
private final UnicodeTextItem item;
private final UnicodeText item;
private final Utf8String[] variants;
public TestNotEquals(UnicodeTextItem item) {
public TestNotEquals(UnicodeText item) {
this.item = item;
@@ -384,6 +385,30 @@ public class Utf8StringTest {
assertEquals(
normalize(ej.compareTo(Utf8String.transcodeUtf16(lj))),
normalize(lj.compareTo(lj)));
// Compare multi-character strings
String word1 = Arrays.stream(this.letters).skip(i).limit(j - i).reduce("", (w, c) -> w + c);
String word2 = Arrays.stream(this.letters).skip(j).limit(this.letters.length - j).reduce("", (w, c) -> w + c);
assertEquals(
normalize(Utf8String.transcodeUtf16(word1).compareTo(word1)),
normalize(word1.compareTo(word1)));
assertEquals(
normalize(Utf8String.transcodeUtf16(word1).compareTo(word2)),
normalize(word1.compareTo(word2)));
assertEquals(
normalize(Utf8String.transcodeUtf16(word2).compareTo(word1)),
normalize(word2.compareTo(word1)));
assertEquals(
normalize(Utf8String.transcodeUtf16(word1).compareTo(Utf8String.transcodeUtf16(word1))),
normalize(word1.compareTo(word1)));
assertEquals(
normalize(Utf8String.transcodeUtf16(word1).compareTo(Utf8String.transcodeUtf16(word2))),
normalize(word1.compareTo(word2)));
assertEquals(
normalize(Utf8String.transcodeUtf16(word2).compareTo(Utf8String.transcodeUtf16(word1))),
normalize(word2.compareTo(word1)));
}
@Override
@@ -396,12 +421,12 @@ public class Utf8StringTest {
}
}
private static class UnicodeTextItem {
private static class UnicodeText {
private final byte[] buffer;
private final String value;
UnicodeTextItem(String value) {
UnicodeText(String value) {
this.buffer = value.getBytes(StandardCharsets.UTF_8);
this.value = value;
}
@@ -416,7 +441,7 @@ public class Utf8StringTest {
@Override
public String toString() {
return this.value.toString();
return this.value;
}
public String value() {

View File

@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.layouts;
import org.testng.annotations.Test;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.testng.Assert.*;
public class SystemSchemaTest {
private static final Path SchemaFile = Paths.get("data", "CustomerSchema.json");
@Test
public void testLoadSchema() {
final LayoutResolver layoutResolver = SystemSchema.layoutResolver();
final Layout recordLayout = layoutResolver.resolve(SystemSchema.RECORD_SCHEMA_ID);
assertEquals(recordLayout.name(), "Record");
assertEquals(recordLayout.schemaId(), SystemSchema.RECORD_SCHEMA_ID);
final Layout segmentLayout = layoutResolver.resolve(SystemSchema.SEGMENT_SCHEMA_ID);
assertEquals(segmentLayout.name(), "Segment");
assertEquals(segmentLayout.schemaId(), SystemSchema.SEGMENT_SCHEMA_ID);
}
}

View File

@@ -1,316 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
import com.google.protobuf.Message;
import com.google.protobuf.Parser;
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TestData/CassandraHotelSchema.proto
// </auto-generated>
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;
public final class Address implements Message<Address> {
/**
* Field number for the "city" field.
*/
public static final int CityFieldNumber = 2;
/**
* Field number for the "postal_code" field.
*/
public static final int PostalCodeFieldNumber = 4;
/**
* Field number for the "state" field.
*/
public static final int StateFieldNumber = 3;
/**
* Field number for the "street" field.
*/
public static final int StreetFieldNumber = 1;
private static final Parser<?> _parser = new Address().getParserForType();
private static final Google.Protobuf.FieldCodec<String> _single_city_codec = Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
// partial void OnConstruction();
private static final Google.Protobuf.FieldCodec<String> _single_state_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
private static final Google.Protobuf.FieldCodec<String> _single_street_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
private Google.Protobuf.UnknownFieldSet _unknownFields;
private String city_;
private PostalCode postalCode_;
private String state_;
private String street_;
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address()
public Address() {
OnConstruction();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address(Address other)
public Address(Address other) {
this();
setStreet(other.getStreet());
setCity(other.getCity());
setState(other.getState());
setPostalCode(other.postalCode_ != null ? other.getPostalCode().Clone() : null);
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string City
public String getCity() {
return city_;
}
public void setCity(String value) {
city_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
public Google.Protobuf.Reflection getDescriptor() {
return getDescriptor();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
// .MessageDescriptor Descriptor
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[1];
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
// .MessageParser<Address> Parser
public static Google.Protobuf.MessageParser<Address> getParser() {
return _parser;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode PostalCode
public PostalCode getPostalCode() {
return postalCode_;
}
public void setPostalCode(PostalCode value) {
postalCode_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string State
public String getState() {
return state_;
}
public void setState(String value) {
state_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Street
public String getStreet() {
return street_;
}
public void setStreet(String value) {
street_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
public int CalculateSize() {
int size = 0;
if (street_ != null) {
size += _single_street_codec.CalculateSizeWithTag(getStreet());
}
if (city_ != null) {
size += _single_city_codec.CalculateSizeWithTag(getCity());
}
if (state_ != null) {
size += _single_state_codec.CalculateSizeWithTag(getState());
}
if (postalCode_ != null) {
size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getPostalCode());
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address Clone()
public Address Clone() {
return new Address(this);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Address other)
public void MergeFrom(Address other) {
if (other == null) {
return;
}
if (other.street_ != null) {
if (street_ == null || !other.getStreet().equals("")) {
setStreet(other.getStreet());
}
}
if (other.city_ != null) {
if (city_ == null || !other.getCity().equals("")) {
setCity(other.getCity());
}
}
if (other.state_ != null) {
if (state_ == null || !other.getState().equals("")) {
setState(other.getState());
}
}
if (other.postalCode_ != null) {
if (postalCode_ == null) {
postalCode_ = new PostalCode();
}
getPostalCode().MergeFrom(other.getPostalCode());
}
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
// .CodedInputStream input)
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: uint tag;
int tag;
while ((tag = input.ReadTag()) != 0) {
switch (tag) {
default:
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
String value = _single_street_codec.Read(input);
if (street_ == null || !value.equals("")) {
setStreet(value);
}
break;
}
case 18: {
String value = _single_city_codec.Read(input);
if (city_ == null || !value.equals("")) {
setCity(value);
}
break;
}
case 26: {
String value = _single_state_codec.Read(input);
if (state_ == null || !value.equals("")) {
setState(value);
}
break;
}
case 34: {
if (postalCode_ == null) {
postalCode_ = new PostalCode();
}
input.ReadMessage(postalCode_);
break;
}
}
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
// .CodedOutputStream output)
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
if (street_ != null) {
_single_street_codec.WriteTagAndValue(output, getStreet());
}
if (city_ != null) {
_single_city_codec.WriteTagAndValue(output, getCity());
}
if (state_ != null) {
_single_state_codec.WriteTagAndValue(output, getState());
}
if (postalCode_ != null) {
output.WriteRawTag(34);
output.WriteMessage(getPostalCode());
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
@Override
public boolean equals(Object other) {
return Equals(other instanceof Address ? (Address)other : null);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Address other)
public boolean equals(Address other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!getStreet().equals(other.getStreet())) {
return false;
}
if (!getCity().equals(other.getCity())) {
return false;
}
if (!getState().equals(other.getState())) {
return false;
}
if (!getPostalCode().equals(other.getPostalCode())) {
return false;
}
return Equals(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
@Override
public int hashCode() {
int hash = 1;
if (street_ != null) {
hash ^= getStreet().hashCode();
}
if (city_ != null) {
hash ^= getCity().hashCode();
}
if (state_ != null) {
hash ^= getState().hashCode();
}
if (postalCode_ != null) {
hash ^= getPostalCode().hashCode();
}
if (_unknownFields != null) {
hash ^= _unknownFields.hashCode();
}
return hash;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
@Override
public String toString() {
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
}
}

View File

@@ -1,320 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TestData/CassandraHotelSchema.proto
// </auto-generated>
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;
public final class Available_Rooms_By_Hotel_Date implements Google.Protobuf.IMessage<Available_Rooms_By_Hotel_Date> {
/**
* Field number for the "date" field.
*/
public static final int DateFieldNumber = 2;
/**
* Field number for the "hotel_id" field.
*/
public static final int HotelIdFieldNumber = 1;
/**
* Field number for the "is_available" field.
*/
public static final int IsAvailableFieldNumber = 4;
/**
* Field number for the "room_number" field.
*/
public static final int RoomNumberFieldNumber = 3;
private static final Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date> _parser =
new Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date>(() -> new Available_Rooms_By_Hotel_Date());
private static final Google.Protobuf.FieldCodec<Long> _single_date_codec =
Google.Protobuf.FieldCodec.<Long>ForStructWrapper(18);
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
// partial void OnConstruction();
private static final Google.Protobuf.FieldCodec<String> _single_hotelId_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
private static final Google.Protobuf.FieldCodec<Boolean> _single_isAvailable_codec =
Google.Protobuf.FieldCodec.<Boolean>ForStructWrapper(34);
private static final Google.Protobuf.FieldCodec<Integer> _single_roomNumber_codec =
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(26);
private Google.Protobuf.UnknownFieldSet _unknownFields;
private Long date_;
private String hotelId_;
private Boolean isAvailable_;
private Integer roomNumber_;
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date()
public Available_Rooms_By_Hotel_Date() {
OnConstruction();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date
// (Available_Rooms_By_Hotel_Date other)
public Available_Rooms_By_Hotel_Date(Available_Rooms_By_Hotel_Date other) {
this();
setHotelId(other.getHotelId());
setDate(other.getDate());
setRoomNumber(other.getRoomNumber());
setIsAvailable(other.getIsAvailable());
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
}
/**
* datetime
*/
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<long> Date
public Long getDate() {
return date_;
}
public void setDate(Long value) {
date_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
public Google.Protobuf.Reflection getDescriptor() {
return getDescriptor();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
// .MessageDescriptor Descriptor
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[3];
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string HotelId
public String getHotelId() {
return hotelId_;
}
public void setHotelId(String value) {
hotelId_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<bool> IsAvailable
public Boolean getIsAvailable() {
return isAvailable_;
}
public void setIsAvailable(Boolean value) {
isAvailable_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
// .MessageParser<Available_Rooms_By_Hotel_Date> Parser
public static Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date> getParser() {
return _parser;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> RoomNumber
public Integer getRoomNumber() {
return roomNumber_;
}
public void setRoomNumber(Integer value) {
roomNumber_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
public int CalculateSize() {
int size = 0;
if (hotelId_ != null) {
size += _single_hotelId_codec.CalculateSizeWithTag(getHotelId());
}
if (date_ != null) {
size += _single_date_codec.CalculateSizeWithTag(getDate());
}
if (roomNumber_ != null) {
size += _single_roomNumber_codec.CalculateSizeWithTag(getRoomNumber());
}
if (isAvailable_ != null) {
size += _single_isAvailable_codec.CalculateSizeWithTag(getIsAvailable());
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date Clone()
public Available_Rooms_By_Hotel_Date Clone() {
return new Available_Rooms_By_Hotel_Date(this);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom
// (Available_Rooms_By_Hotel_Date other)
public void MergeFrom(Available_Rooms_By_Hotel_Date other) {
if (other == null) {
return;
}
if (other.hotelId_ != null) {
if (hotelId_ == null || !other.getHotelId().equals("")) {
setHotelId(other.getHotelId());
}
}
if (other.date_ != null) {
if (date_ == null || other.getDate() != 0L) {
setDate(other.getDate());
}
}
if (other.roomNumber_ != null) {
if (roomNumber_ == null || other.getRoomNumber() != 0) {
setRoomNumber(other.getRoomNumber());
}
}
if (other.isAvailable_ != null) {
if (isAvailable_ == null || other.getIsAvailable() != false) {
setIsAvailable(other.getIsAvailable());
}
}
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
// .CodedInputStream input)
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: uint tag;
int tag;
while ((tag = input.ReadTag()) != 0) {
switch (tag) {
default:
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
String value = _single_hotelId_codec.Read(input);
if (hotelId_ == null || !value.equals("")) {
setHotelId(value);
}
break;
}
case 18: {
Long value = _single_date_codec.Read(input);
if (date_ == null || value != 0L) {
setDate(value);
}
break;
}
case 26: {
Integer value = _single_roomNumber_codec.Read(input);
if (roomNumber_ == null || value != 0) {
setRoomNumber(value);
}
break;
}
case 34: {
Boolean value = _single_isAvailable_codec.Read(input);
if (isAvailable_ == null || value != false) {
setIsAvailable(value);
}
break;
}
}
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
// .CodedOutputStream output)
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
if (hotelId_ != null) {
_single_hotelId_codec.WriteTagAndValue(output, getHotelId());
}
if (date_ != null) {
_single_date_codec.WriteTagAndValue(output, getDate());
}
if (roomNumber_ != null) {
_single_roomNumber_codec.WriteTagAndValue(output, getRoomNumber());
}
if (isAvailable_ != null) {
_single_isAvailable_codec.WriteTagAndValue(output, getIsAvailable());
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
@Override
public boolean equals(Object other) {
return Equals(other instanceof Available_Rooms_By_Hotel_Date ? (Available_Rooms_By_Hotel_Date)other : null);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals
// (Available_Rooms_By_Hotel_Date other)
public boolean equals(Available_Rooms_By_Hotel_Date other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!getHotelId().equals(other.getHotelId())) {
return false;
}
if (getDate() != other.getDate()) {
return false;
}
if (getRoomNumber() != other.getRoomNumber()) {
return false;
}
if (getIsAvailable() != other.getIsAvailable()) {
return false;
}
return Equals(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
@Override
public int hashCode() {
int hash = 1;
if (hotelId_ != null) {
hash ^= getHotelId().hashCode();
}
if (date_ != null) {
hash ^= getDate().hashCode();
}
if (roomNumber_ != null) {
hash ^= getRoomNumber().hashCode();
}
if (isAvailable_ != null) {
hash ^= getIsAvailable().hashCode();
}
if (_unknownFields != null) {
hash ^= _unknownFields.hashCode();
}
return hash;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
@Override
public String toString() {
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
}
}

View File

@@ -1,120 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TestData/CassandraHotelSchema.proto
// </auto-generated>
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;
/**
* Holder for reflection information generated from TestData/CassandraHotelSchema.proto
*/
public final class CassandraHotelSchemaReflection {
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
///#region Descriptor
private static Google.Protobuf.Reflection.FileDescriptor descriptor;
static {
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: byte[] descriptorData = System.Convert.FromBase64String(string.Concat
// ("CiNUZXN0RGF0YS9DYXNzYW5kcmFIb3RlbFNjaGVtYS5wcm90bxJITWljcm9z",
// "b2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0",
// "cy5QZXJmLkNhc3NhbmRyYUhvdGVsGh5nb29nbGUvcHJvdG9idWYvd3JhcHBl",
// "cnMucHJvdG8iYgoKUG9zdGFsQ29kZRIoCgN6aXAYASABKAsyGy5nb29nbGUu",
// "cHJvdG9idWYuSW50MzJWYWx1ZRIqCgVwbHVzNBgCIAEoCzIbLmdvb2dsZS5w",
// "cm90b2J1Zi5JbnQzMlZhbHVlIvsBCgdBZGRyZXNzEiwKBnN0cmVldBgBIAEo",
// "CzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1ZRIqCgRjaXR5GAIgASgL",
// "MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEisKBXN0YXRlGAMgASgL",
// "MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEmkKC3Bvc3RhbF9jb2Rl",
// "GAQgASgLMlQuTWljcm9zb2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9u",
// "Lkh5YnJpZFJvdy5UZXN0cy5QZXJmLkNhc3NhbmRyYUhvdGVsLlBvc3RhbENv",
// "ZGUi9QEKBkhvdGVscxIuCghob3RlbF9pZBgBIAEoCzIcLmdvb2dsZS5wcm90",
// "b2J1Zi5TdHJpbmdWYWx1ZRIqCgRuYW1lGAIgASgLMhwuZ29vZ2xlLnByb3Rv",
// "YnVmLlN0cmluZ1ZhbHVlEisKBXBob25lGAMgASgLMhwuZ29vZ2xlLnByb3Rv",
// "YnVmLlN0cmluZ1ZhbHVlEmIKB2FkZHJlc3MYBCABKAsyUS5NaWNyb3NvZnQu",
// "QXp1cmUuQ29zbW9zLlNlcmlhbGl6YXRpb24uSHlicmlkUm93LlRlc3RzLlBl",
// "cmYuQ2Fzc2FuZHJhSG90ZWwuQWRkcmVzcyLeAQodQXZhaWxhYmxlX1Jvb21z",
// "X0J5X0hvdGVsX0RhdGUSLgoIaG90ZWxfaWQYASABKAsyHC5nb29nbGUucHJv",
// "dG9idWYuU3RyaW5nVmFsdWUSKQoEZGF0ZRgCIAEoCzIbLmdvb2dsZS5wcm90",
// "b2J1Zi5JbnQ2NFZhbHVlEjAKC3Jvb21fbnVtYmVyGAMgASgLMhsuZ29vZ2xl",
// "LnByb3RvYnVmLkludDMyVmFsdWUSMAoMaXNfYXZhaWxhYmxlGAQgASgLMhou",
// "Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSKfBAoGR3Vlc3RzEi4KCGd1ZXN0",
// "X2lkGAEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKCmZp",
// "cnN0X25hbWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUS",
// "LwoJbGFzdF9uYW1lGAMgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
// "bHVlEisKBXRpdGxlGAQgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
// "bHVlEg4KBmVtYWlscxgFIAMoCRIVCg1waG9uZV9udW1iZXJzGAYgAygJEnIK",
// "CWFkZHJlc3NlcxgHIAMoCzJfLk1pY3Jvc29mdC5BenVyZS5Db3Ntb3MuU2Vy",
// "aWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMuUGVyZi5DYXNzYW5kcmFIb3Rl",
// "bC5HdWVzdHMuQWRkcmVzc2VzRW50cnkSNAoOY29uZmlybV9udW1iZXIYCCAB",
// "KAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUagwEKDkFkZHJlc3Nl",
// "c0VudHJ5EgsKA2tleRgBIAEoCRJgCgV2YWx1ZRgCIAEoCzJRLk1pY3Jvc29m",
// "dC5BenVyZS5Db3Ntb3MuU2VyaWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMu",
// "UGVyZi5DYXNzYW5kcmFIb3RlbC5BZGRyZXNzOgI4AUJUqgJRTWljcm9zb2Z0",
// "LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q",
// "ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM="));
byte[] descriptorData = System.Convert.FromBase64String(String.Concat(
"CiNUZXN0RGF0YS9DYXNzYW5kcmFIb3RlbFNjaGVtYS5wcm90bxJITWljcm9z",
"b2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0",
"cy5QZXJmLkNhc3NhbmRyYUhvdGVsGh5nb29nbGUvcHJvdG9idWYvd3JhcHBl",
"cnMucHJvdG8iYgoKUG9zdGFsQ29kZRIoCgN6aXAYASABKAsyGy5nb29nbGUu",
"cHJvdG9idWYuSW50MzJWYWx1ZRIqCgVwbHVzNBgCIAEoCzIbLmdvb2dsZS5w",
"cm90b2J1Zi5JbnQzMlZhbHVlIvsBCgdBZGRyZXNzEiwKBnN0cmVldBgBIAEo",
"CzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1ZRIqCgRjaXR5GAIgASgL",
"MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEisKBXN0YXRlGAMgASgL",
"MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEmkKC3Bvc3RhbF9jb2Rl",
"GAQgASgLMlQuTWljcm9zb2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9u",
"Lkh5YnJpZFJvdy5UZXN0cy5QZXJmLkNhc3NhbmRyYUhvdGVsLlBvc3RhbENv",
"ZGUi9QEKBkhvdGVscxIuCghob3RlbF9pZBgBIAEoCzIcLmdvb2dsZS5wcm90",
"b2J1Zi5TdHJpbmdWYWx1ZRIqCgRuYW1lGAIgASgLMhwuZ29vZ2xlLnByb3Rv",
"YnVmLlN0cmluZ1ZhbHVlEisKBXBob25lGAMgASgLMhwuZ29vZ2xlLnByb3Rv",
"YnVmLlN0cmluZ1ZhbHVlEmIKB2FkZHJlc3MYBCABKAsyUS5NaWNyb3NvZnQu",
"QXp1cmUuQ29zbW9zLlNlcmlhbGl6YXRpb24uSHlicmlkUm93LlRlc3RzLlBl",
"cmYuQ2Fzc2FuZHJhSG90ZWwuQWRkcmVzcyLeAQodQXZhaWxhYmxlX1Jvb21z",
"X0J5X0hvdGVsX0RhdGUSLgoIaG90ZWxfaWQYASABKAsyHC5nb29nbGUucHJv",
"dG9idWYuU3RyaW5nVmFsdWUSKQoEZGF0ZRgCIAEoCzIbLmdvb2dsZS5wcm90",
"b2J1Zi5JbnQ2NFZhbHVlEjAKC3Jvb21fbnVtYmVyGAMgASgLMhsuZ29vZ2xl",
"LnByb3RvYnVmLkludDMyVmFsdWUSMAoMaXNfYXZhaWxhYmxlGAQgASgLMhou",
"Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSKfBAoGR3Vlc3RzEi4KCGd1ZXN0",
"X2lkGAEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKCmZp",
"cnN0X25hbWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUS",
"LwoJbGFzdF9uYW1lGAMgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
"bHVlEisKBXRpdGxlGAQgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
"bHVlEg4KBmVtYWlscxgFIAMoCRIVCg1waG9uZV9udW1iZXJzGAYgAygJEnIK",
"CWFkZHJlc3NlcxgHIAMoCzJfLk1pY3Jvc29mdC5BenVyZS5Db3Ntb3MuU2Vy",
"aWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMuUGVyZi5DYXNzYW5kcmFIb3Rl",
"bC5HdWVzdHMuQWRkcmVzc2VzRW50cnkSNAoOY29uZmlybV9udW1iZXIYCCAB",
"KAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUagwEKDkFkZHJlc3Nl",
"c0VudHJ5EgsKA2tleRgBIAEoCRJgCgV2YWx1ZRgCIAEoCzJRLk1pY3Jvc29m",
"dC5BenVyZS5Db3Ntb3MuU2VyaWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMu",
"UGVyZi5DYXNzYW5kcmFIb3RlbC5BZGRyZXNzOgI4AUJUqgJRTWljcm9zb2Z0",
"LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q",
"ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM="));
descriptor = Google.Protobuf.Reflection.FileDescriptor.FromGeneratedCode(descriptorData,
new Google.Protobuf.Reflection.FileDescriptor[] { Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor }, new Google.Protobuf.Reflection.GeneratedClrTypeInfo(null, new Google.Protobuf.Reflection.GeneratedClrTypeInfo[] { new Google.Protobuf.Reflection.GeneratedClrTypeInfo(PostalCode.class, PostalCode.getParser(), new String[] { "Zip", "Plus4" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Address.class, Address.getParser(), new String[] { "Street", "City", "State", "PostalCode" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Hotels.class, Hotels.getParser(), new String[] { "HotelId", "Name", "Phone", "Address" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Available_Rooms_By_Hotel_Date.class, Available_Rooms_By_Hotel_Date.getParser(), new String[] { "HotelId", "Date", "RoomNumber", "IsAvailable" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Guests.class, Guests.getParser(), new String[] { "GuestId", "FirstName", "LastName", "Title", "Emails", "PhoneNumbers", "Addresses", "ConfirmNumber" }, null, null, new Google.Protobuf.Reflection.GeneratedClrTypeInfo[] { null }) }));
}
/**
* File descriptor for TestData/CassandraHotelSchema.proto
*/
public static Google.Protobuf.Reflection.FileDescriptor getDescriptor() {
return descriptor;
}
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
///#endregion
}

View File

@@ -1,445 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TestData/CassandraHotelSchema.proto
// </auto-generated>
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;
public final class Guests implements Google.Protobuf.IMessage<Guests> {
/**
* Field number for the "addresses" field.
*/
public static final int AddressesFieldNumber = 7;
/**
* Field number for the "confirm_number" field.
*/
public static final int ConfirmNumberFieldNumber = 8;
/**
* Field number for the "emails" field.
*/
public static final int EmailsFieldNumber = 5;
/**
* Field number for the "first_name" field.
*/
public static final int FirstNameFieldNumber = 2;
/**
* Field number for the "guest_id" field.
*/
public static final int GuestIdFieldNumber = 1;
/**
* Field number for the "last_name" field.
*/
public static final int LastNameFieldNumber = 3;
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
// partial void OnConstruction();
/**
* Field number for the "phone_numbers" field.
*/
public static final int PhoneNumbersFieldNumber = 6;
/**
* Field number for the "title" field.
*/
public static final int TitleFieldNumber = 4;
private static final Google.Protobuf.Collections.MapField<String, Address>.Codec _map_addresses_codec =
new Google.Protobuf.Collections.MapField<String, Address>.Codec(Google.Protobuf.FieldCodec.ForString(10),
Google.Protobuf.FieldCodec.ForMessage(18,
Address.getParser()), 58);
private static final Google.Protobuf.MessageParser<Guests> _parser =
new Google.Protobuf.MessageParser<Guests>(() -> new Guests());
private static final Google.Protobuf.FieldCodec<String> _repeated_emails_codec =
Google.Protobuf.FieldCodec.ForString(42);
private static final Google.Protobuf.FieldCodec<String> _repeated_phoneNumbers_codec =
Google.Protobuf.FieldCodec.ForString(50);
private static final Google.Protobuf.FieldCodec<String> _single_confirmNumber_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(66);
private static final Google.Protobuf.FieldCodec<String> _single_firstName_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
private static final Google.Protobuf.FieldCodec<String> _single_guestId_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
private static final Google.Protobuf.FieldCodec<String> _single_lastName_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
private static final Google.Protobuf.FieldCodec<String> _single_title_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(34);
private final Google.Protobuf.Collections.MapField<String, Address> addresses_ =
new Google.Protobuf.Collections.MapField<String, Address>();
private final Google.Protobuf.Collections.RepeatedField<String> emails_ =
new Google.Protobuf.Collections.RepeatedField<String>();
private final Google.Protobuf.Collections.RepeatedField<String> phoneNumbers_ =
new Google.Protobuf.Collections.RepeatedField<String>();
private Google.Protobuf.UnknownFieldSet _unknownFields;
private String confirmNumber_;
private String firstName_;
private String guestId_;
private String lastName_;
private String title_;
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests()
public Guests() {
OnConstruction();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests(Guests other)
public Guests(Guests other) {
this();
setGuestId(other.getGuestId());
setFirstName(other.getFirstName());
setLastName(other.getLastName());
setTitle(other.getTitle());
emails_ = other.emails_.Clone();
phoneNumbers_ = other.phoneNumbers_.Clone();
addresses_ = other.addresses_.Clone();
setConfirmNumber(other.getConfirmNumber());
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
// .MapField<string, azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.Protobuf.Address>
// Addresses
public Google.Protobuf.Collections.MapField<String, Address> getAddresses() {
return addresses_;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string ConfirmNumber
public String getConfirmNumber() {
return confirmNumber_;
}
public void setConfirmNumber(String value) {
confirmNumber_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
// .MessageDescriptor Descriptor
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[4];
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
public Google.Protobuf.Reflection getDescriptor() {
return getDescriptor();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
// .RepeatedField<string> Emails
public Google.Protobuf.Collections.RepeatedField<String> getEmails() {
return emails_;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string FirstName
public String getFirstName() {
return firstName_;
}
public void setFirstName(String value) {
firstName_ = value;
}
/**
* guid
*/
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string GuestId
public String getGuestId() {
return guestId_;
}
public void setGuestId(String value) {
guestId_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string LastName
public String getLastName() {
return lastName_;
}
public void setLastName(String value) {
lastName_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
// .MessageParser<Guests> Parser
public static Google.Protobuf.MessageParser<Guests> getParser() {
return _parser;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
// .RepeatedField<string> PhoneNumbers
public Google.Protobuf.Collections.RepeatedField<String> getPhoneNumbers() {
return phoneNumbers_;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Title
public String getTitle() {
return title_;
}
public void setTitle(String value) {
title_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
public int CalculateSize() {
int size = 0;
if (guestId_ != null) {
size += _single_guestId_codec.CalculateSizeWithTag(getGuestId());
}
if (firstName_ != null) {
size += _single_firstName_codec.CalculateSizeWithTag(getFirstName());
}
if (lastName_ != null) {
size += _single_lastName_codec.CalculateSizeWithTag(getLastName());
}
if (title_ != null) {
size += _single_title_codec.CalculateSizeWithTag(getTitle());
}
size += emails_.CalculateSize(_repeated_emails_codec);
size += phoneNumbers_.CalculateSize(_repeated_phoneNumbers_codec);
size += addresses_.CalculateSize(_map_addresses_codec);
if (confirmNumber_ != null) {
size += _single_confirmNumber_codec.CalculateSizeWithTag(getConfirmNumber());
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests Clone()
public Guests Clone() {
return new Guests(this);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Guests other)
public void MergeFrom(Guests other) {
if (other == null) {
return;
}
if (other.guestId_ != null) {
if (guestId_ == null || !other.getGuestId().equals("")) {
setGuestId(other.getGuestId());
}
}
if (other.firstName_ != null) {
if (firstName_ == null || !other.getFirstName().equals("")) {
setFirstName(other.getFirstName());
}
}
if (other.lastName_ != null) {
if (lastName_ == null || !other.getLastName().equals("")) {
setLastName(other.getLastName());
}
}
if (other.title_ != null) {
if (title_ == null || !other.getTitle().equals("")) {
setTitle(other.getTitle());
}
}
emails_.Add(other.emails_);
phoneNumbers_.Add(other.phoneNumbers_);
addresses_.Add(other.addresses_);
if (other.confirmNumber_ != null) {
if (confirmNumber_ == null || !other.getConfirmNumber().equals("")) {
setConfirmNumber(other.getConfirmNumber());
}
}
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
// .CodedInputStream input)
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: uint tag;
int tag;
while ((tag = input.ReadTag()) != 0) {
switch (tag) {
default:
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
String value = _single_guestId_codec.Read(input);
if (guestId_ == null || !value.equals("")) {
setGuestId(value);
}
break;
}
case 18: {
String value = _single_firstName_codec.Read(input);
if (firstName_ == null || !value.equals("")) {
setFirstName(value);
}
break;
}
case 26: {
String value = _single_lastName_codec.Read(input);
if (lastName_ == null || !value.equals("")) {
setLastName(value);
}
break;
}
case 34: {
String value = _single_title_codec.Read(input);
if (title_ == null || !value.equals("")) {
setTitle(value);
}
break;
}
case 42: {
emails_.AddEntriesFrom(input, _repeated_emails_codec);
break;
}
case 50: {
phoneNumbers_.AddEntriesFrom(input, _repeated_phoneNumbers_codec);
break;
}
case 58: {
addresses_.AddEntriesFrom(input, _map_addresses_codec);
break;
}
case 66: {
String value = _single_confirmNumber_codec.Read(input);
if (confirmNumber_ == null || !value.equals("")) {
setConfirmNumber(value);
}
break;
}
}
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
// .CodedOutputStream output)
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
if (guestId_ != null) {
_single_guestId_codec.WriteTagAndValue(output, getGuestId());
}
if (firstName_ != null) {
_single_firstName_codec.WriteTagAndValue(output, getFirstName());
}
if (lastName_ != null) {
_single_lastName_codec.WriteTagAndValue(output, getLastName());
}
if (title_ != null) {
_single_title_codec.WriteTagAndValue(output, getTitle());
}
emails_.WriteTo(output, _repeated_emails_codec);
phoneNumbers_.WriteTo(output, _repeated_phoneNumbers_codec);
addresses_.WriteTo(output, _map_addresses_codec);
if (confirmNumber_ != null) {
_single_confirmNumber_codec.WriteTagAndValue(output, getConfirmNumber());
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
@Override
public boolean equals(Object other) {
return Equals(other instanceof Guests ? (Guests)other : null);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Guests other)
public boolean equals(Guests other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!getGuestId().equals(other.getGuestId())) {
return false;
}
if (!getFirstName().equals(other.getFirstName())) {
return false;
}
if (!getLastName().equals(other.getLastName())) {
return false;
}
if (!getTitle().equals(other.getTitle())) {
return false;
}
if (!emails_.equals(other.emails_)) {
return false;
}
if (!phoneNumbers_.equals(other.phoneNumbers_)) {
return false;
}
if (!getAddresses().equals(other.getAddresses())) {
return false;
}
if (!getConfirmNumber().equals(other.getConfirmNumber())) {
return false;
}
return Equals(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
@Override
public int hashCode() {
int hash = 1;
if (guestId_ != null) {
hash ^= getGuestId().hashCode();
}
if (firstName_ != null) {
hash ^= getFirstName().hashCode();
}
if (lastName_ != null) {
hash ^= getLastName().hashCode();
}
if (title_ != null) {
hash ^= getTitle().hashCode();
}
hash ^= emails_.hashCode();
hash ^= phoneNumbers_.hashCode();
hash ^= getAddresses().hashCode();
if (confirmNumber_ != null) {
hash ^= getConfirmNumber().hashCode();
}
if (_unknownFields != null) {
hash ^= _unknownFields.hashCode();
}
return hash;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
@Override
public String toString() {
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
}
}

View File

@@ -1,316 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TestData/CassandraHotelSchema.proto
// </auto-generated>
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;
public final class Hotels implements Google.Protobuf.IMessage<Hotels> {
/**
* Field number for the "address" field.
*/
public static final int AddressFieldNumber = 4;
/**
* Field number for the "hotel_id" field.
*/
public static final int HotelIdFieldNumber = 1;
/**
* Field number for the "name" field.
*/
public static final int NameFieldNumber = 2;
/**
* Field number for the "phone" field.
*/
public static final int PhoneFieldNumber = 3;
private static final Google.Protobuf.MessageParser<Hotels> _parser =
new Google.Protobuf.MessageParser<Hotels>(() -> new Hotels());
private static final Google.Protobuf.FieldCodec<String> _single_hotelId_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
// partial void OnConstruction();
private static final Google.Protobuf.FieldCodec<String> _single_name_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
private static final Google.Protobuf.FieldCodec<String> _single_phone_codec =
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
private Google.Protobuf.UnknownFieldSet _unknownFields;
private Address address_;
private String hotelId_;
private String name_;
private String phone_;
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels()
public Hotels() {
OnConstruction();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels(Hotels other)
public Hotels(Hotels other) {
this();
setHotelId(other.getHotelId());
setName(other.getName());
setPhone(other.getPhone());
setAddress(other.address_ != null ? other.getAddress().Clone() : null);
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address Address
public Address getAddress() {
return address_;
}
public void setAddress(Address value) {
address_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
public Google.Protobuf.Reflection getDescriptor() {
return getDescriptor();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
// .MessageDescriptor Descriptor
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[2];
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string HotelId
public String getHotelId() {
return hotelId_;
}
public void setHotelId(String value) {
hotelId_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name
public String getName() {
return name_;
}
public void setName(String value) {
name_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
// .MessageParser<Hotels> Parser
public static Google.Protobuf.MessageParser<Hotels> getParser() {
return _parser;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Phone
public String getPhone() {
return phone_;
}
public void setPhone(String value) {
phone_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
public int CalculateSize() {
int size = 0;
if (hotelId_ != null) {
size += _single_hotelId_codec.CalculateSizeWithTag(getHotelId());
}
if (name_ != null) {
size += _single_name_codec.CalculateSizeWithTag(getName());
}
if (phone_ != null) {
size += _single_phone_codec.CalculateSizeWithTag(getPhone());
}
if (address_ != null) {
size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getAddress());
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels Clone()
public Hotels Clone() {
return new Hotels(this);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Hotels other)
public void MergeFrom(Hotels other) {
if (other == null) {
return;
}
if (other.hotelId_ != null) {
if (hotelId_ == null || !other.getHotelId().equals("")) {
setHotelId(other.getHotelId());
}
}
if (other.name_ != null) {
if (name_ == null || !other.getName().equals("")) {
setName(other.getName());
}
}
if (other.phone_ != null) {
if (phone_ == null || !other.getPhone().equals("")) {
setPhone(other.getPhone());
}
}
if (other.address_ != null) {
if (address_ == null) {
address_ = new Address();
}
getAddress().MergeFrom(other.getAddress());
}
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
// .CodedInputStream input)
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: uint tag;
int tag;
while ((tag = input.ReadTag()) != 0) {
switch (tag) {
default:
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
String value = _single_hotelId_codec.Read(input);
if (hotelId_ == null || !value.equals("")) {
setHotelId(value);
}
break;
}
case 18: {
String value = _single_name_codec.Read(input);
if (name_ == null || !value.equals("")) {
setName(value);
}
break;
}
case 26: {
String value = _single_phone_codec.Read(input);
if (phone_ == null || !value.equals("")) {
setPhone(value);
}
break;
}
case 34: {
if (address_ == null) {
address_ = new Address();
}
input.ReadMessage(address_);
break;
}
}
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
// .CodedOutputStream output)
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
if (hotelId_ != null) {
_single_hotelId_codec.WriteTagAndValue(output, getHotelId());
}
if (name_ != null) {
_single_name_codec.WriteTagAndValue(output, getName());
}
if (phone_ != null) {
_single_phone_codec.WriteTagAndValue(output, getPhone());
}
if (address_ != null) {
output.WriteRawTag(34);
output.WriteMessage(getAddress());
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
@Override
public boolean equals(Object other) {
return Equals(other instanceof Hotels ? (Hotels)other : null);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Hotels other)
public boolean equals(Hotels other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!getHotelId().equals(other.getHotelId())) {
return false;
}
if (!getName().equals(other.getName())) {
return false;
}
if (!getPhone().equals(other.getPhone())) {
return false;
}
if (!getAddress().equals(other.getAddress())) {
return false;
}
return Equals(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
@Override
public int hashCode() {
int hash = 1;
if (hotelId_ != null) {
hash ^= getHotelId().hashCode();
}
if (name_ != null) {
hash ^= getName().hashCode();
}
if (phone_ != null) {
hash ^= getPhone().hashCode();
}
if (address_ != null) {
hash ^= getAddress().hashCode();
}
if (_unknownFields != null) {
hash ^= _unknownFields.hashCode();
}
return hash;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
@Override
public String toString() {
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
}
}

View File

@@ -1,232 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
import com.google.protobuf.Message;
import com.google.protobuf.Parser;
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TestData/CassandraHotelSchema.proto
// </auto-generated>
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pb = Google.Protobuf;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbc = Google.Protobuf.Collections;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using pbr = Google.Protobuf.Reflection;
public final class PostalCode implements Message<PostalCode> {
/**
* Field number for the "plus4" field.
*/
public static final int Plus4FieldNumber = 2;
/**
* Field number for the "zip" field.
*/
public static final int ZipFieldNumber = 1;
private static final Parser<PostalCode> _parser = new Parser<PostalCode>(() -> new PostalCode());
private static final Google.Protobuf.FieldCodec<Integer> _single_plus4_codec =
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(18);
private static final Google.Protobuf.FieldCodec<Integer> _single_zip_codec =
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(10);
private Google.Protobuf.UnknownFieldSet _unknownFields;
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
// partial void OnConstruction();
private Integer plus4_;
private Integer zip_;
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode()
public PostalCode() {
OnConstruction();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode(PostalCode other)
public PostalCode(PostalCode other) {
this();
setZip(other.getZip());
setPlus4(other.getPlus4());
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
// .MessageDescriptor Descriptor
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[0];
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
public Google.Protobuf.Reflection getDescriptor() {
return getDescriptor();
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
// .MessageParser<PostalCode> Parser
public static Google.Protobuf.MessageParser<PostalCode> getParser() {
return _parser;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Plus4
public Integer getPlus4() {
return plus4_;
}
public void setPlus4(Integer value) {
plus4_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Zip
public Integer getZip() {
return zip_;
}
public void setZip(Integer value) {
zip_ = value;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
public int CalculateSize() {
int size = 0;
if (zip_ != null) {
size += _single_zip_codec.CalculateSizeWithTag(getZip());
}
if (plus4_ != null) {
size += _single_plus4_codec.CalculateSizeWithTag(getPlus4());
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode Clone()
public PostalCode Clone() {
return new PostalCode(this);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(PostalCode other)
public void MergeFrom(PostalCode other) {
if (other == null) {
return;
}
if (other.zip_ != null) {
if (zip_ == null || other.getZip() != 0) {
setZip(other.getZip());
}
}
if (other.plus4_ != null) {
if (plus4_ == null || other.getPlus4() != 0) {
setPlus4(other.getPlus4());
}
}
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
// .CodedInputStream input)
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: uint tag;
int tag;
while ((tag = input.ReadTag()) != 0) {
switch (tag) {
default:
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Integer value = _single_zip_codec.Read(input);
if (zip_ == null || value != 0) {
setZip(value);
}
break;
}
case 18: {
Integer value = _single_plus4_codec.Read(input);
if (plus4_ == null || value != 0) {
setPlus4(value);
}
break;
}
}
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
// .CodedOutputStream output)
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
if (zip_ != null) {
_single_zip_codec.WriteTagAndValue(output, getZip());
}
if (plus4_ != null) {
_single_plus4_codec.WriteTagAndValue(output, getPlus4());
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
@Override
public boolean equals(Object other) {
return Equals(other instanceof PostalCode ? (PostalCode)other : null);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(PostalCode other)
public boolean equals(PostalCode other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (getZip() != other.getZip()) {
return false;
}
if (getPlus4() != other.getPlus4()) {
return false;
}
return Equals(_unknownFields, other._unknownFields);
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
@Override
public int hashCode() {
int hash = 1;
if (zip_ != null) {
hash ^= getZip().hashCode();
}
if (plus4_ != null) {
hash ^= getPlus4().hashCode();
}
if (_unknownFields != null) {
hash ^= _unknownFields.hashCode();
}
return hash;
}
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
@Override
public String toString() {
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
}
}

54
schemas/SystemSchema.json Normal file
View File

@@ -0,0 +1,54 @@
// HybridRow RecordIO Schema
{
"name": "Microsoft.Azure.Cosmos.HybridRow.RecordIO",
"version": "v1",
"schemas": [
{
"name": "EmptySchema",
"id": 2147473650,
"type": "schema",
"properties": []
},
{
"name": "Segment",
"id": 2147473648,
"type": "schema",
"properties": [
{
"path": "length",
"type": { "type": "int32", "storage": "fixed" },
"comment":
"(Required) length (in bytes) of this RecordIO segment header itself. Does NOT include the length of the records that follow."
},
{
"path": "comment",
"type": { "type": "utf8", "storage": "sparse" },
"comment": "A comment describing the data in this RecordIO segment."
},
{
// TODO: this should be converted to a HybridRow UDT instead.
"path": "sdl",
"type": { "type": "utf8", "storage": "sparse" },
"comment": "A HybridRow Schema in SDL (json-format)."
}
]
},
{
"name": "Record",
"id": 2147473649,
"type": "schema",
"properties": [
{
"path": "length",
"type": { "type": "int32", "storage": "fixed", "nullable": false },
"comment": "(Required) length (in bytes) of the HybridRow value that follows this record header."
},
{
"path": "crc32",
"type": { "type": "uint32", "storage": "fixed", "nullable": false },
"comment": "(Optional) CRC-32 as described in ISO 3309."
}
]
}
]
}

View File

@@ -0,0 +1,96 @@
{
"name": "Microsoft.Azure.Cosmos.BatchApi",
"version": "v1",
"schemas": [
{
"name": "BatchRequestHeaders",
"id": 1,
"type": "schema",
"properties":
[
{
"path": "sampleRequestHeader",
"type": { "type": "int64", "storage": "fixed" }
}
]
},
{
"name": "BatchOperation",
"id": 2,
"type": "schema",
"properties":
[
{
"path": "operationType",
"type": { "type": "int32", "storage": "fixed" }
}, {
"path": "headers",
"type": { "type": "schema", "name": "BatchRequestHeaders" }
}, {
"path": "resourceType",
"type": { "type": "int32", "storage": "fixed" }
}, {
"path": "resourcePath",
"type": { "type": "utf8", "storage": "variable", "length": 1024 }
}, {
"path": "resourceBody",
"type": { "type": "binary", "storage": "variable" }
}
]
},
{
"name": "BatchRequest",
"id": 3,
"type": "schema",
"properties":
[
{
"path": "operations",
"type": { "type": "array", "items": { "type": "schema", "name": "BatchOperation" } }
}
]
},
{
"name": "BatchResponseHeaders",
"id": 4,
"type": "schema",
"properties":
[
{
"path": "sampleResponseHeader",
"type": { "type": "utf8", "storage": "variable", "length": 1024 }
}
]
},
{
"name": "BatchOperationResponse",
"id": 5,
"type": "schema",
"properties":
[
{
"path": "statusCode",
"type": { "type": "int32", "storage": "fixed" }
}, {
"path": "headers",
"type": { "type": "schema", "name": "BatchResponseHeaders" }
}, {
"path": "resourceBody",
"type": { "type": "binary", "storage": "variable" }
}
]
},
{
"name": "BatchResponse",
"id": 6,
"type": "schema",
"properties":
[
{
"path": "operations",
"type": { "type": "array", "items": { "type": "schema", "name": "BatchOperationResponse" } }
}
]
}
]
}

View File

@@ -0,0 +1,211 @@
{
"schemas": [
{
"name": "myUDT", // Question: what should the namespace/structure of schema identifiers.
"id": 1,
"type": "schema", // Optional: implied at the top-level (only "schema" types can be defined at the root of schemas)
"options": {
"disallowUnschematized": false // Optional: defaults to false
},
"properties": [
{
"path": "a",
"type": {
"type": "int8",
"storage": "fixed"
}
},
{
"path": "b",
"type": {
"type": "utf8",
"storage": "variable"
}
}
]
},
{
"name": "someTable",
"id": -1,
"options": {
"disallowUnschematized": true
},
"properties": [
{
"path": "myBool",
"comment": "A sample fixed boolean column",
"type": {
"type": "bool",
"storage": "fixed"
}
},
{
"path": "myInt8",
"comment": "A sample fixed 8-byte integer column",
"type": {
"type": "int8",
"storage": "fixed"
}
},
{
"path": "nested.x",
"comment": "A sample nested integer column",
"type": {
"type": "int32",
"storage": "fixed"
}
},
{
"path": "nested.y",
"comment": "A sample nested float column",
"type": {
"type": "float32",
"storage": "fixed"
}
},
{
"path": "nested.deeper.z",
"comment": "A sample deeper nested double column",
"type": {
"type": "float64",
"storage": "fixed"
}
},
{
"path": "State",
"comment": "A sample fixed 2-byte UTF-8 encoded text column",
"type": {
"type": "utf8",
"storage": "fixed",
"length": 2
}
},
{
"path": "myString",
"comment": "A sample variable length UTF-8 encoded text column (up to 127 bytes)",
"type": {
"type": "utf8",
"storage": "variable"
}
},
{
"path": "lob",
"comment": "A sample extended UTF-8 encoded text column (up to 2M bytes)",
"type": {
"type": "utf8",
"storage": "sparse"
}
},
{
"path": "canbelob",
"comment":
"A sample extended UTF-8 encoded text column (up to 2M bytes) that stores variable if 'small' (<127 bytes), but sparse if 'large'",
"type": {
"type": "utf8",
"storage": "variable"
}
},
{
"path": "primitiveArray",
"comment": "A sample array of primitives (4-byte ints)",
"type": { "type": "array", "items": { "type": "int32" } }
},
{
"path": "shreddedArray[0]",
"comment": "A sample fixed-length array of primitives",
"type": { "type": "int32" }
},
{
"path": "shreddedArray[1]",
"comment": "A sample fixed-length array of primitives",
"type": { "type": "int32" }
},
{
"path": "nestedArray",
"comment": "A sample array of nested arrays",
"type": {
"type": "array",
"items": {
"type": "array",
"items": { "type": "int32" }
}
}
},
{
"path": "nestedNestedArray",
"comment": "A sample array of nested nested arrays",
"type": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "array",
"items": { "type": "int32" }
}
}
}
},
{
"path": "arrayOfObject",
"comment": "A sample array of semi-structured objects",
"type": {
"type": "array",
"items": {
"type": "object",
"properties": [
{
"path": "a",
"type": { "type": "int8" }
},
{
"path": "b",
"type": { "type": "utf8" }
}
]
}
}
},
{
"path": "arrayOfAny",
"comment": "A sample heterogenous array",
"type": {
"type": "array",
"items": { "type": "any" }
}
},
{
"path": "arrayOfUDT",
"comment": "A sample array of schematized rows",
"type": {
"type": "array",
"items": {
"type": "schema",
"name": "myUDT" // see definition above - should this be called $ref or ref or something?
}
}
},
{
"path": "nestedObject",
"comment": "A sample nested objects",
"type": {
"type": "object",
"properties": [
{
"path": "a",
"type": {
"type": "int8"
}
},
{
"path": "b",
"type": {
"type": "utf8"
}
}
]
}
}
]
}
]
}

View File

@@ -0,0 +1,8 @@
{
"CrossVersionFixed": "8101000000FFFF1FAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAA3E555555555555D53F2A00000000000000000000000000000000001C00CA44C50A55555505CB00B714006E39578A01D6082A00000000000000B9259C2A2E921146BB0A244A9496503C2A0000000000000000000000616263000102",
"CrossVersionNullFixed": "810100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"CrossVersionVariable": "81020000000FADD5AAD5AAD5AAD5AA01AAD5AAD5AAD5AAD5AA010361626303000102",
"CrossVersionNullVariable": "810200000000",
"CrossVersionSparse": "8103000000010103020503AA0604AAAA0705AAAAAAAA0806AAAAAAAAAAAAAAAA0907AA0A08AAAA0B09AAAAAAAA0C0AAAAAAAAAAAAAAAAA0F0BABAAAA3E100C555555555555D53F160D2A000000000000000000000000000000110E00001C00CA44C50A55555505CB00B714120F006E39578A01D60817102A000000000000001311B9259C2A2E921146BB0A244A9496503C18122A000000000000000000000014130361626315140300010222051503000000AAAAAA22220F1602000000030000000000803F0000004000004040030000000000803F00000040000040402214170300000003616263036465660368696A26020D0818ADD5AAD5AAD5AAD5AA01AAAAAAAAAAAAAAAA260201260205051901AAAA26020344040000001A02030100000002000000462E141B03000000036162630365666703787A792E22051C030000000300000001020303000000040506030000000708092E2E071D030000000300000001000000020000000300000003000000040000000500000006000000030000000700000008000000090000002E44040000001E030000000301000000020000004603030000000400000046030500000006000000462A14141F02000000044D61726B044C756B65084861727269736F6E0348616E2A0522052002000000010300000001020302030000000405062A062A0707210200000001000200000001000000020000000300000004000000020002000000050000000600000007000000080000002A1044040000002203000000000000000000004003030000000400000046000000000000084003050000000600000046000000000000F03F03010000000200000046",
"CrossVersionNullSparse": "8103000000"
}

View File

@@ -0,0 +1,127 @@
// Set of types used in the cross versioning tests.
{
"schemas": [
{ "name": "Fixed", "id": 1, "type": "schema",
"properties": [
{ "path": "null", "type": { "type": "null", "storage": "fixed" } },
{ "path": "bool", "type": { "type": "bool", "storage": "fixed" } },
{ "path": "int8", "type": { "type": "int8", "storage": "fixed" } },
{ "path": "int16", "type": { "type": "int16", "storage": "fixed" } },
{ "path": "int32", "type": { "type": "int32", "storage": "fixed" } },
{ "path": "int64", "type": { "type": "int64", "storage": "fixed" } },
{ "path": "uint8", "type": { "type": "uint8", "storage": "fixed" } },
{ "path": "uint16", "type": { "type": "uint16", "storage": "fixed" } },
{ "path": "uint32", "type": { "type": "uint32", "storage": "fixed" } },
{ "path": "uint64", "type": { "type": "uint64", "storage": "fixed" } },
{ "path": "float32", "type": { "type": "float32", "storage": "fixed" } },
{ "path": "float64", "type": { "type": "float64", "storage": "fixed" } },
{ "path": "float128", "type": { "type": "float128", "storage": "fixed" } },
{ "path": "decimal", "type": { "type": "decimal", "storage": "fixed" } },
{ "path": "datetime", "type": { "type": "datetime", "storage": "fixed" } },
{ "path": "unixdatetime", "type": { "type": "unixdatetime", "storage": "fixed" } },
{ "path": "guid", "type": { "type": "guid", "storage": "fixed" } },
{ "path": "mongodbobjectid", "type": { "type": "mongodbobjectid", "storage": "fixed" } },
{ "path": "utf8", "type": { "type": "utf8", "storage": "fixed", "length": 3 } },
{ "path": "binary", "type": { "type": "binary", "storage": "fixed", "length": 3 } }
]},
{ "name": "Variable", "id": 2, "type": "schema",
"properties": [
{ "path": "varint", "type": { "type": "varint", "storage": "variable" } },
{ "path": "varuint", "type": { "type": "varuint", "storage": "variable" } },
{ "path": "utf8", "type": { "type": "utf8", "storage": "variable"} },
{ "path": "binary", "type": { "type": "binary", "storage": "variable" } }
]},
{ "name": "Sparse", "id": 3, "type": "schema",
"properties": [
{ "path": "null", "type": { "type": "null" } },
{ "path": "bool", "type": { "type": "bool" } },
{ "path": "int8", "type": { "type": "int8" } },
{ "path": "int16", "type": { "type": "int16" } },
{ "path": "int32", "type": { "type": "int32" } },
{ "path": "int64", "type": { "type": "int64" } },
{ "path": "uint8", "type": { "type": "uint8" } },
{ "path": "uint16", "type": { "type": "uint16" } },
{ "path": "uint32", "type": { "type": "uint32" } },
{ "path": "uint64", "type": { "type": "uint64" } },
{ "path": "float32", "type": { "type": "float32" } },
{ "path": "float64", "type": { "type": "float64" } },
{ "path": "float128", "type": { "type": "float128" } },
{ "path": "decimal", "type": { "type": "decimal" } },
{ "path": "datetime", "type": { "type": "datetime" } },
{ "path": "unixdatetime", "type": { "type": "unixdatetime" } },
{ "path": "guid", "type": { "type": "guid" } },
{ "path": "mongodbobjectid", "type": { "type": "mongodbobjectid" } },
{ "path": "utf8", "type": { "type": "utf8" } },
{ "path": "binary", "type": { "type": "binary" } },
{ "path": "array_t<int8>", "type": {
"type": "array",
"items": { "type": "int8", "nullable": false }
} },
{ "path": "array_t<array_t<float32>>", "type": {
"type": "array",
"items": { "type": "array", "nullable": false, "items": { "type": "float32", "nullable": false } }
} },
{ "path": "array_t<utf8>", "type": { "type": "array", "items": { "type": "utf8", "nullable": false } } },
{ "path": "tuple<varint,int64>", "type": {
"type": "tuple",
"items": [ { "type": "varint", "nullable": false }, { "type": "int64", "nullable": false }]
} },
{ "path": "tuple<null,tuple<int8,int8>>", "type": {
"type": "tuple", "items": [
{ "type": "null", "nullable": false },
{ "type": "tuple", "nullable": false, "items": [ { "type": "int8", "nullable": false }, { "type": "int8", "nullable": false } ] }
]}},
{ "path": "tuple<bool,udt>", "type": {
"type": "tuple", "items": [
{ "type": "bool", "nullable": false },
{ "type": "schema", "name": "Point", "nullable": false}
]}},
{ "path": "set_t<utf8>", "type": {
"type": "set",
"items": { "type": "utf8", "nullable": false }
} },
{ "path": "set_t<array_t<int8>>", "type": {
"type": "set",
"items": { "type": "array", "nullable": false, "items": { "type": "int8", "nullable": false } }
} },
{ "path": "set_t<set_t<int32>>", "type": {
"type": "set",
"items": { "type": "set", "nullable": false, "items": { "type": "int32", "nullable": false } }
} },
{ "path": "set_t<udt>", "type": {
"type": "set",
"items": { "type": "schema", "name": "Point", "nullable": false}
} },
{ "path": "map_t<utf8,utf8>", "type": {
"type": "map",
"keys": { "type": "utf8", "nullable": false },
"values": { "type": "utf8", "nullable": false }
} },
{ "path": "map_t<int8,array_t<int8>>", "type": {
"type": "map",
"keys": { "type": "int8", "nullable": false },
"values": { "type": "array", "nullable": false, "items": { "type": "int8", "nullable": false } }
} },
{ "path": "map_t<int16,map_t<int32,int32>>", "type": {
"type": "map",
"keys": { "type": "int16", "nullable": false },
"values": {
"type": "map",
"nullable": false,
"keys": { "type": "int32", "nullable": false },
"values": { "type": "int32", "nullable": false }
}
} },
{ "path": "map_t<float64,udt>", "type": {
"type": "map",
"keys": { "type": "float64", "nullable": false },
"values": { "type": "schema", "name": "Point", "nullable": false}
} }
]},
{ "name": "Point", "id": 4, "type": "schema",
"properties": [
{ "path": "x", "type": { "type": "int32", "storage": "fixed" } },
{ "path": "y", "type": { "type": "int32", "storage": "fixed" } }
]}
]
}

View File

@@ -0,0 +1,76 @@
// Partial implementation of Cassandra Hotel Schema described here::
// https://www.oreilly.com/ideas/cassandra-data-modeling
{
"name": "Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.CustomerSchema",
"schemas": [
{
"name": "PostalCode",
"id": 1,
"type": "schema",
"properties": [
{ "path": "zip", "type": { "type": "int32", "storage": "fixed" } },
{ "path": "plus4", "type": { "type": "int16", "storage": "sparse" } }
]
},
{
"name": "Address",
"id": 2,
"type": "schema",
"properties": [
{ "path": "street", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "city", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "state", "type": { "type": "utf8", "storage": "fixed", "length": 2 } },
{ "path": "postal_code", "type": { "type": "schema", "name": "PostalCode" } }
]
},
{
"name": "Hotels",
"id": 3,
"type": "schema",
"partitionkeys": [{ "path": "hotel_id" }],
"properties": [
{ "path": "hotel_id", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "name", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "phone", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "address", "type": { "type": "schema", "name": "Address", "immutable": true } }
]
},
{
"name": "Available_Rooms_By_Hotel_Date",
"id": 4,
"type": "schema",
"partitionkeys": [{ "path": "hotel_id" }],
"primarykeys": [{ "path": "date" }, { "path": "room_number", "direction": "desc" }],
"properties": [
{ "path": "hotel_id", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "date", "type": { "type": "datetime", "storage": "fixed" } },
{ "path": "room_number", "type": { "type": "uint8", "storage": "fixed" } },
{ "path": "is_available", "type": { "type": "bool" } }
]
},
{
"name": "Guests",
"id": 5,
"type": "schema",
"partitionkeys": [{ "path": "guest_id" }],
"primarykeys": [{ "path": "first_name" }, { "path": "phone_numbers", "direction": "desc" }],
"properties": [
{ "path": "guest_id", "type": { "type": "guid", "storage": "fixed" } },
{ "path": "first_name", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "last_name", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "title", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "emails", "type": { "type": "array", "items": { "type": "utf8", "nullable": false } } },
{ "path": "phone_numbers", "type": { "type": "array", "items": { "type": "utf8", "nullable": false } } },
{
"path": "addresses",
"type": {
"type": "map",
"keys": { "type": "utf8", "nullable": false },
"values": { "type": "schema", "name": "Address", "immutable": true, "nullable": false }
}
},
{ "path": "confirm_number", "type": { "type": "utf8", "storage": "variable" } }
]
}
]
}

View File

@@ -0,0 +1,40 @@
// Todo demo schema that utilizes typed maps.
{
"schemas": [
{ "name": "Movie", "id": 1, "type": "schema",
"properties": [
{ "path": "cast", "type": {
"type": "map",
"keys": { "type": "utf8", "nullable": false },
"values": { "type": "utf8", "nullable": false }
} },
{ "path": "stats", "type": {
"type": "map",
"keys": { "type": "guid", "nullable": false },
"values": { "type": "float64", "nullable": false }
} },
{ "path": "related", "type": {
"comment": "map: actor -> { map: moveId -> roleName }",
"type": "map",
"keys": { "type": "utf8", "nullable": false },
"values": {
"type": "map",
"nullable": false,
"keys": { "type": "int64", "nullable": false },
"values": { "type": "utf8", "nullable": false }
}
} },
{ "path": "revenue", "type": {
"comment": "map: releaseDate -> Earnings }",
"type": "map",
"keys": { "type": "datetime", "nullable": false },
"values": { "type": "schema", "name": "Earnings", "nullable": false }
} }
]},
{ "name": "Earnings", "id": 2, "type": "schema",
"properties": [
{ "path": "domestic", "type": { "type": "decimal", "storage": "fixed" } },
{ "path": "worldwide", "type": { "type": "decimal", "storage": "fixed" } }
]}
]
}

View File

@@ -0,0 +1,26 @@
// Demo schema that utilizes nullable typed scopes.
{
"schemas": [
{
"name": "Nullables",
"id": 1,
"type": "schema",
"properties": [
{ "path": "nullbool", "type": { "type": "array", "items": { "type": "bool" } } },
{ "path": "nullset", "type": { "type": "set", "items": { "type": "utf8" } } },
{ "path": "nullarray", "type": { "type": "array", "items": { "type": "float32" } } },
{
"path": "nulltuple",
"type": {
"type": "array",
"items": { "type": "tuple", "nullable": false, "items": [{ "type": "int32" }, { "type": "int64" }] }
}
},
{
"path": "nullmap",
"type": { "type": "map", "keys": { "type": "guid" }, "values": { "type": "uint8" } }
}
]
}
]
}

View File

@@ -0,0 +1,72 @@
// Performance Counter demo schema that utilizes tuples.
{
"schemas": [
{
"name": "Coord",
"id": 2,
"type": "schema",
"properties": [
{ "path": "lat", "type": { "type": "int64", "storage": "fixed" } },
{ "path": "lng", "type": { "type": "int64", "storage": "fixed" } }
]
},
{
"name": "Counters",
"id": 1,
"type": "schema",
"partitionkeys": [{ "path": "name" }],
"properties": [
{ "path": "name", "type": { "type": "utf8", "storage": "variable" } },
{
"path": "value",
"type": {
"type": "tuple",
"immutable": true,
"items": [{ "type": "utf8", "nullable": false }, { "type": "int64", "nullable": false }]
}
},
{
"path": "minmeanmax",
"type": {
"type": "tuple",
"immutable": true,
"items": [
{ "type": "utf8", "nullable": false },
{
"type": "tuple",
"nullable": false,
"items": [
{ "type": "int64", "nullable": false },
{ "type": "int64", "nullable": false },
{ "type": "int64", "nullable": false }
]
}
]
}
},
{
"path": "coord",
"type": {
"type": "tuple",
"immutable": true,
"items": [{ "type": "utf8", "nullable": false }, { "type": "schema", "name": "Coord", "nullable": false }]
}
}
]
},
{
"name": "CounterSet",
"id": 3,
"type": "schema",
"properties": [
{
"path": "history",
"type": {
"type": "array",
"items": { "type": "schema", "name": "Counters", "nullable": false }
}
}
]
}
]
}

143
test-data/ReaderSchema.json Normal file
View File

@@ -0,0 +1,143 @@
// Set of types used in the IO tests.
{
"schemas": [
{ "name": "Mixed", "id": 1, "type": "schema",
"properties": [
{ "path": "null", "type": { "type": "null", "storage": "fixed" } },
{ "path": "bool", "type": { "type": "bool", "storage": "fixed" } },
{ "path": "int8", "type": { "type": "int8", "storage": "fixed" } },
{ "path": "int16", "type": { "type": "int16", "storage": "fixed" } },
{ "path": "int32", "type": { "type": "int32", "storage": "fixed" } },
{ "path": "int64", "type": { "type": "int64", "storage": "fixed" } },
{ "path": "uint8", "type": { "type": "uint8", "storage": "fixed" } },
{ "path": "uint16", "type": { "type": "uint16", "storage": "fixed" } },
{ "path": "uint32", "type": { "type": "uint32", "storage": "fixed" } },
{ "path": "uint64", "type": { "type": "uint64", "storage": "fixed" } },
{ "path": "float32", "type": { "type": "float32", "storage": "fixed" } },
{ "path": "float64", "type": { "type": "float64", "storage": "fixed" } },
{ "path": "float128", "type": { "type": "float128", "storage": "fixed" } },
{ "path": "decimal", "type": { "type": "decimal", "storage": "fixed" } },
{ "path": "datetime", "type": { "type": "datetime", "storage": "fixed" } },
{ "path": "unixdatetime", "type": { "type": "unixdatetime", "storage": "fixed" } },
{ "path": "guid", "type": { "type": "guid", "storage": "fixed" } },
{ "path": "mongodbobjectid", "type": { "type": "mongodbobjectid", "storage": "fixed" } },
{ "path": "utf8", "type": { "type": "utf8", "storage": "fixed", "length": 3 } },
{ "path": "utf8_span", "type": { "type": "utf8", "storage": "fixed", "length": 3 } },
{ "path": "binary", "type": { "type": "binary", "storage": "fixed", "length": 3 } },
{ "path": "binary_span", "type": { "type": "binary", "storage": "fixed", "length": 3 } },
{ "path": "binary_sequence", "type": { "type": "binary", "storage": "fixed", "length": 3 } },
{ "path": "var_varint", "type": { "type": "varint", "storage": "variable" } },
{ "path": "var_varuint", "type": { "type": "varuint", "storage": "variable" } },
{ "path": "var_utf8", "type": { "type": "utf8", "storage": "variable"} },
{ "path": "var_utf8_span", "type": { "type": "utf8", "storage": "variable"} },
{ "path": "var_binary", "type": { "type": "binary", "storage": "variable" } },
{ "path": "var_binary_span", "type": { "type": "binary", "storage": "variable" } },
{ "path": "var_binary_sequence", "type": { "type": "binary", "storage": "variable" } },
{ "path": "sparse_null", "type": { "type": "null" } },
{ "path": "sparse_bool", "type": { "type": "bool" } },
{ "path": "sparse_int8", "type": { "type": "int8" } },
{ "path": "sparse_int16", "type": { "type": "int16" } },
{ "path": "sparse_int32", "type": { "type": "int32" } },
{ "path": "sparse_int64", "type": { "type": "int64" } },
{ "path": "sparse_uint8", "type": { "type": "uint8" } },
{ "path": "sparse_uint16", "type": { "type": "uint16" } },
{ "path": "sparse_uint32", "type": { "type": "uint32" } },
{ "path": "sparse_uint64", "type": { "type": "uint64" } },
{ "path": "sparse_float32", "type": { "type": "float32" } },
{ "path": "sparse_float64", "type": { "type": "float64" } },
{ "path": "sparse_float128", "type": { "type": "float128" } },
{ "path": "sparse_decimal", "type": { "type": "decimal" } },
{ "path": "sparse_datetime", "type": { "type": "datetime" } },
{ "path": "sparse_unixdatetime", "type": { "type": "unixdatetime" } },
{ "path": "sparse_guid", "type": { "type": "guid" } },
{ "path": "sparse_mongodbobjectid", "type": { "type": "mongodbobjectid" } },
{ "path": "sparse_utf8", "type": { "type": "utf8" } },
{ "path": "sparse_utf8_span", "type": { "type": "utf8" } },
{ "path": "sparse_binary", "type": { "type": "binary" } },
{ "path": "sparse_binary_span", "type": { "type": "binary" } },
{ "path": "sparse_binary_sequence", "type": { "type": "binary" } },
{ "path": "array_t<int8>", "type": {
"type": "array",
"items": { "type": "int8", "nullable": false }
} },
{ "path": "array_t<array_t<float32>>", "type": {
"type": "array",
"items": { "type": "array", "nullable": false, "items": { "type": "float32", "nullable": false } }
} },
{ "path": "array_t<utf8>", "type": { "type": "array", "items": { "type": "utf8", "nullable": false } } },
{ "path": "tuple<varint,int64>", "type": {
"type": "tuple",
"items": [ { "type": "varint", "nullable": false }, { "type": "int64", "nullable": false }]
} },
{ "path": "tuple<null,tuple<int8,int8>>", "type": {
"type": "tuple", "items": [
{ "type": "null", "nullable": false },
{ "type": "tuple", "nullable": false, "items": [ { "type": "int8", "nullable": false }, { "type": "int8", "nullable": false } ] }
]}},
{ "path": "tuple<bool,udt>", "type": {
"type": "tuple", "items": [
{ "type": "bool", "nullable": false },
{ "type": "schema", "name": "Point", "nullable": false}
]}},
{ "path": "nullable<int32,int64>", "type": {
"type": "tuple",
"items": [ { "type": "int32", "nullable": true }, { "type": "int64", "nullable": true }]
} },
{ "path": "tagged<utf8>", "type": {
"type": "tagged", "items": [
{ "type": "utf8", "nullable": false }
]}},
{ "path": "tagged<bool,utf8>", "type": {
"type": "tagged", "items": [
{ "type": "bool", "nullable": false },
{ "type": "utf8", "nullable": false }
]}},
{ "path": "set_t<utf8>", "type": {
"type": "set",
"items": { "type": "utf8", "nullable": false }
} },
{ "path": "set_t<array_t<int8>>", "type": {
"type": "set",
"items": { "type": "array", "nullable": false, "items": { "type": "int8", "nullable": false } }
} },
{ "path": "set_t<set_t<int32>>", "type": {
"type": "set",
"items": { "type": "set", "nullable": false, "items": { "type": "int32", "nullable": false } }
} },
{ "path": "set_t<udt>", "type": {
"type": "set",
"items": { "type": "schema", "name": "Point", "nullable": false}
} },
{ "path": "map_t<utf8,utf8>", "type": {
"type": "map",
"keys": { "type": "utf8", "nullable": false },
"values": { "type": "utf8", "nullable": false }
} },
{ "path": "map_t<int8,array_t<int8>>", "type": {
"type": "map",
"keys": { "type": "int8", "nullable": false },
"values": { "type": "array", "nullable": false, "items": { "type": "int8", "nullable": false } }
} },
{ "path": "map_t<int16,map_t<int32,int32>>", "type": {
"type": "map",
"keys": { "type": "int16", "nullable": false },
"values": {
"type": "map",
"nullable": false,
"keys": { "type": "int32", "nullable": false },
"values": { "type": "int32", "nullable": false }
}
} },
{ "path": "map_t<float64,udt>", "type": {
"type": "map",
"keys": { "type": "float64", "nullable": false },
"values": { "type": "schema", "name": "Point", "nullable": false}
} }
]},
{ "name": "Point", "id": 4, "type": "schema",
"properties": [
{ "path": "x", "type": { "type": "int32", "storage": "fixed" } },
{ "path": "y", "type": { "type": "int32", "storage": "fixed" } }
]}
]
}

View File

@@ -0,0 +1,171 @@
{
"name": "Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.SchemaHashTest",
"schemas": [
{
"version": "v1",
"comment": "Some UDT definition",
"name": "UDT",
"id": 1,
"type": "schema",
"properties": [
{
"path": "item1",
"type": {
"length": 0,
"storage": "fixed",
"type": "int32",
"nullable": false
}
},
{
"path": "item2",
"type": {
"length": 10,
"storage": "variable",
"type": "utf8"
}
}
],
"partitionkeys": [],
"primarykeys": []
},
{
"version": "v1",
"comment": "Some table definition",
"name": "Table",
"id": 2,
"options": {
"disallowUnschematized": true,
"enablePropertyLevelTimestamp": true
},
"type": "schema",
"properties": [
{
"path": "fixed",
"type": {
"length": 0,
"storage": "fixed",
"apitype": "myfixed",
"type": "int32"
}
},
{
"path": "array",
"type": {
"items": {
"length": 0,
"storage": "sparse",
"type": "int8"
},
"immutable": true,
"type": "array"
}
},
{
"path": "obj",
"type": {
"properties": [
{
"path": "nested",
"type": {
"length": 0,
"storage": "sparse",
"type": "int32"
}
}
],
"immutable": false,
"type": "object"
}
},
{
"path": "map",
"type": {
"keys": {
"length": 0,
"storage": "sparse",
"type": "int8"
},
"values": {
"length": 0,
"storage": "sparse",
"type": "int8"
},
"immutable": false,
"type": "map"
}
},
{
"path": "set",
"type": {
"items": {
"length": 0,
"storage": "sparse",
"type": "int8"
},
"immutable": false,
"type": "set"
}
},
{
"path": "tagged",
"type": {
"items": [
{
"length": 0,
"storage": "sparse",
"type": "int32"
}
],
"immutable": false,
"type": "tagged"
}
},
{
"path": "tuple",
"type": {
"items": [
{
"length": 0,
"storage": "sparse",
"type": "int32"
},
{
"length": 0,
"storage": "sparse",
"type": "float32"
}
],
"immutable": false,
"type": "tuple"
}
},
{
"path": "udt",
"type": {
"name": "UDT",
"id": 1,
"immutable": false,
"type": "schema"
}
}
],
"partitionkeys": [
{
"path": "fixed"
}
],
"primarykeys": [
{
"path": "fixed",
"direction": "asc"
}
],
"statickeys": [
{
"path": "fixed"
}
]
}
]
}

28
test-data/TagSchema.json Normal file
View File

@@ -0,0 +1,28 @@
// Tag demo schema that utilizes typed arrays.
{
"schemas": [
{ "name": "Tagged", "id": 1, "type": "schema",
"properties": [
{ "path": "title", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "tags", "type": { "type": "array",
"items": { "type": "utf8", "nullable": false } } },
{ "path": "options", "type": { "type": "array",
"items": { "type": "int32", "nullable": true } } },
{ "path": "ratings", "type": { "type": "array",
"items": { "type": "array", "nullable": false, "items": { "type": "float64", "nullable": false } } } },
{ "path": "similars", "type": { "type": "array",
"items": { "type": "schema", "name": "SimilarMatch", "nullable": false } } },
{ "path": "priority", "type": { "type": "array",
"items": { "type": "tuple", "nullable": false,
"items": [
{ "type": "utf8", "nullable": false },
{ "type": "int64", "nullable": false }
]}}}
]},
{ "name": "SimilarMatch", "id": 2, "type": "schema",
"properties": [
{ "path": "thumbprint", "type": { "type": "utf8", "storage": "fixed", "length": 18 } },
{ "path": "score", "type": { "type": "float64", "storage": "fixed" } }
]}
]
}

View File

@@ -0,0 +1,28 @@
// Tagged demo schema that utilizes tagged types.
{
"schemas": [
{
"name": "TaggedApi",
"id": 1,
"type": "schema",
"properties": [
{
"path": "tag1",
"type": {
"type": "tagged",
"immutable": true,
"items": [{ "type": "utf8", "nullable": false }]
}
},
{
"path": "tag2",
"type": {
"type": "tagged",
"immutable": false,
"items": [{ "type": "int32", "nullable": false }, { "type": "int64", "nullable": false }]
}
}
]
}
]
}

75
test-data/TodoSchema.json Normal file
View File

@@ -0,0 +1,75 @@
// Todo demo schema that utilizes typed sets.
{
"schemas": [
{
"name": "Todo",
"id": 1,
"type": "schema",
"properties": [
{ "path": "attendees", "type": { "type": "set", "items": { "type": "utf8", "nullable": false } } },
{ "path": "projects", "type": { "type": "set", "items": { "type": "guid", "nullable": false } } },
{ "path": "checkboxes", "type": { "type": "set", "items": { "type": "bool", "nullable": false } } },
{
"path": "prices",
"type": {
"type": "set",
"items": {
"type": "set",
"immutable": true,
"nullable": false,
"items": { "type": "float32", "nullable": false }
}
}
},
{
"path": "nested",
"type": {
"type": "set",
"items": {
"type": "set",
"immutable": true,
"nullable": false,
"items":
{
"type": "set",
"immutable": true,
"nullable": false,
"items": {
"type": "int32",
"nullable": false
}
}
}
}
},
{
"path": "shopping",
"type": { "type": "set", "items": { "type": "schema", "name": "ShoppingItem", "nullable": false } }
},
{
"path": "work",
"type": {
"type": "set",
"items": {
"type": "tuple",
"nullable": false,
"items": [
{ "type": "bool", "nullable": false },
{ "type": "varuint", "nullable": false }
]
}
}
}
]
},
{
"name": "ShoppingItem",
"id": 2,
"type": "schema",
"properties": [
{ "path": "label", "type": { "type": "utf8", "storage": "variable" } },
{ "path": "count", "type": { "type": "uint8", "storage": "fixed" } }
]
}
]
}