[
https://issues.apache.org/jira/browse/APEXMALHAR-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15405469#comment-15405469
]
ASF GitHub Bot commented on APEXMALHAR-2100:
--------------------------------------------
Github user chaithu14 commented on a diff in the pull request:
https://github.com/apache/apex-malhar/pull/330#discussion_r73289992
--- Diff:
library/src/main/java/org/apache/apex/malhar/lib/state/managed/ManagedTimeStateMultiValue.java
---
@@ -0,0 +1,357 @@
+/**
+ * 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.apex.malhar.lib.state.managed;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import javax.annotation.Nullable;
+import javax.validation.constraints.NotNull;
+
+import org.apache.apex.malhar.lib.state.spillable.Spillable;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multiset;
+
+import com.datatorrent.api.StreamCodec;
+import com.datatorrent.lib.codec.KryoSerializableStreamCodec;
+import com.datatorrent.netlet.util.Slice;
+
+/**
+ * Concrete implementation of SpillableByteArrayListMultimap which is
needed for join operator.
+ *
+ * <b>Properties:</b><br>
+ * <b>isKeyContainsMultiValue</b>: Specifies whether the key has multiple
value or not. <br>
+ * <b>timeBucket</b>: Specifies the lenght of the time bucket.
+ *
+ */
+public class ManagedTimeStateMultiValue<K,V> implements
Spillable.SpillableByteArrayListMultimap<K,V>
+{
+ private transient StreamCodec streamCodec = null;
+ private boolean isKeyContainsMultiValue = false;
+ private long timeBucket;
+ @NotNull
+ private ManagedTimeStateImpl store;
+
+ public ManagedTimeStateMultiValue()
+ {
+ if (streamCodec == null) {
+ streamCodec = new KryoSerializableStreamCodec();
+ }
+ }
+
+ public ManagedTimeStateMultiValue(@NotNull ManagedTimeStateImpl store,
boolean isPrimaryKey)
+ {
+ this();
+ this.store = Preconditions.checkNotNull(store);
+ this.isKeyContainsMultiValue = isPrimaryKey;
+ }
+
+ /**
+ * Return the list of values from the store
+ * @param k given key
+ * @return list of values
+ */
+ @Override
+ public List<V> get(@Nullable K k)
+ {
+ List<V> value = null;
+ Slice valueSlice = store.getSync(getBucketId(k),
streamCodec.toByteArray(k));
+ if (isKeyContainsMultiValue) {
+ value = (List<V>)streamCodec.fromByteArray(valueSlice);
+ } else {
+ if (valueSlice == null || valueSlice.length == 0 ||
valueSlice.buffer == null) {
--- End diff --
Yes. Done.
> Development of Inner Join Operator using Spillable Datastructures
> -----------------------------------------------------------------
>
> Key: APEXMALHAR-2100
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-2100
> Project: Apache Apex Malhar
> Issue Type: Task
> Reporter: Chaitanya
> Assignee: Chaitanya
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)