All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bazaarvoice.emodb.hive.schema.CreateFunctions Maven / Gradle / Ivy

There is a newer version: 6.2.3
Show newest version
package com.bazaarvoice.emodb.hive.schema;

import com.bazaarvoice.emodb.hive.udf.EmoFunctions;
import net.sourceforge.argparse4j.inf.Namespace;
import org.apache.hadoop.hive.ql.exec.UDF;

import java.io.PrintStream;
import java.util.Map;

import static java.lang.String.format;

/**
 * Creates an initial schema in Hive.
 */
public class CreateFunctions extends HiveScriptGenerator {

    private final static String CREATE_FUNCTION_COMMAND =
            "CREATE FUNCTION %s AS '%s';";

    public static void main(String args[]) {
        CreateFunctions instance = new CreateFunctions();
        instance.doMain(args);
    }

    @Override
    protected void generateScript(Namespace namespace, PrintStream out) {
        for (Map.Entry> entry : EmoFunctions.ALL_FUNCTIONS.entrySet()) {
            String fcnName = entry.getKey();
            Class fcnClass = entry.getValue();

            out.println(format(CREATE_FUNCTION_COMMAND, fcnName, fcnClass.getName()));
            out.println();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy