Repository: samza
Updated Branches:
  refs/heads/master de2b97f89 -> c1e03e65f


Fix to make Samza SQL applications work after the Runner refactoring

With recent change in Samza, Constructor signature for ApplicationRunner has 
changed. But the SamzaSQLApplicationRunner was not updated with the new 
signature. This is to fix the signature of the constructor for 
SamzaSQLApplicationRunner with the updated signature.

Author: Srinivasulu Punuru <[email protected]>

Reviewers: Aditya Toomula <[email protected]>

Closes #784 from srinipunuru/sql-app-fix.1


Project: http://git-wip-us.apache.org/repos/asf/samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/samza/commit/c1e03e65
Tree: http://git-wip-us.apache.org/repos/asf/samza/tree/c1e03e65
Diff: http://git-wip-us.apache.org/repos/asf/samza/diff/c1e03e65

Branch: refs/heads/master
Commit: c1e03e65f3844d7cbcf789dd5bffb6dfc5079e79
Parents: de2b97f
Author: Srinivasulu Punuru <[email protected]>
Authored: Tue Oct 30 13:33:33 2018 -0700
Committer: Srinivasulu Punuru <[email protected]>
Committed: Tue Oct 30 13:33:33 2018 -0700

----------------------------------------------------------------------
 .../sql/runner/SamzaSqlApplicationRunner.java   | 55 ++++++++++++--------
 1 file changed, 33 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/samza/blob/c1e03e65/samza-sql/src/main/java/org/apache/samza/sql/runner/SamzaSqlApplicationRunner.java
----------------------------------------------------------------------
diff --git 
a/samza-sql/src/main/java/org/apache/samza/sql/runner/SamzaSqlApplicationRunner.java
 
b/samza-sql/src/main/java/org/apache/samza/sql/runner/SamzaSqlApplicationRunner.java
index cad032f..9d361fb 100644
--- 
a/samza-sql/src/main/java/org/apache/samza/sql/runner/SamzaSqlApplicationRunner.java
+++ 
b/samza-sql/src/main/java/org/apache/samza/sql/runner/SamzaSqlApplicationRunner.java
@@ -1,21 +1,21 @@
 /*
-* 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.
-*/
+ * 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.samza.sql.runner;
 
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.apache.commons.lang3.Validate;
+import org.apache.samza.application.SamzaApplication;
 import org.apache.samza.config.Config;
 import org.apache.samza.config.MapConfig;
 import org.apache.samza.job.ApplicationStatus;
@@ -56,9 +57,20 @@ public class SamzaSqlApplicationRunner implements 
ApplicationRunner {
   public static final String RUNNER_CONFIG = "app.runner.class";
   public static final String CFG_FMT_SAMZA_STREAM_SYSTEM = 
"streams.%s.samza.system";
 
+  /**
+   * NOTE: This constructor is called from {@link ApplicationRunners} through 
reflection.
+   * Please refrain from updating the signature or removing this constructor 
unless the caller has changed the interface.
+   */
+  public SamzaSqlApplicationRunner(SamzaApplication app, Config config) {
+    this(app, false, config);
+  }
+
   public SamzaSqlApplicationRunner(Boolean localRunner, Config config) {
-    this.runner = ApplicationRunners.getApplicationRunner(new 
SamzaSqlApplication(),
-        computeSamzaConfigs(localRunner, config));
+    this(new SamzaSqlApplication(), localRunner, config);
+  }
+
+  private SamzaSqlApplicationRunner(SamzaApplication app, Boolean localRunner, 
Config config) {
+    this.runner = ApplicationRunners.getApplicationRunner(app, 
computeSamzaConfigs(localRunner, config));
   }
 
   public static Config computeSamzaConfigs(Boolean localRunner, Config config) 
{
@@ -74,8 +86,8 @@ public class SamzaSqlApplicationRunner implements 
ApplicationRunner {
     Set<String> inputSystemStreams = new HashSet<>();
     Set<String> outputSystemStreams = new HashSet<>();
 
-    SamzaSqlApplicationConfig.populateSystemStreamsAndGetRelRoots(dslStmts, 
config,
-        inputSystemStreams, outputSystemStreams);
+    SamzaSqlApplicationConfig.populateSystemStreamsAndGetRelRoots(dslStmts, 
config, inputSystemStreams,
+        outputSystemStreams);
 
     SqlIOResolver ioResolver = 
SamzaSqlApplicationConfig.createIOResolver(config);
 
@@ -136,5 +148,4 @@ public class SamzaSqlApplicationRunner implements 
ApplicationRunner {
   public boolean waitForFinish(Duration timeout) {
     return runner.waitForFinish(timeout);
   }
-
 }

Reply via email to