public ValueAndTimestamp <KeyValuePair <K1, V1> > Get(K key)
            {
                ValueAndTimestamp <V> valueAndTimestamp = parentTableGetter.Get(key);
                var v = mapper.Apply(key, valueAndTimestamp != null ? valueAndTimestamp.Value : default);

                return(ValueAndTimestamp <KeyValuePair <K1, V1> > .Make(v, valueAndTimestamp == null?context.Timestamp : valueAndTimestamp.Timestamp));
            }
            public ValueAndTimestamp <VR> Get(K key)
            {
                ValueAndTimestamp <V1> valueAndTimestamp1 = iKTableValueGetter1.Get(key);

                if (valueAndTimestamp1 != null)
                {
                    ValueAndTimestamp <V2> valueAndTimestamp2 = iKTableValueGetter2.Get(key);
                    long resultTimestamp;
                    if (valueAndTimestamp2 != null)
                    {
                        resultTimestamp = Math.Max(valueAndTimestamp1.Timestamp, valueAndTimestamp2.Timestamp);
                    }
                    else
                    {
                        resultTimestamp = valueAndTimestamp1.Timestamp;
                    }

                    return(ValueAndTimestamp <VR> .Make(
                               joiner.Apply(valueAndTimestamp1.Value, valueAndTimestamp2 != null ? valueAndTimestamp2.Value : default),
                               resultTimestamp));
                }
                else
                {
                    return(null);
                }
            }
            public ValueAndTimestamp <VR> Get(K key)
            {
                ValueAndTimestamp <V1> valueAndTimestamp1 = iKTableValueGetter1.Get(key);
                ValueAndTimestamp <V2> valueAndTimestamp2 = iKTableValueGetter2.Get(key);

                VR newValue = default;

                V1 value1                       = valueAndTimestamp1 == null ? default : valueAndTimestamp1.Value;
                                       long ts1 = valueAndTimestamp1 == null ? -1 : valueAndTimestamp1.Timestamp;

                                       V2 value2                       = valueAndTimestamp2 == null ? default : valueAndTimestamp2.Value;
                                                              long ts2 = valueAndTimestamp2 == null ? -1 : valueAndTimestamp2.Timestamp;

                                                              if (value1 != null || value2 != null)
                                                              {
                                                                  newValue = joiner.Apply(value1, value2);
                                                              }

                                                              return(ValueAndTimestamp <VR> .Make(newValue, Math.Max(ts1, ts2)));
            }
示例#4
0
            public ValueAndTimestamp <VR> Get(K key)
            {
                ValueAndTimestamp <V1> valueAndTimestamp1 = iKTableValueGetter1.Get(key);

                if (valueAndTimestamp1 != null)
                {
                    ValueAndTimestamp <V2> valueAndTimestamp2 = iKTableValueGetter2.Get(key);

                    if (valueAndTimestamp2 != null)
                    {
                        return(ValueAndTimestamp <VR> .Make(
                                   joiner.Apply(valueAndTimestamp1.Value, valueAndTimestamp2.Value),
                                   Math.Max(valueAndTimestamp1.Timestamp, valueAndTimestamp2.Timestamp)));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
示例#5
0
 public override void Process(K1 key, V1 value)
 {
     // If the key or value is null we don't need to proceed
     if (key == null || value == null)
     {
         log.Warn($"Skipping record due to null key or value. key=[{key}] value=[{value}] topic=[{Context.Topic}] partition=[{Context.Partition}] offset=[{Context.Offset}]");
         return;
     }
     else
     {
         K2 mappedKey = mapper.Apply(key, value);
         V2 value2    = mappedKey == null ? null : ValueAndTimestamp.GetValueOrNull(valueGetter.Get(mappedKey));
         if (leftJoin || value2 != null)
         {
             Forward(key, joiner.Apply(value, value2));
         }
     }
 }
 public ValueAndTimestamp <VR> Get(K key) => ComputeValue(key, ktablegetter.Get(key));