/tags/release-0.0.0-rc0/hive/external/contrib/src/test/queries/clientpositive/udaf_example_max_n.q

# · text · 14 lines · 10 code · 4 blank · 0 comment · 0 complexity · 16cf33d5ee8c1d47553dc0437a026821 MD5 · raw file

  1. add jar ${system:build.dir}/hive-contrib-${system:hive.version}.jar;
  2. CREATE TEMPORARY FUNCTION example_max_n AS 'org.apache.hadoop.hive.contrib.udaf.example.UDAFExampleMaxN';
  3. EXPLAIN
  4. SELECT example_max_n(substr(value,5),10),
  5. example_max_n(IF(substr(value,5) > 250, NULL, substr(value,5)),10)
  6. FROM src;
  7. SELECT example_max_n(substr(value,5),10),
  8. example_max_n(IF(substr(value,5) > 250, NULL, substr(value,5)),10)
  9. FROM src;
  10. DROP TEMPORARY FUNCTION example_max_n;