@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest)) { return super.equals(obj); } org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest other = (org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest) obj; boolean result = true; result = result && getConnectionId() .equals(other.getConnectionId()); result = result && getSql() .equals(other.getSql()); result = result && (getMaxRowCount() == other.getMaxRowCount()); result = result && (getStatementId() == other.getStatementId()); result = result && (getMaxRowsTotal() == other.getMaxRowsTotal()); result = result && (getFirstFrameMaxSize() == other.getFirstFrameMaxSize()); result = result && unknownFields.equals(other.unknownFields); return result; }
if (!getConnectionIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, connectionId_); if (!getSqlBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sql_);
public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest other) { if (other == org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest.getDefaultInstance()) return this; if (!other.getConnectionId().isEmpty()) { connectionId_ = other.connectionId_; onChanged(); } if (!other.getSql().isEmpty()) { sql_ = other.sql_; onChanged(); } if (other.getMaxRowCount() != 0L) { setMaxRowCount(other.getMaxRowCount()); } if (other.getStatementId() != 0) { setStatementId(other.getStatementId()); } onChanged(); return this; }
Requests.PrepareAndExecuteRequest protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowsTotal(maxRowCount). setFirstFrameMaxSize(maxRowsInFirstFrame).build(); protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(maxRowCount).build(); protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L) .setMaxRowsTotal(maxRowCount).build(); protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L) .setMaxRowsTotal(maxRowCount).setFirstFrameMaxSize(maxRowsInFirstFrame).build();
Requests.PrepareAndExecuteRequest protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowsTotal(maxRowCount). setFirstFrameMaxSize(maxRowsInFirstFrame).build(); protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(maxRowCount).build(); protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L) .setMaxRowsTotal(maxRowCount).build(); protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder(). setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L) .setMaxRowsTotal(maxRowCount).setFirstFrameMaxSize(maxRowsInFirstFrame).build();
if (!getConnectionIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, connectionId_); if (!getSqlBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sql_);
@Test public void testPrepareAndExecuteSerialization() throws Exception { final String sql = "SELECT * FROM FOO"; final int statementId = 12345; final String connectionId = UUID.randomUUID().toString(); for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) { Service.PrepareAndExecuteRequest prepareAndExecuteReq = new Service.PrepareAndExecuteRequest(connectionId, statementId, sql, maxRowCount); Requests.PrepareAndExecuteRequest prepareAndExecuteProtoReq = prepareAndExecuteReq.serialize(); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowCount()); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowsTotal()); assertEquals(AvaticaUtils.toSaturatedInt(maxRowCount), prepareAndExecuteProtoReq.getFirstFrameMaxSize()); assertEquals(prepareAndExecuteReq, prepareAndExecuteReq.deserialize(prepareAndExecuteProtoReq)); } int maxRowsInFirstFrame = 50; for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) { Service.PrepareAndExecuteRequest prepareAndExecuteReq = new Service.PrepareAndExecuteRequest(connectionId, statementId, sql, maxRowCount, maxRowsInFirstFrame); Requests.PrepareAndExecuteRequest prepareAndExecuteProtoReq = prepareAndExecuteReq.serialize(); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowCount()); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowsTotal()); assertEquals(maxRowsInFirstFrame, prepareAndExecuteProtoReq.getFirstFrameMaxSize()); assertEquals(prepareAndExecuteReq, prepareAndExecuteReq.deserialize(prepareAndExecuteProtoReq)); } }
public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest other) { if (other == org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest.getDefaultInstance()) return this; if (!other.getConnectionId().isEmpty()) { connectionId_ = other.connectionId_; onChanged(); } if (!other.getSql().isEmpty()) { sql_ = other.sql_; onChanged(); } if (other.getMaxRowCount() != 0L) { setMaxRowCount(other.getMaxRowCount()); } if (other.getStatementId() != 0) { setStatementId(other.getStatementId()); } if (other.getMaxRowsTotal() != 0L) { setMaxRowsTotal(other.getMaxRowsTotal()); } if (other.getFirstFrameMaxSize() != 0) { setFirstFrameMaxSize(other.getFirstFrameMaxSize()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Override PrepareAndExecuteRequest deserialize(Message genericMsg) { final Requests.PrepareAndExecuteRequest msg = ProtobufService.castProtobufMessage(genericMsg, Requests.PrepareAndExecuteRequest.class); String connectionId = null; if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) { connectionId = msg.getConnectionId(); } String sql = null; if (msg.hasField(SQL_DESCRIPTOR)) { sql = msg.getSql(); } // Use the old attribute, unless the new is set long maxRowsTotal = msg.getMaxRowCount(); if (msg.hasField(MAX_ROWS_TOTAL_DESCRIPTOR)) { maxRowsTotal = msg.getMaxRowsTotal(); } // Use maxRowCount (cast to an integer) if firstFrameMaxSize isn't set int maxRowsInFirstFrame = (int) maxRowsTotal; if (msg.hasField(FIRST_FRAME_MAX_SIZE_DESCRIPTOR)) { maxRowsInFirstFrame = msg.getFirstFrameMaxSize(); } return new PrepareAndExecuteRequest(connectionId, msg.getStatementId(), sql, maxRowsTotal, maxRowsInFirstFrame); }
@Test public void testPrepareAndExecuteSerialization() throws Exception { final String sql = "SELECT * FROM FOO"; final int statementId = 12345; final String connectionId = UUID.randomUUID().toString(); for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) { Service.PrepareAndExecuteRequest prepareAndExecuteReq = new Service.PrepareAndExecuteRequest(connectionId, statementId, sql, maxRowCount); Requests.PrepareAndExecuteRequest prepareAndExecuteProtoReq = prepareAndExecuteReq.serialize(); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowCount()); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowsTotal()); assertEquals(AvaticaUtils.toSaturatedInt(maxRowCount), prepareAndExecuteProtoReq.getFirstFrameMaxSize()); assertEquals(prepareAndExecuteReq, prepareAndExecuteReq.deserialize(prepareAndExecuteProtoReq)); } int maxRowsInFirstFrame = 50; for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) { Service.PrepareAndExecuteRequest prepareAndExecuteReq = new Service.PrepareAndExecuteRequest(connectionId, statementId, sql, maxRowCount, maxRowsInFirstFrame); Requests.PrepareAndExecuteRequest prepareAndExecuteProtoReq = prepareAndExecuteReq.serialize(); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowCount()); assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowsTotal()); assertEquals(maxRowsInFirstFrame, prepareAndExecuteProtoReq.getFirstFrameMaxSize()); assertEquals(prepareAndExecuteReq, prepareAndExecuteReq.deserialize(prepareAndExecuteProtoReq)); } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER; hash = (53 * hash) + getConnectionId().hashCode(); hash = (37 * hash) + SQL_FIELD_NUMBER; hash = (53 * hash) + getSql().hashCode(); hash = (37 * hash) + MAX_ROW_COUNT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getMaxRowCount()); hash = (37 * hash) + STATEMENT_ID_FIELD_NUMBER; hash = (53 * hash) + getStatementId(); hash = (37 * hash) + MAX_ROWS_TOTAL_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getMaxRowsTotal()); hash = (37 * hash) + FIRST_FRAME_MAX_SIZE_FIELD_NUMBER; hash = (53 * hash) + getFirstFrameMaxSize(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getConnectionIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, connectionId_); } if (!getSqlBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sql_); } if (maxRowCount_ != 0L) { output.writeUInt64(3, maxRowCount_); } if (statementId_ != 0) { output.writeUInt32(4, statementId_); } if (maxRowsTotal_ != 0L) { output.writeInt64(5, maxRowsTotal_); } if (firstFrameMaxSize_ != 0) { output.writeInt32(6, firstFrameMaxSize_); } unknownFields.writeTo(output); }
public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest other) { if (other == org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest.getDefaultInstance()) return this; if (!other.getConnectionId().isEmpty()) { connectionId_ = other.connectionId_; onChanged(); } if (!other.getSql().isEmpty()) { sql_ = other.sql_; onChanged(); } if (other.getMaxRowCount() != 0L) { setMaxRowCount(other.getMaxRowCount()); } if (other.getStatementId() != 0) { setStatementId(other.getStatementId()); } if (other.getMaxRowsTotal() != 0L) { setMaxRowsTotal(other.getMaxRowsTotal()); } if (other.getFirstFrameMaxSize() != 0) { setFirstFrameMaxSize(other.getFirstFrameMaxSize()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER; hash = (53 * hash) + getConnectionId().hashCode(); hash = (37 * hash) + SQL_FIELD_NUMBER; hash = (53 * hash) + getSql().hashCode(); hash = (37 * hash) + MAX_ROW_COUNT_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getMaxRowCount()); hash = (37 * hash) + STATEMENT_ID_FIELD_NUMBER; hash = (53 * hash) + getStatementId(); hash = (37 * hash) + MAX_ROWS_TOTAL_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getMaxRowsTotal()); hash = (37 * hash) + FIRST_FRAME_MAX_SIZE_FIELD_NUMBER; hash = (53 * hash) + getFirstFrameMaxSize(); 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.Requests.PrepareAndExecuteRequest)) { return super.equals(obj); } org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest other = (org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest) obj; boolean result = true; result = result && getConnectionId() .equals(other.getConnectionId()); result = result && getSql() .equals(other.getSql()); result = result && (getMaxRowCount() == other.getMaxRowCount()); result = result && (getStatementId() == other.getStatementId()); result = result && (getMaxRowsTotal() == other.getMaxRowsTotal()); result = result && (getFirstFrameMaxSize() == other.getFirstFrameMaxSize()); result = result && unknownFields.equals(other.unknownFields); return result; }
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getConnectionIdBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessage.computeStringSize(1, connectionId_); } if (!getSqlBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessage.computeStringSize(2, sql_); } if (maxRowCount_ != 0L) { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(3, maxRowCount_); } if (statementId_ != 0) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(4, statementId_); } memoizedSize = size; return size; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getConnectionIdBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, connectionId_); } if (!getSqlBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sql_); } if (maxRowCount_ != 0L) { output.writeUInt64(3, maxRowCount_); } if (statementId_ != 0) { output.writeUInt32(4, statementId_); } if (maxRowsTotal_ != 0L) { output.writeInt64(5, maxRowsTotal_); } if (firstFrameMaxSize_ != 0) { output.writeInt32(6, firstFrameMaxSize_); } unknownFields.writeTo(output); }
@Override PrepareAndExecuteRequest deserialize(Message genericMsg) { final Requests.PrepareAndExecuteRequest msg = ProtobufService.castProtobufMessage(genericMsg, Requests.PrepareAndExecuteRequest.class); String connectionId = null; if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) { connectionId = msg.getConnectionId(); } String sql = null; if (msg.hasField(SQL_DESCRIPTOR)) { sql = msg.getSql(); } // Use the old attribute, unless the new is set long maxRowsTotal = msg.getMaxRowCount(); if (msg.hasField(MAX_ROWS_TOTAL_DESCRIPTOR)) { maxRowsTotal = msg.getMaxRowsTotal(); } // Use maxRowCount (cast to an integer) if firstFrameMaxSize isn't set int maxRowsInFirstFrame = (int) maxRowsTotal; if (msg.hasField(FIRST_FRAME_MAX_SIZE_DESCRIPTOR)) { maxRowsInFirstFrame = msg.getFirstFrameMaxSize(); } return new PrepareAndExecuteRequest(connectionId, msg.getStatementId(), sql, maxRowsTotal, maxRowsInFirstFrame); }
@Override Requests.PrepareAndExecuteRequest serialize() { Requests.PrepareAndExecuteRequest.Builder builder = Requests.PrepareAndExecuteRequest .newBuilder(); if (null != connectionId) { builder.setConnectionId(connectionId); } if (null != sql) { builder.setSql(sql); } builder.setStatementId(statementId); // Set both attributes for backwards compat builder.setMaxRowCount(maxRowCount).setMaxRowsTotal(maxRowCount); builder.setFirstFrameMaxSize(maxRowsInFirstFrame); return builder.build(); }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() {