Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • @Description: provides metadata to Hive about the function a UDF's syntax and usage. Only classes with this annotation will be included in the generated class-registration.sql
  • @HivePdkUnitTests: enumerates one or more test cases, and also specifies optional setup and cleanup commands to run before and after the test cases.
  • @HivePdkUnitTest: specifies one test case, consisting of the query to run and the expected result

Annotations allow the code and tests to be kept close together. This is good for small tests; if your tests are very complicated, you may want to set up your own scripting around the Hive CLI.

Test Execution

The PDK executes tests as follows:

  1. Run top-level cleanup.sql (in case a previous test failed in the middle)
  2. Run top-level setup.sql
  3. For each class with @HivePdkUnitTests annotation
    1. Run class cleanup (if any)
    2. Run class setup (if any)
    3. For each @HivePdkUnitTest annotation
      1. Run query
    4. Run class cleanup (if any)
  4. Run top-level cleanup.sql