Repository: apache/storm (language: java)

Issue:
[STORM-98] .stateQuery twice halts tuple execution?
<p><a href="https://github.com/nathanmarz/storm/issues/310" class="external-link" target="_blank" rel="nofollow noopener">https://github.com/nathanmarz/storm/issues/310</a></p>

<p>Having the following example, it will never execute the .aggregate()</p>


<p>FixedBatchSpout spout = new FixedBatchSpout(new Fields("sentence"), 3,<br/>
new Values("cow"),<br/>
new Values("candy"),<br/>
new Values("year"));</p>

<p>spout.setCycle(true);</p>

<p>TridentTopology topology = new TridentTopology();</p>

<p>TridentState urlToTweeters =<br/>
topology.newStaticState(<br/>
new TridentReach.StaticSingleKeyMapState.Factory(TridentReach.TWEETERS_DB));</p>

<p>Stream wordStream = topology.newStream("spout1", spout)<br/>
.each(new Fields("sentence"), new Split(), new Fields("word"))<br/>
.stateQuery(urlToTweeters, new Fields("word"), new MapGet(), new Fields("output1"))<br/>
.groupBy(new Fields("word"))<br/>
.stateQuery(urlToTweeters, new Fields("word"), new MapGet(), new Fields("output2"))<br/>
.aggregate(new Fields("word"), new PrintAggregator(), new Fields("count"));</p>

<p>PrintAggregator:</p>

<p>public static class PrintAggregator extends BaseAggregator<PrintAggregator.State> {</p>

<p>    static class State </p>
{
int counter = 0;
    }

<p>    @Override<br/>
    public State init(Object o, TridentCollector collector) </p>
{
return new State();
    }

<p>    @Override<br/>
    public void aggregate(State state, TridentTuple tuple, TridentCollector collector) </p>
{
state.counter++;
System.out.println(tuple.getString(0) + " is on: " + state.counter);
    }

<p>    @Override<br/>
    public void complete(State state, TridentCollector collector) </p>
{
collector.emit(new Values(state.counter));
    }

<p>}</p>

<p>----------<br/>
nathanmarz: Trident currently doesn't support recursive topologies. In this case you have the output of a state feeding back into a query on the same state. You can workaround this by making two separate static state instances for urlToTweeters.</p>

---
<details><summary><i>Originally reported by <a title="James Xu" href="https://issues.apache.org/jira/secure/ViewProfile.jspa?name=xumingming">xumingming</a>, imported from: <a href="https://issues.apache.org/jira/browse/STORM-98" target="_blank">.stateQuery twice halts tuple execution?</a></i></summary>
<i><ul>
<li><b>status</b>: Closed
<li><b>priority</b>: Minor
<li><b>resolution</b>: Abandoned
<li><b>resolved</b>: 2024-07-02T10:54:33+01:00
<li><b>imported</b>: 2025-01-24
</ul></i>
</details>


Discussion / hints:

Fix patch:
diff --git a/external/storm-autocreds/pom.xml b/external/storm-autocreds/pom.xml
index 5523a8e9cf6..bc1ae7a0879 100644
--- a/external/storm-autocreds/pom.xml
+++ b/external/storm-autocreds/pom.xml
@@ -194,6 +194,10 @@
             <artifactId>hive-webhcat-java-client</artifactId>
             <version>${hive.version}</version>
             <exclusions>
+                <exclusion>
+                    <groupId>org.pentaho</groupId>
+                    <artifactId>pentaho-aggdesigner-algorithm</artifactId>
+                </exclusion>
                 <exclusion>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-log4j12</artifactId>
diff --git a/external/storm-hive/pom.xml b/external/storm-hive/pom.xml
index eeb2815ee8b..68bb07791c3 100644
--- a/external/storm-hive/pom.xml
+++ b/external/storm-hive/pom.xml
@@ -104,6 +104,10 @@
       <artifactId>hive-hcatalog-core</artifactId>
       <version>${hive.version}</version>
       <exclusions>
+        <exclusion>
+          <groupId>org.pentaho</groupId>
+          <artifactId>pentaho-aggdesigner-algorithm</artifactId>
+        </exclusion>
         <exclusion>
           <groupId>log4j</groupId>
           <artifactId>log4j</artifactId>
@@ -159,6 +163,10 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>org.pentaho</groupId>
+          <artifactId>pentaho-aggdesigner-algorithm</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>


Test patch: