@Override
  public void configure(MapredContext context) {
    if (context instanceof TezContext) {
      taskId = ((TezContext)context).getTezProcessorContext().getTaskIndex();
    } else {
      throw new IllegalStateException("surrogate_key function is only supported if the execution engine is Tez");
    }

    if (taskId > maxTaskId) {
      throw new IllegalStateException(String.format("Task ID is out of range (%d bits) in surrogate_key", taskIdBits));
    }
  }
This function is not a deterministic function, and not a runtime constant.
The return value is sequence within a query with a unique staring point based on write_id and task_id
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFSurrogateKey.java