Class

com.precisely.bigdata.addressing.spark.api

UDFBuilder

Related Doc: package api

Permalink

class UDFBuilder extends AnyRef

This class allows you to build a UDF that executes an addressing operation. You can obtain an instance of this builder by starting with an AddressingBuilder.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. UDFBuilder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def forCustomExecutor(addressingExecutor: AddressingExecutor): UserDefinedFunction

    Permalink

    Build a UDF to execute a custom Addressing operation on an address, based on the provided configuration options.

    Build a UDF to execute a custom Addressing operation on an address, based on the provided configuration options. This UDF has a single argument that is a map of String to Column. The String keys are the address fields that are to be populated in the RequestAddress, and the column is the value to populate the fields with.

    This example uses the returned UDF as "customUdf" and adds an "addressing_result" column to the DataFrame

    val resultDataFrame = inputDataFrame.withColumn("addressing_result",
      customUdf(map(
        lit("addressNumber"), col("addressNum"),
        lit("street"), col("street"),
        lit("city"), col("city"),
        lit("admin1"), col("state"),
        lit("postalCode"), col("zip"),
        lit("country"), col("country"))
      ))
    returns

    A UDF that executes a custom Addressing operation.

  10. def forGeocode(): UserDefinedFunction

    Permalink

    Build a UDF to geocode an address, based on the provided configuration options.

    Build a UDF to geocode an address, based on the provided configuration options. This UDF has a single argument that is a map of String to Column. The String keys are the address fields that are to be populated in the RequestAddress, and the column is the value to populate the fields with.

    This example uses the returned UDF as "addressingUdf" and adds an "addressing_result" column to the DataFrame:

    val resultDataFrame = inputDataFrame.withColumn("addressing_result",
      addressingUdf(map(
        lit("addressNumber"), col("addressNum"),
        lit("street"), col("street"),
        lit("city"), col("city"),
        lit("admin1"), col("state"),
        lit("postalCode"), col("zip"),
        lit("country"), col("country"))
      ))
    returns

    A UDF that executes the geocode operation of the Addressing API.

  11. def forLookup(): UserDefinedFunction

    Permalink

    Build a UDF to lookup a geocoded candidates when given a unique key, based on the provided configuration options.

    Build a UDF to lookup a geocoded candidates when given a unique key, based on the provided configuration options. This UDF takes two arguments, lookupType Key type- it can be GNAF_PID or PBKEY, Key to search and country.

    This example uses the returned UDF as "addressingUdf" and adds an "addressing_result" column to the DataFrame:

    val resultDataFrame = inputDataFrame.withColumn("addressing_result",
      addressingUdf(lit("PB_KEY"),
      col("key"),
      lit("USA")
      ))
    returns

    A UDF that provides a Key Lookup operation.

  12. def forReverseGeocode(): UserDefinedFunction

    Permalink

    Build a UDF to reverse geocode a location, based on the provided configuration options.

    Build a UDF to reverse geocode a location, based on the provided configuration options. This UDF takes X and Y coordinates of location to reverse geocode with optional country parameter.

    This example uses the returned UDF as "addressingUdf" and adds an "addressing_result" column to the DataFrame:

    val resultDataFrame = inputDataFrame.withColumn("addressing_result",
      addressingUdf(
        col("x"),
        col("y"),
        col("country"))
      )
    returns

    A UDF that executes the reverse geocode operation of the Addressing API.

  13. def forVerify(): UserDefinedFunction

    Permalink

    Build a UDF to verify an address, based on the provided configuration options.

    Build a UDF to verify an address, based on the provided configuration options. This UDF has a single argument that is a map of String to Column. The String keys are the address fields that are to be populated in the RequestAddress, and the column is the value to populate the fields with.

    This example uses the returned UDF as "addressingUdf" and adds an "addressing_result" column to the DataFrame:

    val resultDataFrame = inputDataFrame.withColumn("addressing_result",
      addressingUdf(map(
        lit("addressNumber"), col("addressNum"),
        lit("street"), col("street"),
        lit("city"), col("city"),
        lit("admin1"), col("state"),
        lit("postalCode"), col("zip"),
        lit("country"), col("country"))
      ))
    returns

    A UDF that provides a verify operation.

  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. def withErrorField(errorOutputFieldName: String): UDFBuilder

    Permalink

    Adds an output field for errors.

    Adds an output field for errors. Exceptions during processing of a record are caught and then the message is placed in this output field.

    errorOutputFieldName

    The name for the field in the output that any error message is placed.

  26. def withMultipleResults(): UDFBuilder

    Permalink

    Changes the output of the UDF from a single row of output fields, taken from the top candidate, to an array of rows of output fields, one for each result in the response.

    Changes the output of the UDF from a single row of output fields, taken from the top candidate, to an array of rows of output fields, one for each result in the response. Note: In order to get back multiple results, preferences must be set to allow that.

  27. def withOutputFields(fieldNames: String*): UDFBuilder

    Permalink

    Adds output fields for the UDF.

    Adds output fields for the UDF. Allows you to access any part of the Addressing API Result class. You can use a simple object notation to access sub objects:

    Accessing properties:

    • Use property name, case of first letter is flexible, i.e. "score" would return the value in Result.score
    • Accessing nested properties can be done using a period, i.e. "address.formattedAddress" would return the value in Result.address.formattedAddress

      Accessing Lists and Arrays:
    • Use index values in square brackets, i.e. "addressLines[0]" would return the first element of Result.addressLines

      Accessing Maps:
    • Use square brackets and string literal values, i.e. "parsed['ggs']" would return the value associated with 'ggs' in the Result.parsed map

      While evaluating the object notation any nulls encountered along the path will cause a null value to be returned. A property that isn't found will result in an error.

      The output field notation also allows aliasing:
    • You can use a simple 'as' syntax with an alpha numeric alias, i.e. "address.formattedAddress as address" would have an output field name of 'address'
    • If you need special characters in the output field name you can use a quoted literal for the alias, i.e. "address.formattedAddress as 'formatted_address'" would have an output field name of 'formatted_address'
    fieldNames

    The object notation access field names, which will also be the UDF output field names.

  28. def withPreferences(preferences: Preferences): UDFBuilder

    Permalink

    Sets the preferences that will be used for all geocode calls.

    Sets the preferences that will be used for all geocode calls.

    preferences

    A preferences instance.

  29. def withPreferencesFile(file: String): UDFBuilder

    Permalink

    Sets the location of a yaml configuration file with the desired preferences.

    Sets the location of a yaml configuration file with the desired preferences. Any specific preferences set in this yaml will override the preferences provided by withPreferences

    file

    The location of a yaml configuration file.

  30. def withResultAsJSON(jsonOutputFieldName: String): UDFBuilder

    Permalink

    Adds an output field for Json response.

    Adds an output field for Json response. Exceptions during processing of a record are caught and then the message is placed in the error field.

    jsonOutputFieldName

    The name for the field in the output where that json Response is placed.

Inherited from AnyRef

Inherited from Any

Ungrouped