jt2594838 commented on a change in pull request #1169:
URL: https://github.com/apache/incubator-iotdb/pull/1169#discussion_r428415552
##########
File path:
server/src/main/java/org/apache/iotdb/db/query/dataset/ShowTimeSeriesResult.java
##########
@@ -68,4 +79,70 @@ public String getCompressor() {
public Map<String, String> getTagAndAttribute() {
return tagAndAttribute;
}
+
+ @Override
+ public int compareTo(ShowTimeSeriesResult o) {
+ return this.name.compareTo(o.name);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ShowTimeSeriesResult result = (ShowTimeSeriesResult) o;
+ return Objects.equals(name, result.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name);
+ }
+
+ public void serialize(OutputStream outputStream) throws IOException {
+ ReadWriteIOUtils.write(name, outputStream);
+ ReadWriteIOUtils.write(alias != null, outputStream);
+ if (alias != null) {
+ ReadWriteIOUtils.write(alias, outputStream);
+ }
+ ReadWriteIOUtils.write(sgName, outputStream);
+ ReadWriteIOUtils.write(dataType, outputStream);
+ ReadWriteIOUtils.write(encoding, outputStream);
+ ReadWriteIOUtils.write(compressor, outputStream);
+
+ ReadWriteIOUtils.write(tagAndAttribute != null, outputStream);
+ if (tagAndAttribute != null) {
+ ReadWriteIOUtils.write(tagAndAttribute.size(), outputStream);
+ for (Entry<String, String> stringStringEntry :
tagAndAttribute.entrySet()) {
+ ReadWriteIOUtils.write(stringStringEntry.getKey(), outputStream);
+ ReadWriteIOUtils.write(stringStringEntry.getValue(), outputStream);
+ }
+ }
+ }
+
+ public static ShowTimeSeriesResult deserialize(ByteBuffer buffer) {
+ ShowTimeSeriesResult result = new ShowTimeSeriesResult();
+ result.name = ReadWriteIOUtils.readString(buffer);
+ if (buffer.get() == 1) {
+ result.alias = ReadWriteIOUtils.readString(buffer);
+ }
+ result.sgName = ReadWriteIOUtils.readString(buffer);
+ result.dataType = ReadWriteIOUtils.readString(buffer);
+ result.encoding = ReadWriteIOUtils.readString(buffer);
+ result.compressor = ReadWriteIOUtils.readString(buffer);
+
+ if (buffer.get() == 1) {
Review comment:
This is not C or C++, integers are not comparable with booleans.
Besides, there is no `getBoolean` in ByteBuffer.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]