Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8675201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:53:37+00:00 2026-06-12T19:53:37+00:00

I have written a Hive UDF that does decryption using an in-house API as

  • 0

I have written a Hive UDF that does decryption using an in-house API as follows:

public Text evaluate(String customer) {
    String result = new String();

    if (customer == null) { return null; }

    try {
        result = com.voltage.data.access.Data.decrypt(customer.toString(), "name");
    } catch (Exception e) {
        return new Text(e.getMessage());
    }

    return new Text(result);
}

and Data.decrypt does:

public static String decrypt(String data, String type) throws Exception {
    configure();
    String FORMAT = new String();
    if (type.equals("ccn")) {
        FORMAT = "CC";
    } else if (type.equals("ssn")) {
        FORMAT = "SSN";
    }   else if (type.equals("name")) {
        FORMAT = "AlphaNumeric";
    }

    return library.FPEAccess(identity, LibraryContext.getFPE_FORMAT_CUSTOM(),String.format("formatName=%s", FORMAT),authMethod, authInfo, data);
}

where configure() creates a pretty expensive context object.

My question is: Does Hive execute this UDF once for every row returned by the query? i.e. If I’m selecting 10,000 rows, does the evaluate method get run 10,000 times?

My gut instinct tells me yes. And if so, then here’s a second question:

Is there any way I can do one of the following:

a) run configure() once when the query first starts, then share the context object

b) instead of the UDF returning a decrypted string, it aggregates the encrypted string into some Set, then I do a bulk decrypt on the set?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:53:39+00:00Added an answer on June 12, 2026 at 7:53 pm

    Is configure() something that needs to be called once per JVM, or once per instance of the UDF class?

    If once per JVM, just put it in a static block in the class, like so:

    static {
        configure();
    }
    

    If once per instance, put it in the constructor:

    public [class name]() {
        super();
        configure();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a function that sorts a big scale of data. To test
I have written a function that extract the domain from hostname. e.g. www.domain.com ->
I have written a very simple CTE expression that retrieves a list of all
I have written a sample code to practise Spring Bean Injection using setter methods.
I have written a pretty-printer using the GDB Python interface for a (C) struct
I have written the following code. I know that a higher order function is
I have written a WCF service with the REST template that has the defaultOutgoingResponseFormat
I have written an Android app (target 3.2) using Eclipse 3.7, I tried to
I have a .NET component written in C# that needs to register some registry
I have written a generic CSV file reader that I'm trying to use to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.