ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] ranger git commit: RANGER-1785 - Remove ranger-hive-utils module
Date Mon, 18 Sep 2017 12:25:15 GMT
Repository: ranger
Updated Branches:
  refs/heads/master 98351d4c1 -> dbc84c18a


RANGER-1785 - Remove ranger-hive-utils module

Signed-off-by: Colm O hEigeartaigh <coheigea@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/e7d8dea8
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/e7d8dea8
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/e7d8dea8

Branch: refs/heads/master
Commit: e7d8dea885da7a5a740852fc0f86fb5435e5a704
Parents: 98351d4
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Sep 15 12:21:46 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Sep 18 12:59:33 2017 +0100

----------------------------------------------------------------------
 pom.xml                                         |   1 -
 ranger-hive-utils/.gitignore                    |   1 -
 ranger-hive-utils/pom.xml                       |  50 --
 .../authorization/hive/udf/RangerBaseUdf.java   | 474 -------------------
 .../authorization/hive/udf/RangerUdfMask.java   | 334 -------------
 .../hive/udf/RangerUdfMaskFirstN.java           | 229 ---------
 .../hive/udf/RangerUdfMaskHash.java             |  77 ---
 .../hive/udf/RangerUdfMaskLastN.java            | 193 --------
 .../hive/udf/RangerUdfMaskShowFirstN.java       | 248 ----------
 .../hive/udf/RangerUdfMaskShowLastN.java        | 198 --------
 10 files changed, 1805 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0ebadee..f7d690f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,6 @@
         <module>ranger-solr-plugin-shim</module>
         <module>ranger-atlas-plugin-shim</module>
         <module>ranger-kms-plugin-shim</module>
