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

    https://github.com/apache/storm/pull/1055#discussion_r51603260
  
    --- Diff: storm-core/src/clj/org/apache/storm/internal/thrift.clj ---
    @@ -0,0 +1,291 @@
    +;; 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.
    +
    +(ns org.apache.storm.internal.thrift
    +  (:import [java.util HashMap]
    +           [java.io Serializable]
    +           [org.apache.storm.generated NodeInfo Assignment])
    +  (:import [org.apache.storm.generated JavaObject Grouping Nimbus 
StormTopology
    +            StormTopology$_Fields Bolt Nimbus$Client Nimbus$Iface
    +            ComponentCommon Grouping$_Fields SpoutSpec NullStruct 
StreamInfo
    +            GlobalStreamId ComponentObject ComponentObject$_Fields
    +            ShellComponent SupervisorInfo])
    +  (:import [org.apache.storm.utils Utils NimbusClient ConfigUtils])
    +  (:import [org.apache.storm Constants])
    +  (:import [org.apache.storm.security.auth ReqContext])
    +  (:import [org.apache.storm.grouping CustomStreamGrouping])
    +  (:import [org.apache.storm.topology TopologyBuilder])
    +  (:import [org.apache.storm.clojure RichShellBolt RichShellSpout])
    +  (:import [org.apache.thrift.transport TTransport])
    +  (:use [org.apache.storm util config log zookeeper]))
    +
    +(defn instantiate-java-object
    +  [^JavaObject obj]
    +  (let [name (symbol (.get_full_class_name obj))
    +        args (map (memfn getFieldValue) (.get_args_list obj))]
    +    (eval `(new ~name ~@args))))
    +
    +;; Not required to implement this method, will remove after review
    +(def grouping-constants
    +  {Grouping$_Fields/FIELDS :fields
    +   Grouping$_Fields/SHUFFLE :shuffle
    +   Grouping$_Fields/ALL :all
    +   Grouping$_Fields/NONE :none
    +   Grouping$_Fields/CUSTOM_SERIALIZED :custom-serialized
    +   Grouping$_Fields/CUSTOM_OBJECT :custom-object
    +   Grouping$_Fields/DIRECT :direct
    +   Grouping$_Fields/LOCAL_OR_SHUFFLE :local-or-shuffle})
    +
    +(defn grouping-type
    +  [^Grouping grouping]
    +  (grouping-constants (.getSetField grouping)))
    +
    +(defn field-grouping
    +  [^Grouping grouping]
    +  (when-not (= (grouping-type grouping) :fields)
    +    (throw (IllegalArgumentException. "Tried to get grouping fields from 
non fields grouping")))
    +  (.get_fields grouping))
    +
    +(defn global-grouping?
    +  [^Grouping grouping]
    +  (and (= :fields (grouping-type grouping))
    +       (empty? (field-grouping grouping))))
    +
    +(defn parallelism-hint
    +  [^ComponentCommon component-common]
    +  (let [phint (.get_parallelism_hint component-common)]
    +    (if-not (.is_set_parallelism_hint component-common) 1 phint)))
    +
    +(defn nimbus-client-and-conn
    --- End diff --
    
    Can we please move this to java too?  We can drop the clojurify-structure 
call wrapping readStormConfig.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to