@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < value_.size(); i++) { output.writeMessage(1, value_.get(i)); } for (int i = 0; i < arrayValue_.size(); i++) { output.writeMessage(2, arrayValue_.get(i)); } if (hasArrayValue_ != false) { output.writeBool(3, hasArrayValue_); } if (scalarValue_ != null) { output.writeMessage(4, getScalarValue()); } unknownFields.writeTo(output); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < value_.size(); i++) { output.writeMessage(1, value_.get(i)); } for (int i = 0; i < arrayValue_.size(); i++) { output.writeMessage(2, arrayValue_.get(i)); } if (hasArrayValue_ != false) { output.writeBool(3, hasArrayValue_); } if (scalarValue_ != null) { output.writeMessage(4, getScalarValue()); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < value_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, value_.get(i)); } for (int i = 0; i < arrayValue_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, arrayValue_.get(i)); } if (hasArrayValue_ != false) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(3, hasArrayValue_); } if (scalarValue_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, getScalarValue()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
.findFieldByNumber(ColumnValue.SCALAR_VALUE_FIELD_NUMBER))); Common.TypedValue value = column.getScalarValue(); assertEquals(Common.Rep.BOOLEAN, value.getType()); assertEquals(true, value.getBoolValue()); column.hasField(ColumnValue.getDescriptor() .findFieldByNumber(ColumnValue.SCALAR_VALUE_FIELD_NUMBER))); value = column.getScalarValue(); assertEquals(Common.Rep.STRING, value.getType()); assertEquals("my_string", value.getStringValue());
ColumnValue.SCALAR_VALUE_FIELD_NUMBER)); Common.TypedValue value = column.getScalarValue(); assertEquals(Common.Rep.BOOLEAN, value.getType()); assertEquals(true, value.getBoolValue()); ProtobufService.hasField(column, column.getDescriptorForType(), ColumnValue.SCALAR_VALUE_FIELD_NUMBER)); value = column.getScalarValue(); assertEquals(Common.Rep.STRING, value.getType()); assertEquals("my_string", value.getStringValue());
/** * Parses the value for a ColumnValue using the separated array and scalar attributes. * * @param column The protobuf ColumnValue object * @return The parse value for this column */ static Object parseColumn(Common.ColumnValue column) { // Verify that we have one or the other (scalar or array) validateColumnValue(column); if (!column.hasField(SCALAR_VALUE_DESCRIPTOR)) { // The column in this row is an Array (has multiple values) List<Object> array = new ArrayList<>(column.getArrayValueCount()); for (Common.TypedValue arrayValue : column.getArrayValueList()) { // Duplicative because of the ColumnValue/TypedValue difference. if (Common.Rep.ARRAY == arrayValue.getType()) { // Each element in this Array is an Array. array.add(parseArray(arrayValue)); } else { // The array element is a scalar. array.add(deserializeScalarValue(arrayValue)); } } return array; } else { // Scalar return deserializeScalarValue(column.getScalarValue()); } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getValueCount() > 0) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValueList().hashCode(); } if (getArrayValueCount() > 0) { hash = (37 * hash) + ARRAY_VALUE_FIELD_NUMBER; hash = (53 * hash) + getArrayValueList().hashCode(); } hash = (37 * hash) + HAS_ARRAY_VALUE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getHasArrayValue()); if (hasScalarValue()) { hash = (37 * hash) + SCALAR_VALUE_FIELD_NUMBER; hash = (53 * hash) + getScalarValue().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * Parses the value for a ColumnValue using the separated array and scalar attributes. * * @param column The protobuf ColumnValue object * @return The parse value for this column */ static Object parseColumn(Common.ColumnValue column) { // Verify that we have one or the other (scalar or array) validateColumnValue(column); if (!column.hasField(SCALAR_VALUE_DESCRIPTOR)) { // The column in this row is an Array (has multiple values) List<Object> array = new ArrayList<>(column.getArrayValueCount()); for (Common.TypedValue arrayValue : column.getArrayValueList()) { // Duplicative because of the ColumnValue/TypedValue difference. if (Common.Rep.ARRAY == arrayValue.getType()) { // Each element in this Array is an Array. array.add(parseArray(arrayValue)); } else { // The array element is a scalar. array.add(deserializeScalarValue(arrayValue)); } } return array; } else { // Scalar return deserializeScalarValue(column.getScalarValue()); } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getValueCount() > 0) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValueList().hashCode(); } if (getArrayValueCount() > 0) { hash = (37 * hash) + ARRAY_VALUE_FIELD_NUMBER; hash = (53 * hash) + getArrayValueList().hashCode(); } hash = (37 * hash) + HAS_ARRAY_VALUE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getHasArrayValue()); if (hasScalarValue()) { hash = (37 * hash) + SCALAR_VALUE_FIELD_NUMBER; hash = (53 * hash) + getScalarValue().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.calcite.avatica.proto.Common.ColumnValue)) { return super.equals(obj); } org.apache.calcite.avatica.proto.Common.ColumnValue other = (org.apache.calcite.avatica.proto.Common.ColumnValue) obj; boolean result = true; result = result && getValueList() .equals(other.getValueList()); result = result && getArrayValueList() .equals(other.getArrayValueList()); result = result && (getHasArrayValue() == other.getHasArrayValue()); result = result && (hasScalarValue() == other.hasScalarValue()); if (hasScalarValue()) { result = result && getScalarValue() .equals(other.getScalarValue()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < value_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, value_.get(i)); } for (int i = 0; i < arrayValue_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, arrayValue_.get(i)); } if (hasArrayValue_ != false) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(3, hasArrayValue_); } if (scalarValue_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, getScalarValue()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.calcite.avatica.proto.Common.ColumnValue)) { return super.equals(obj); } org.apache.calcite.avatica.proto.Common.ColumnValue other = (org.apache.calcite.avatica.proto.Common.ColumnValue) obj; boolean result = true; result = result && getValueList() .equals(other.getValueList()); result = result && getArrayValueList() .equals(other.getArrayValueList()); result = result && (getHasArrayValue() == other.getHasArrayValue()); result = result && (hasScalarValue() == other.hasScalarValue()); if (hasScalarValue()) { result = result && getScalarValue() .equals(other.getScalarValue()); } result = result && unknownFields.equals(other.unknownFields); return result; }
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < value_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, value_.get(i)); } for (int i = 0; i < arrayValue_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, arrayValue_.get(i)); } if (hasArrayValue_ != false) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(3, hasArrayValue_); } if (scalarValue_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, getScalarValue()); } memoizedSize = size; return size; }
/** * Parses the value for a ColumnValue using the separated array and scalar attributes. * * @param column The protobuf ColumnValue object * @return The parse value for this column */ static Object parseColumn(Common.ColumnValue column) { // Verify that we have one or the other (scalar or array) validateColumnValue(column); if (!ProtobufService.hasField(column, column.getDescriptorForType(), Common.ColumnValue.SCALAR_VALUE_FIELD_NUMBER)) { // Array List<Object> array = new ArrayList<>(column.getArrayValueCount()); for (Common.TypedValue arrayValue : column.getArrayValueList()) { array.add(getScalarValue(arrayValue)); } return array; } else { // Scalar return getScalarValue(column.getScalarValue()); } }
@Test public void testDeprecatedValueAttributeForScalars() { // Create a row with schema: [VARCHAR, INTEGER, DATE] List<Object> rows = Collections.<Object>singletonList(new Object[] {"string", Integer.MAX_VALUE, new Date().getTime()}); Meta.Frame frame = Meta.Frame.create(0, true, rows); // Convert it to a protobuf Common.Frame protoFrame = frame.toProto(); assertEquals(1, protoFrame.getRowsCount()); // Get that row we created Common.Row protoRow = protoFrame.getRows(0); // One row has many columns List<Common.ColumnValue> protoColumns = protoRow.getValueList(); assertEquals(3, protoColumns.size()); // Verify that the scalar value is also present in the deprecated values attributes. List<Common.TypedValue> deprecatedValues = protoColumns.get(0).getValueList(); assertEquals(1, deprecatedValues.size()); Common.TypedValue scalarValue = protoColumns.get(0).getScalarValue(); assertEquals(deprecatedValues.get(0), scalarValue); }
@Test public void testDeprecatedValueAttributeForScalars() { // Create a row with schema: [VARCHAR, INTEGER, DATE] List<Object> rows = Collections.<Object>singletonList(new Object[] {"string", Integer.MAX_VALUE, new Date().getTime()}); Meta.Frame frame = Meta.Frame.create(0, true, rows); // Convert it to a protobuf Common.Frame protoFrame = frame.toProto(); assertEquals(1, protoFrame.getRowsCount()); // Get that row we created Common.Row protoRow = protoFrame.getRows(0); // One row has many columns List<Common.ColumnValue> protoColumns = protoRow.getValueList(); assertEquals(3, protoColumns.size()); // Verify that the scalar value is also present in the deprecated values attributes. List<Common.TypedValue> deprecatedValues = protoColumns.get(0).getValueList(); assertEquals(1, deprecatedValues.size()); Common.TypedValue scalarValue = protoColumns.get(0).getScalarValue(); assertEquals(deprecatedValues.get(0), scalarValue); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < value_.size(); i++) { output.writeMessage(1, value_.get(i)); } for (int i = 0; i < arrayValue_.size(); i++) { output.writeMessage(2, arrayValue_.get(i)); } if (hasArrayValue_ != false) { output.writeBool(3, hasArrayValue_); } if (scalarValue_ != null) { output.writeMessage(4, getScalarValue()); } }
/** * <code>.TypedValue scalar_value = 4;</code> */ public org.apache.calcite.avatica.proto.Common.TypedValueOrBuilder getScalarValueOrBuilder() { return getScalarValue(); }
/** * <code>optional .TypedValue scalar_value = 4;</code> */ public org.apache.calcite.avatica.proto.Common.TypedValueOrBuilder getScalarValueOrBuilder() { return getScalarValue(); }
/** * <code>.TypedValue scalar_value = 4;</code> */ public org.apache.calcite.avatica.proto.Common.TypedValueOrBuilder getScalarValueOrBuilder() { return getScalarValue(); }