-        <module>ranger-hive-utils</module>
         <module>ranger-examples</module>
         <module>ranger-tools</module>
         <module>plugin-atlas</module>

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/.gitignore
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/.gitignore b/ranger-hive-utils/.gitignore
deleted file mode 100644
index b83d222..0000000
--- a/ranger-hive-utils/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/pom.xml b/ranger-hive-utils/pom.xml
deleted file mode 100644
index 6653bab..0000000
--- a/ranger-hive-utils/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>ranger-hive-utils</artifactId>
-  <name>Ranger Hive Utils</name>
-  <description>Ranger Hive Utils</description>
-  <packaging>jar</packaging>
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-  </properties>
-  <parent>
-     <groupId>org.apache.ranger</groupId>
-     <artifactId>ranger</artifactId>
-     <version>1.0.0-SNAPSHOT</version>
-     <relativePath>..</relativePath>
-  </parent>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-common</artifactId>
-      <version>${hadoop.version}</version>
-    </dependency>
-    <dependency>
-	  <groupId>org.apache.hive</groupId>
-	  <artifactId>hive-common</artifactId>
-	  <version>${hive.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hive</groupId>
-      <artifactId>hive-exec</artifactId>
-      <version>${hive.version}</version>
-    </dependency>
-  </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerBaseUdf.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerBaseUdf.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerBaseUdf.java
deleted file mode 100644
index 8bc6b36..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerBaseUdf.java
+++ /dev/null
@@ -1,474 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hive.common.type.HiveChar;
-import org.apache.hadoop.hive.common.type.HiveVarchar;
-import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
-import org.apache.hadoop.hive.ql.metadata.HiveException;
-import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
-import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
-import org.apache.hadoop.hive.serde2.io.*;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.*;
-import org.apache.hadoop.io.IntWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.io.Text;
-
-import java.sql.Date;
-
-
-public abstract class RangerBaseUdf extends GenericUDF {
-  private static final Log LOG = LogFactory.getLog(RangerBaseUdf.class);
-
-  final protected AbstractTransformer  transformer;
-  final protected String               displayName;
-  protected AbstractTransformerAdapter transformerAdapter = null;
-
-  protected RangerBaseUdf(AbstractTransformer transformer, String displayName) {
-    this.transformer = transformer;
-    this.displayName = displayName;
-  }
-
-  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
-    LOG.debug("==> RangerBaseUdf.initialize()");
-
-    checkArgPrimitive(arguments, 0); // first argument is the column to be transformed
-
-    PrimitiveObjectInspector columnType = ((PrimitiveObjectInspector) arguments[0]);
-
-    transformer.init(arguments, 1);
-
-    transformerAdapter = AbstractTransformerAdapter.getTransformerAdapter(columnType, transformer);
-
-    ObjectInspector ret = PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(columnType.getPrimitiveCategory());
-
-    LOG.debug("<== RangerBaseUdf.initialize()");
-
-    return ret;
-  }
-
-  @Override
-  public Object evaluate(DeferredObject[] arguments) throws HiveException {
-    Object ret = transformerAdapter.getTransformedWritable(arguments[0]);
-
-    return ret;
-  }
-
-  @Override
-  public String getDisplayString(String[] children) {
-    return getStandardDisplayString(displayName, children);
-  }
-}
-
-
-/**
- * Interface to be implemented by transformers which transform a given value according to its specification.
- */
-abstract class AbstractTransformer {
-  /**
-   * Initialize the transformer object
-   * @param arguments arguments given to GenericUDF.initialize()
-   * @param startIdx index into array, from which the transformer should read values
-   */
-  abstract void init(ObjectInspector[] arguments, int startIdx);
-
-  /**
-   * Transform a String value
-   * @param value value to transform
-   * @return transformed value
-   */
-  abstract String transform(String value);
-
-  /**
-   * Transform a Byte value
-   * @param value value to transform
-   * @return transformed value
-   */
-  abstract Byte transform(Byte value);
-
-  /**
-   * Transform a Short value
-   * @param value value to transform
-   * @return transformed value
-   */
-  abstract Short transform(Short value);
-
-  /**
-   * Transform a Integer value
-   * @param value value to transform
-   * @return transformed value
-   */
-  abstract Integer transform(Integer value);
-
-  /**
-   * Transform a Long value
-   * @param value value to transform
-   * @return transformed value
-   */
-  abstract Long transform(Long value);
-
-  /**
-   * Transform a Date value
-   * @param value value to transform
-   * @return transformed value
-   */
-  abstract Date transform(Date value);
-}
-
-/**
- * Interface to be implemented by datatype specific adapters that handle necessary conversion of the transformed value
- * into appropriate Writable object, which GenericUDF.evaluate() is expected to return.
- */
-abstract class AbstractTransformerAdapter {
-  final AbstractTransformer transformer;
-
-  AbstractTransformerAdapter(AbstractTransformer transformer) {
-    this.transformer = transformer;
-  }
-
-  abstract Object getTransformedWritable(DeferredObject value) throws HiveException;
-
-  static AbstractTransformerAdapter getTransformerAdapter(PrimitiveObjectInspector columnType, AbstractTransformer transformer) {
-    final AbstractTransformerAdapter ret;
-
-    switch(columnType.getPrimitiveCategory()) {
-      case STRING:
-        ret = new StringTransformerAdapter((StringObjectInspector)columnType, transformer);
-        break;
-
-      case CHAR:
-        ret = new HiveCharTransformerAdapter((HiveCharObjectInspector)columnType, transformer);
-        break;
-
-      case VARCHAR:
-        ret = new HiveVarcharTransformerAdapter((HiveVarcharObjectInspector)columnType, transformer);
-        break;
-
-      case BYTE:
-        ret = new ByteTransformerAdapter((ByteObjectInspector)columnType, transformer);
-        break;
-
-      case SHORT:
-        ret = new ShortTransformerAdapter((ShortObjectInspector)columnType, transformer);
-        break;
-
-      case INT:
-        ret = new IntegerTransformerAdapter((IntObjectInspector)columnType, transformer);
-        break;
-
-      case LONG:
-        ret = new LongTransformerAdapter((LongObjectInspector)columnType, transformer);
-        break;
-
-      case DATE:
-        ret = new DateTransformerAdapter((DateObjectInspector)columnType, transformer);
-        break;
-
-      default:
-        ret = new UnsupportedDatatypeTransformAdapter(columnType, transformer);
-        break;
-    }
-
-    return ret;
-  }
-}
-
-class ByteTransformerAdapter extends AbstractTransformerAdapter {
-  final ByteObjectInspector columnType;
-  final ByteWritable        writable;
-
-  public ByteTransformerAdapter(ByteObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new ByteWritable());
-  }
-
-  public ByteTransformerAdapter(ByteObjectInspector columnType, AbstractTransformer transformer, ByteWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    Byte value = (Byte)columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      Byte transformedValue = transformer.transform(value);
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class DateTransformerAdapter extends AbstractTransformerAdapter {
-  final DateObjectInspector columnType;
-  final DateWritable        writable;
-
-  public DateTransformerAdapter(DateObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new DateWritable());
-  }
-
-  public DateTransformerAdapter(DateObjectInspector columnType, AbstractTransformer transformer, DateWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    Date value = columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      Date transformedValue = transformer.transform(value);
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class HiveCharTransformerAdapter extends AbstractTransformerAdapter {
-  final HiveCharObjectInspector columnType;
-  final HiveCharWritable        writable;
-
-  public HiveCharTransformerAdapter(HiveCharObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new HiveCharWritable());
-  }
-
-  public HiveCharTransformerAdapter(HiveCharObjectInspector columnType, AbstractTransformer transformer, HiveCharWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    HiveChar value = columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      String transformedValue = transformer.transform(value.getValue());
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class HiveVarcharTransformerAdapter extends AbstractTransformerAdapter {
-  final HiveVarcharObjectInspector columnType;
-  final HiveVarcharWritable        writable;
-
-  public HiveVarcharTransformerAdapter(HiveVarcharObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new HiveVarcharWritable());
-  }
-
-  public HiveVarcharTransformerAdapter(HiveVarcharObjectInspector columnType, AbstractTransformer transformer, HiveVarcharWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    HiveVarchar value = columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      String transformedValue = transformer.transform(value.getValue());
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class IntegerTransformerAdapter extends AbstractTransformerAdapter {
-  final IntObjectInspector columnType;
-  final IntWritable        writable;
-
-  public IntegerTransformerAdapter(IntObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new IntWritable());
-  }
-
-  public IntegerTransformerAdapter(IntObjectInspector columnType, AbstractTransformer transformer, IntWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    Integer value = (Integer)columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      Integer transformedValue = transformer.transform(value);
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class LongTransformerAdapter extends AbstractTransformerAdapter {
-  final LongObjectInspector columnType;
-  final LongWritable        writable;
-
-  public LongTransformerAdapter(LongObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new LongWritable());
-  }
-
-  public LongTransformerAdapter(LongObjectInspector columnType, AbstractTransformer transformer, LongWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    Long value = (Long)columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      Long transformedValue = transformer.transform(value);
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class ShortTransformerAdapter extends AbstractTransformerAdapter {
-  final ShortObjectInspector columnType;
-  final ShortWritable        writable;
-
-  public ShortTransformerAdapter(ShortObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new ShortWritable());
-  }
-
-  public ShortTransformerAdapter(ShortObjectInspector columnType, AbstractTransformer transformer, ShortWritable writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    Short value = (Short)columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      Short transformedValue = transformer.transform(value);
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class StringTransformerAdapter extends AbstractTransformerAdapter {
-  final StringObjectInspector columnType;
-  final Text                  writable;
-
-  public StringTransformerAdapter(StringObjectInspector columnType, AbstractTransformer transformer) {
-    this(columnType, transformer, new Text());
-  }
-
-  public StringTransformerAdapter(StringObjectInspector columnType, AbstractTransformer transformer, Text writable) {
-    super(transformer);
-
-    this.columnType = columnType;
-    this.writable   = writable;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    String value = columnType.getPrimitiveJavaObject(object.get());
-
-    if(value != null) {
-      String transformedValue = transformer.transform(value);
-
-      if(transformedValue != null) {
-        writable.set(transformedValue);
-
-        return writable;
-      }
-    }
-
-    return null;
-  }
-}
-
-class UnsupportedDatatypeTransformAdapter extends AbstractTransformerAdapter {
-  final PrimitiveObjectInspector columnType;
-
-  public UnsupportedDatatypeTransformAdapter(PrimitiveObjectInspector columnType, AbstractTransformer transformer) {
-    super(transformer);
-
-    this.columnType = columnType;
-  }
-
-  @Override
-  public Object getTransformedWritable(DeferredObject object) throws HiveException {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMask.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMask.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMask.java
deleted file mode 100644
index d85ee2b..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMask.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-
-import java.sql.Date;
-
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.serde2.io.ShortWritable;
-import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.*;
-import org.apache.hadoop.io.IntWritable;
-import org.apache.hadoop.io.LongWritable;
-
-
-@Description(name = "mask",
-             value = "masks the given value",
-             extended = "Examples:\n "
-                      + "  mask(ccn)\n "
-                      + "  mask(ccn, 'X', 'x', '0')\n "
-                      + "  mask(ccn, 'x', 'x', 'x')\n "
-                      + "Arguments:\n "
-                      + "  mask(value, upperChar, lowerChar, digitChar, otherChar, numberChar, dayValue, monthValue, yearValue)\n "
-                      + "    value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR, DATE\n "
-                      + "    upperChar  - character to replace upper-case characters with. Specify -1 to retain original character. Default value: 'X'\n "
-                      + "    lowerChar  - character to replace lower-case characters with. Specify -1 to retain original character. Default value: 'x'\n "
-                      + "    digitChar  - character to replace digit characters with. Specify -1 to retain original character. Default value: 'n'\n "
-                      + "    otherChar  - character to replace all other characters with. Specify -1 to retain original character. Default value: -1\n "
-                      + "    numberChar - character to replace digits in a number with. Valid values: 0-9. Default value: '1'\n "
-                      + "    dayValue   - value to replace day field in a date with.  Specify -1 to retain original value. Valid values: 1-31. Default value: 1\n "
-                      + "    monthValue - value to replace month field in a date with. Specify -1 to retain original value. Valid values: 0-11. Default value: 0\n "
-                      + "    yearValue  - value to replace year field in a date with. Specify -1 to retain original value. Default value: 0\n "
-           )
-public class RangerUdfMask extends RangerBaseUdf {
-  public static final String UDF_NAME = "mask";
-
-  public RangerUdfMask() {
-    super(new MaskTransformer(), UDF_NAME);
-  }
-}
-
-class MaskTransformer extends AbstractTransformer {
-  final static int MASKED_UPPERCASE           = 'X';
-  final static int MASKED_LOWERCASE           = 'x';
-  final static int MASKED_DIGIT               = 'n';
-  final static int MASKED_OTHER_CHAR          = -1;
-  final static int MASKED_NUMBER              = 1;
-  final static int MASKED_DAY_COMPONENT_VAL   = 1;
-  final static int MASKED_MONTH_COMPONENT_VAL = 0;
-  final static int MASKED_YEAR_COMPONENT_VAL  = 0;
-  final static int UNMASKED_VAL               = -1;
-
-  int maskedUpperChar  = MASKED_UPPERCASE;
-  int maskedLowerChar  = MASKED_LOWERCASE;
-  int maskedDigitChar  = MASKED_DIGIT;
-  int maskedOtherChar  = MASKED_OTHER_CHAR;
-  int maskedNumber     = MASKED_NUMBER;
-  int maskedDayValue   = MASKED_DAY_COMPONENT_VAL;
-  int maskedMonthValue = MASKED_MONTH_COMPONENT_VAL;
-  int maskedYearValue  = MASKED_YEAR_COMPONENT_VAL;
-
-  public MaskTransformer() {
-  }
-
-  @Override
-  public void init(ObjectInspector[] arguments, int startIdx) {
-    int idx = startIdx;
-
-    maskedUpperChar  = getCharArg(arguments, idx++, MASKED_UPPERCASE);
-    maskedLowerChar  = getCharArg(arguments, idx++, MASKED_LOWERCASE);
-    maskedDigitChar  = getCharArg(arguments, idx++, MASKED_DIGIT);
-    maskedOtherChar  = getCharArg(arguments, idx++, MASKED_OTHER_CHAR);
-    maskedNumber     = getIntArg(arguments, idx++, MASKED_NUMBER);
-    maskedDayValue   = getIntArg(arguments, idx++, MASKED_DAY_COMPONENT_VAL);
-    maskedMonthValue = getIntArg(arguments, idx++, MASKED_MONTH_COMPONENT_VAL);
-    maskedYearValue  = getIntArg(arguments, idx++, MASKED_YEAR_COMPONENT_VAL);
-
-    if(maskedNumber < 0 || maskedNumber > 9) {
-      maskedNumber = MASKED_NUMBER;
-    }
-
-    if(maskedDayValue < 1 || maskedDayValue > 31) {
-      maskedDayValue = MASKED_DAY_COMPONENT_VAL;
-    }
-
-    if(maskedMonthValue < 0 || maskedMonthValue > 11) {
-      maskedMonthValue = MASKED_MONTH_COMPONENT_VAL;
-    }
-  }
-
-  @Override
-  String transform(final String val) {
-    StringBuilder ret = new StringBuilder(val.length());
-
-    for(int i = 0; i < val.length(); i++) {
-      ret.appendCodePoint(transformChar(val.charAt(i)));
-    }
-
-    return ret.toString();
-  }
-
-  @Override
-  Byte transform(final Byte value) {
-    byte val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    byte ret = 0;
-    int  pos = 1;
-    while(val != 0) {
-      ret += maskedNumber * pos;
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Short transform(final Short value) {
-    short val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    short ret = 0;
-    int   pos = 1;
-    while(val != 0) {
-      ret += maskedNumber * pos;
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Integer transform(final Integer value) {
-    int val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    int ret = 0;
-    int pos = 1;
-    while(val != 0) {
-      ret += maskedNumber * pos;
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Long transform(final Long value) {
-    long val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    long ret = 0;
-    long pos = 1;
-    while (val != 0) {
-      ret += maskedNumber * pos;
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Date transform(final Date value) {
-    int year  = maskedYearValue  == UNMASKED_VAL ? value.getYear()  : maskedYearValue;
-    int month = maskedMonthValue == UNMASKED_VAL ? value.getMonth() : maskedMonthValue;
-    int day   = maskedDayValue   == UNMASKED_VAL ? value.getDate()  : maskedDayValue;
-
-    return new Date(year, month, day);
-  }
-
-  protected int transformChar(final int c) {
-    switch(Character.getType(c)) {
-      case Character.UPPERCASE_LETTER:
-        if(maskedUpperChar != UNMASKED_VAL) {
-          return maskedUpperChar;
-        }
-        break;
-
-      case Character.LOWERCASE_LETTER:
-        if(maskedLowerChar != UNMASKED_VAL) {
-          return maskedLowerChar;
-        }
-        break;
-
-      case Character.DECIMAL_DIGIT_NUMBER:
-        if(maskedDigitChar != UNMASKED_VAL) {
-          return maskedDigitChar;
-        }
-        break;
-
-      default:
-        if(maskedOtherChar != UNMASKED_VAL) {
-          return maskedOtherChar;
-        }
-        break;
-    }
-
-    return c;
-  }
-
-  int getCharArg(ObjectInspector[] arguments, int index, int defaultValue) {
-    int ret = defaultValue;
-
-    ObjectInspector arg = (arguments != null && arguments.length > index) ? arguments[index] : null;
-
-    if (arg != null) {
-      if(arg instanceof WritableConstantIntObjectInspector) {
-        IntWritable value = ((WritableConstantIntObjectInspector)arg).getWritableConstantValue();
-
-        if(value != null) {
-          ret = value.get();
-        }
-      } else if(arg instanceof WritableConstantLongObjectInspector) {
-        LongWritable value = ((WritableConstantLongObjectInspector)arg).getWritableConstantValue();
-
-        if(value != null) {
-          ret = (int)value.get();
-        }
-      } else if(arg instanceof WritableConstantShortObjectInspector) {
-        ShortWritable value = ((WritableConstantShortObjectInspector)arg).getWritableConstantValue();
-
-        if(value != null) {
-          ret = value.get();
-        }
-      } else if(arg instanceof ConstantObjectInspector) {
-        Object value = ((ConstantObjectInspector) arg).getWritableConstantValue();
-
-        if (value != null) {
-          String strValue = value.toString();
-
-          if (strValue != null && strValue.length() > 0) {
-            ret = strValue.charAt(0);
-          }
-        }
-      }
-    }
-
-    return ret;
-  }
-
-  int getIntArg(ObjectInspector[] arguments, int index, int defaultValue) {
-    int ret = defaultValue;
-
-    ObjectInspector arg = (arguments != null && arguments.length > index) ? arguments[index] : null;
-
-    if (arg != null) {
-      if (arg instanceof WritableConstantIntObjectInspector) {
-        IntWritable value = ((WritableConstantIntObjectInspector) arg).getWritableConstantValue();
-
-        if (value != null) {
-          ret = value.get();
-        }
-      } else if (arg instanceof WritableConstantLongObjectInspector) {
-        LongWritable value = ((WritableConstantLongObjectInspector) arg).getWritableConstantValue();
-
-        if (value != null) {
-          ret = (int) value.get();
-        }
-      } else if (arg instanceof WritableConstantShortObjectInspector) {
-        ShortWritable value = ((WritableConstantShortObjectInspector) arg).getWritableConstantValue();
-
-        if (value != null) {
-          ret = value.get();
-        }
-      } else if (arg instanceof ConstantObjectInspector) {
-        Object value = ((ConstantObjectInspector) arg).getWritableConstantValue();
-
-        if (value != null) {
-          String strValue = value.toString();
-
-          if (strValue != null && strValue.length() > 0) {
-            ret = Integer.parseInt(value.toString());
-          }
-        }
-      }
-    }
-
-    return ret;
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskFirstN.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskFirstN.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskFirstN.java
deleted file mode 100644
index 24c0988..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskFirstN.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-
-
-@Description(name = "mask_first_n",
-             value = "masks the first n characters of the value",
-             extended = "Examples:\n "
-                      + "  mask_first_n(ccn, 8)\n "
-                      + "  mask_first_n(ccn, 8, 'x', 'x', 'x')\n "
-                      + "Arguments:\n "
-                      + "  mask(value, charCount, upperChar, lowerChar, digitChar, otherChar, numberChar)\n "
-                      + "    value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR\n "
-                      + "    charCount  - number of characters. Default value: 4\n "
-                      + "    upperChar  - character to replace upper-case characters with. Specify -1 to retain original character. Default value: 'X'\n "
-                      + "    lowerChar  - character to replace lower-case characters with. Specify -1 to retain original character. Default value: 'x'\n "
-                      + "    digitChar  - character to replace digit characters with. Specify -1 to retain original character. Default value: 'n'\n "
-                      + "    otherChar  - character to replace all other characters with. Specify -1 to retain original character. Default value: -1\n "
-                      + "    numberChar - character to replace digits in a number with. Valid values: 0-9. Default value: '1'\n "
-            )
-public class RangerUdfMaskFirstN extends RangerBaseUdf {
-  public static final String UDF_NAME = "mask_first_n";
-
-  public RangerUdfMaskFirstN() {
-    super(new MaskFirstNTransformer(), UDF_NAME);
-  }
-}
-
-class MaskFirstNTransformer extends MaskTransformer {
-  int charCount = 4;
-
-  public MaskFirstNTransformer() {
-    super();
-  }
-
-  @Override
-  public void init(ObjectInspector[] arguments, int argsStartIdx) {
-    super.init(arguments, argsStartIdx + 1); // first argument is charCount, which is consumed in this method below
-
-    charCount = getIntArg(arguments, argsStartIdx, 4);
-
-    if(charCount < 0) {
-      charCount = 0;
-    }
-  }
-
-  @Override
-  String transform(final String value) {
-    final StringBuilder ret    = new StringBuilder(value.length());
-    final int           endIdx = value.length() < charCount ? value.length() : charCount;
-
-    for(int i = 0; i < endIdx; i++) {
-      ret.appendCodePoint(transformChar(value.charAt(i)));
-    }
-
-    for(int i = endIdx; i < value.length(); i++) {
-      ret.appendCodePoint(value.charAt(i));
-    }
-
-    return ret.toString();
-  }
-
-  @Override
-  Byte transform(final Byte value) {
-    byte val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(byte v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to retain from the end
-    final int retainCount = digitCount < charCount ? 0 : (digitCount - charCount);
-
-    byte ret = 0;
-    int  pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= retainCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { //retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Short transform(final Short value) {
-    short val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(short v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to retain from the end
-    final int retainCount = digitCount < charCount ? 0 : (digitCount - charCount);
-
-    short ret = 0;
-    int   pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= retainCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Integer transform(final Integer value) {
-    int val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(int v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to retain from the end
-    final int retainCount = digitCount < charCount ? 0 : (digitCount - charCount);
-
-    int ret = 0;
-    int pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= retainCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Long transform(final Long value) {
-    long val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(long v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to retain from the end
-    final int retainCount = digitCount < charCount ? 0 : (digitCount - charCount);
-
-    long ret = 0;
-    long pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= retainCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskHash.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskHash.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskHash.java
deleted file mode 100644
index 02ead75..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskHash.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-import java.sql.Date;
-
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-
-
-@Description(name = "mask_hash",
-             value = "returns hash of the given value",
-             extended = "Examples:\n "
-                      + "  mask_hash(value)\n "
-                      + "Arguments:\n "
-                      + "  value - value to mask. Supported types: STRING, VARCHAR, CHAR"
-            )
-public class RangerUdfMaskHash extends RangerBaseUdf {
-  public static final String UDF_NAME = "mask_hash";
-
-  public RangerUdfMaskHash() {
-    super(new MaskHashTransformer(), UDF_NAME);
-  }
-}
-
-class MaskHashTransformer extends AbstractTransformer {
-  @Override
-  public void init(ObjectInspector[] arguments, int startIdx) {
-  }
-
-  @Override
-  String transform(final String value) {
-    return DigestUtils.sha256Hex(value);
-  }
-
-  @Override
-  Byte transform(final Byte value) {
-    return null;
-  }
-
-  @Override
-  Short transform(final Short value) {
-    return null;
-  }
-
-  @Override
-  Integer transform(final Integer value) {
-    return null;
-  }
-
-  @Override
-  Long transform(final Long value) {
-    return null;
-  }
-
-  @Override
-  Date transform(final Date value) {
-    return null;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskLastN.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskLastN.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskLastN.java
deleted file mode 100644
index 554dc91..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskLastN.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-
-
-@Description(name = "mask_last_n",
-             value = "masks the last n characters of the value",
-             extended = "Examples:\n "
-                      + "  mask_last_n(ccn, 8)\n "
-                      + "  mask_last_n(ccn, 8, 'x', 'x', 'x')\n "
-                      + "Arguments:\n "
-                      + "  mask_last_n(value, charCount, upperChar, lowerChar, digitChar, otherChar, numberChar)\n "
-                      + "    value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR\n "
-                      + "    charCount  - number of characters. Default value: 4\n "
-                      + "    upperChar  - character to replace upper-case characters with. Specify -1 to retain original character. Default value: 'X'\n "
-                      + "    lowerChar  - character to replace lower-case characters with. Specify -1 to retain original character. Default value: 'x'\n "
-                      + "    digitChar  - character to replace digit characters with. Specify -1 to retain original character. Default value: 'n'\n "
-                      + "    otherChar  - character to replace all other characters with. Specify -1 to retain original character. Default value: -1\n "
-                     + "     numberChar - character to replace digits in a number with. Valid values: 0-9. Default value: '1'\n "
-            )
-public class RangerUdfMaskLastN extends RangerBaseUdf {
-  public static final String UDF_NAME = "mask_last_n";
-
-  public RangerUdfMaskLastN() {
-    super(new MaskLastNTransformer(), UDF_NAME);
-  }
-}
-
-class MaskLastNTransformer extends MaskTransformer {
-  int charCount = 4;
-
-  public MaskLastNTransformer() {
-    super();
-  }
-
-  @Override
-  public void init(ObjectInspector[] arguments, int argsStartIdx) {
-    super.init(arguments, argsStartIdx + 1); // first argument is charCount, which is consumed in this method below
-
-    charCount = getIntArg(arguments, argsStartIdx, 4);
-
-    if(charCount < 0) {
-      charCount = 0;
-    }
-  }
-
-  @Override
-  String transform(final String value) {
-    final StringBuilder ret      = new StringBuilder(value.length());
-    final int           startIdx = value.length() <= charCount ? 0 : (value.length() - charCount);
-
-    for(int i = 0; i < startIdx; i++) {
-      ret.appendCodePoint(value.charAt(i));
-    }
-
-    for(int i = startIdx; i < value.length(); i++) {
-      ret.appendCodePoint(transformChar(value.charAt(i)));
-    }
-
-    return ret.toString();
-  }
-
-  @Override
-  Byte transform(final Byte value) {
-    byte val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    byte ret = 0;
-    int  pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { //retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Short transform(final Short value) {
-    short val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    short ret = 0;
-    int   pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Integer transform(final Integer value) {
-    int val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    int ret = 0;
-    int pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Long transform(final Long value) {
-    long val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    long ret = 0;
-    long pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowFirstN.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowFirstN.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowFirstN.java
deleted file mode 100644
index 24929b7..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowFirstN.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-
-
-@Description(name = "mask_show_first_n",
-             value = "masks all but first n characters of the value",
-             extended = "Examples:\n "
-                      + "  mask_show_first_n(ccn, 8)\n "
-                      + "  mask_show_first_n(ccn, 8, 'x', 'x', 'x')\n "
-                      + "Arguments:\n "
-                      + "  mask_show_first_n(value, charCount, upperChar, lowerChar, digitChar, otherChar, numberChar)\n "
-                      + "    value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR\n "
-                      + "    charCount  - number of characters. Default value: 4\n "
-                      + "    upperChar  - character to replace upper-case characters with. Specify -1 to retain original character. Default value: 'X'\n "
-                      + "    lowerChar  - character to replace lower-case characters with. Specify -1 to retain original character. Default value: 'x'\n "
-                      + "    digitChar  - character to replace digit characters with. Specify -1 to retain original character. Default value: 'n'\n "
-                      + "    otherChar  - character to replace all other characters with. Specify -1 to retain original character. Default value: -1\n "
-                      + "    numberChar - character to replace digits in a number with. Valid values: 0-9. Default value: '1'\n "
-            )
-public class RangerUdfMaskShowFirstN extends RangerBaseUdf {
-  public static final String UDF_NAME = "mask_show_first_n";
-
-  public RangerUdfMaskShowFirstN() {
-    super(new MaskShowFirstNTransformer(), UDF_NAME);
-  }
-}
-
-class MaskShowFirstNTransformer extends MaskTransformer {
-  int charCount = 4;
-
-  public MaskShowFirstNTransformer() {
-    super();
-  }
-
-  @Override
-  public void init(ObjectInspector[] arguments, int argsStartIdx) {
-    super.init(arguments, argsStartIdx + 1); // first argument is charCount, which is consumed here
-
-    charCount = getIntArg(arguments, argsStartIdx, 4);
-
-    if(charCount < 0) {
-      charCount = 0;
-    }
-  }
-
-  @Override
-  String transform(final String value) {
-    if(value.length() <= charCount) {
-      return value;
-    }
-
-    final StringBuilder ret = new StringBuilder(value.length());
-
-    for(int i = 0; i < charCount; i++) {
-      ret.appendCodePoint(value.charAt(i));
-    }
-
-    for(int i = charCount; i < value.length(); i++) {
-      ret.appendCodePoint(transformChar(value.charAt(i)));
-    }
-
-    return ret.toString();
-  }
-
-  @Override
-  Byte transform(final Byte value) {
-    byte val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(byte v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to mask from the end
-    final int maskCount = digitCount - charCount;
-
-    if(maskCount <= 0) {
-      return value;
-    }
-
-    byte ret = 0;
-    int  pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < maskCount) { // mask this digit
-        ret += (maskedNumber * pos);
-      } else { //retain this digit
-        ret += ((val % 10) * pos);
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Short transform(final Short value) {
-    short val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(short v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to mask from the end
-    final int maskCount = digitCount - charCount;
-
-    if(maskCount <= 0) {
-      return value;
-    }
-
-    short ret = 0;
-    int   pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < maskCount) { // mask this digit
-        ret += (maskedNumber * pos);
-      } else { // retain this digit
-        ret += ((val % 10) * pos);
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Integer transform(final Integer value) {
-    int val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(int v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to mask from the end
-    final int maskCount = digitCount - charCount;
-
-    if(maskCount <= 0) {
-      return value;
-    }
-
-    int ret = 0;
-    int pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < maskCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += ((val % 10) * pos);
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Long transform(final Long value) {
-    long val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    // count number of digits in the value
-    int digitCount = 0;
-    for(long v = val; v != 0; v /= 10) {
-      digitCount++;
-    }
-
-    // number of digits to mask from the end
-    final int maskCount = digitCount - charCount;
-
-    if(maskCount <= 0) {
-      return value;
-    }
-
-    long ret = 0;
-    long pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i < maskCount) { // mask this digit
-        ret += (maskedNumber * pos);
-      } else { // retain this digit
-        ret += ((val % 10) * pos);
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ranger/blob/e7d8dea8/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowLastN.java
----------------------------------------------------------------------
diff --git a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowLastN.java b/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowLastN.java
deleted file mode 100644
index d3db2af..0000000
--- a/ranger-hive-utils/src/main/java/org/apache/ranger/authorization/hive/udf/RangerUdfMaskShowLastN.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
- * 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 org.apache.ranger.authorization.hive.udf;
-
-import org.apache.hadoop.hive.ql.exec.Description;
-import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
-
-
-@Description(name = "mask_show_last_n",
-             value = "masks all but last n characters of the value",
-             extended = "Examples:\n "
-                      + "  mask_show_last_n(ccn, 8)\n "
-                      + "  mask_show_last_n(ccn, 8, 'x', 'x', 'x')\n "
-                      + "Arguments:\n "
-                      + "  mask_show_last_n(value, charCount, upperChar, lowerChar, digitChar, otherChar, numberChar)\n "
-                      + "    value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR\n "
-                      + "    charCount  - number of characters. Default value: 4\n "
-                      + "    upperChar  - character to replace upper-case characters with. Specify -1 to retain original character. Default value: 'X'\n "
-                      + "    lowerChar  - character to replace lower-case characters with. Specify -1 to retain original character. Default value: 'x'\n "
-                      + "    digitChar  - character to replace digit characters with. Specify -1 to retain original character. Default value: 'n'\n "
-                      + "    otherChar  - character to replace all other characters with. Specify -1 to retain original character. Default value: -1\n "
-                      + "    numberChar - character to replace digits in a number with. Valid values: 0-9. Default value: '1'\n "
-            )
-public class RangerUdfMaskShowLastN extends RangerBaseUdf {
-  public static final String UDF_NAME = "mask_show_last_n";
-
-  public RangerUdfMaskShowLastN() {
-    super(new MaskShowLastNTransformer(), UDF_NAME);
-  }
-}
-
-class MaskShowLastNTransformer extends MaskTransformer {
-  int charCount = 4;
-
-  public MaskShowLastNTransformer() {
-    super();
-  }
-
-  @Override
-  public void init(ObjectInspector[] arguments, int argsStartIdx) {
-    super.init(arguments, argsStartIdx + 1); // first argument is charCount, which is consumed in this method below
-
-    charCount = getIntArg(arguments, argsStartIdx, 4);
-
-    if(charCount < 0) {
-      charCount = 0;
-    }
-  }
-
-
-  @Override
-  String transform(final String value) {
-    if(value.length() <= charCount) {
-      return value;
-    }
-
-    final StringBuilder ret    = new StringBuilder(value.length());
-    final int           endIdx = value.length() - charCount;
-
-    for(int i = 0; i < endIdx; i++) {
-      ret.appendCodePoint(transformChar(value.charAt(i)));
-    }
-
-    for(int i = endIdx; i < value.length(); i++) {
-      ret.appendCodePoint(value.charAt(i));
-    }
-
-    return ret.toString();
-  }
-
-  @Override
-  Byte transform(final Byte value) {
-    byte val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    byte ret = 0;
-    int  pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { //retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Short transform(final Short value) {
-    short val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    short ret = 0;
-    int   pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Integer transform(final Integer value) {
-    int val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    int ret = 0;
-    int pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= charCount) { // mask this digit
-        ret += maskedNumber * pos;
-      } else { // retain this digit
-        ret += (val % 10) * pos;
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-
-  @Override
-  Long transform(final Long value) {
-    long val = value;
-
-    if(value < 0) {
-      val *= -1;
-    }
-
-    long ret = 0;
-    long pos = 1;
-    for(int i = 0; val != 0; i++) {
-      if(i >= charCount) { // mask this digit
-        ret += (maskedNumber * pos);
-      } else { // retain this digit
-        ret += ((val % 10) * pos);
-      }
-
-      val /= 10;
-      pos *= 10;
-    }
-
-    if(value < 0) {
-      ret *= -1;
-    }
-
-    return ret;
-  }
-}


Mime
View raw message