jsun98 commented on a change in pull request #6431: Add Kinesis Indexing 
Service to core Druid
URL: https://github.com/apache/incubator-druid/pull/6431#discussion_r242736015
 
 

 ##########
 File path: 
extensions-core/kinesis-indexing-service/src/main/java/org/apache/druid/indexing/kinesis/KinesisSequenceNumber.java
 ##########
 @@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.kinesis;
+
+
+import org.apache.druid.indexing.seekablestream.SeekableStreamPartitions;
+import 
org.apache.druid.indexing.seekablestream.common.OrderedPartitionableRecord;
+import org.apache.druid.indexing.seekablestream.common.OrderedSequenceNumber;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigInteger;
+
+public class KinesisSequenceNumber extends OrderedSequenceNumber<String>
+{
+
+  // this flag is used to indicate either END_OF_SHARD_MARKER
+  // or NO_END_SEQUENCE_NUMBER so that they can be properly compared
+  // with other sequence numbers
+  private final boolean isMaxSequenceNumber;
+  private final BigInteger intSequence;
+
+  private KinesisSequenceNumber(@NotNull String sequenceNumber, boolean 
isExclusive)
+  {
+    super(sequenceNumber, isExclusive);
+    if (OrderedPartitionableRecord.END_OF_SHARD_MARKER.equals(sequenceNumber)
+        || 
SeekableStreamPartitions.NO_END_SEQUENCE_NUMBER.equals(sequenceNumber)) {
+      isMaxSequenceNumber = true;
+      this.intSequence = null;
+    } else {
+      isMaxSequenceNumber = false;
+      this.intSequence = new BigInteger(sequenceNumber);
 
 Review comment:
   I think the main thing is that there needs to be a way to compare 
sequenceNumbers with `END_OF_SHARD_MARKER` and `NO_END_SEQUENCE_NUMBER`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to