[ 
https://issues.apache.org/jira/browse/STORM-676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15192153#comment-15192153
 ] 

ASF GitHub Bot commented on STORM-676:
--------------------------------------

Github user satishd commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1072#discussion_r55932588
  
    --- Diff: 
storm-core/src/jvm/org/apache/storm/trident/windowing/InMemoryWindowsStoreFactory.java
 ---
    @@ -0,0 +1,37 @@
    +/**
    + * 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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.storm.trident.windowing;
    +
    +/**
    + * InMemoryWindowsStoreFactory contains a single instance of {@code 
InMemoryWindowsStore} which will be used for
    + * storing tuples and triggers of the window and successfully emitted 
triggers can be removed from {@code StateUpdater}.
    + *
    + */
    +public class InMemoryWindowsStoreFactory implements WindowsStoreFactory {
    --- End diff --
    
    @harshach Each  InMemoryWindowsStoreFactory instance will always have the 
same inmemoryStore instance. The same InMemoryWindowsStoreFactory instance is 
passed to WindowsStateUpdater which which removes successfully emitted triggers 
from the same inMemoryWindowsStore instance in 
WindowsStateUpdater#updateState(WindowsState, List, TridentCollector).
    
    Below code snippet is from Stream#window(WindowConfig windowConfig, 
WindowsStoreFactory windowStoreFactory, Fields inputFields, Aggregator 
aggregator,
                              Fields functionFields, boolean storeTuplesInStore)
    ``` java
    // when storeTuplesInStore is false then the given windowStoreFactory is 
only used to store triggers and
            // that store is passed to WindowStateUpdater to remove them after 
committing the batch.
            Stream stream = _topology.addSourcedNode(this,
                    new ProcessorNode(_topology.getUniqueStreamId(),
                            _name,
                            fields,
                            fields,
                            new WindowTridentProcessor(windowConfig, 
_topology.getUniqueWindowId(), windowStoreFactory,
                                    inputFields, aggregator, 
storeTuplesInStore)));
    
            Stream effectiveStream = stream.project(functionFields);
    
            // create StateUpdater with the given windowStoreFactory to remove 
triggered aggregation results form store
            // when they are successfully processed.
            StateFactory stateFactory = new WindowsStateFactory();
            StateUpdater stateUpdater = new 
WindowsStateUpdater(windowStoreFactory);
            stream.partitionPersist(stateFactory, new 
Fields(WindowTridentProcessor.TRIGGER_FIELD_NAME), stateUpdater, new Fields());
    ```
    
    Updated the java doc with the below details.
    
    ``` java
    /**
     * InMemoryWindowsStoreFactory contains a single instance of {@link 
InMemoryWindowsStore} which will be used for
     * storing tuples and triggers of the window. The same 
InMemoryWindowsStoreFactory instance is passed to {@link WindowsStateUpdater},
     * which removes successfully emitted triggers from the same {@code 
inMemoryWindowsStore} instance in
     * {@link WindowsStateUpdater#updateState(WindowsState, List, 
TridentCollector)}.
     *
     */
    public class InMemoryWindowsStoreFactory implements WindowsStoreFactory {
    
    ```


> Storm Trident support for sliding/tumbling windows
> --------------------------------------------------
>
>                 Key: STORM-676
>                 URL: https://issues.apache.org/jira/browse/STORM-676
>             Project: Apache Storm
>          Issue Type: Improvement
>          Components: storm-core
>            Reporter: Sriharsha Chintalapani
>            Assignee: Satish Duggana
>             Fix For: 1.0.0, 2.0.0
>
>         Attachments: StormTrident_windowing_support-676.pdf
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to