def execute_udf(key, package_name, function_name, args=[], options = nil)
      policy = create_policy(options, WritePolicy, default_write_policy)

      command = ExecuteCommand.new(@cluster, policy, key, package_name, function_name, args)
      execute_command(command)

      record = command.record

      return nil if !record || record.bins.empty?

      result_map = record.bins

      # User defined functions don't have to return a value.
      key, obj = result_map.detect{ |k, _| k.include?('SUCCESS') }
      return obj if key

      key, obj = result_map.detect{ |k, _| k.include?('FAILURE') }
      message = key ? obj.to_s : "Invalid UDF return value"
      raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::UDF_BAD_RESPONSE, message)
    end
def execute_udf(key, package_name, function_name, args=[], options = nil)
      policy = create_policy(options, WritePolicy, default_write_policy)

      command = ExecuteCommand.new(@cluster, policy, key, package_name, function_name, args)
      execute_command(command)

      record = command.record

      return nil if !record || record.bins.empty?

      result_map = record.bins

      # User defined functions don't have to return a value.
      key, obj = result_map.detect{ |k, _| k.include?('SUCCESS') }
      return obj if key

      key, obj = result_map.detect{ |k, _| k.include?('FAILURE') }
      message = key ? obj.to_s : "Invalid UDF return value"
      raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::UDF_BAD_RESPONSE, message)
    end
Execute user defined function on server and return results.
  The function operates on a single record.
  The package name is used to locate the udf file location:

  udf file = <server udf dir>/<package name>.lua

  This method is only supported by Aerospike 3 servers.