myui commented on a change in pull request #192: [HIVEMALL-253]UDF map_roulette() created URL: https://github.com/apache/incubator-hivemall/pull/192#discussion_r291890409
########## File path: core/src/main/java/hivemall/tools/map/MapRouletteUDF.java ########## @@ -0,0 +1,192 @@ +/* + * 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 hivemall.tools.map; + +import hivemall.utils.hadoop.HiveUtils; +import org.apache.hadoop.hive.ql.exec.*; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.udf.UDFType; +import org.apache.hadoop.hive.ql.udf.generic.GenericUDF; +import org.apache.hadoop.hive.serde2.objectinspector.MapObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; +import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils; +import java.util.*; +import static hivemall.HivemallConstants.*; + +/** + * The map_roulette() can be use to do roulette, according to each map.entry 's weight. + * + * @author Wang, Yizheng Review comment: "@ author" tag is not used in ASF coding conversion. Commit history shows you as a contributor as seen in https://github.com/apache/incubator-hivemall/graphs/contributors see https://www.theinquirer.net/inquirer/news/1037207/apache-enforces-the-removal-of-author-tags https://github.com/apache/dubbo/issues/2317 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
