Hive UDF - Как получить доступ к имени столбца - PullRequest
0 голосов
/ 22 апреля 2020

Кто-нибудь, пожалуйста, дайте мне знать, как получить доступ к имени столбца в простом кусте udf.

import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;
import Utils

@Description(name = "Decrypt", value = "Encrypt the Given Column", extended = "SELECT Decrypt('Hello World!');")
public class Encrypt extends UDF {

    private Text result = new Text();

    public Text evaluate(Text str) {
        if (str == null) {
            return null;
        }

        //Access Column Name and pass to the function to get encryption key 
        String secretKey = Utils.getSecretKey(columnName) 
        String encryptedText = AES.encrypt(str.toString(), "randomkey");
        result.set(encryptedText);
        return result;
    }

}
...