Creating Netezza User Defined Functions in C++

STEPS TO CREATE NETEZZA UDF

For creating UDF in netezza we should have knowledge of C++ programming. The post explains how to create netezza UDF which finds greater value out of two values passed.
STEP 1 :
Write C++ code for the function. The code refers the the below header files.
#include "udxinc.h"
#include "udxhelpers.h"
 And namespace list is mentioned below
using namespace nz::udx::dthelpers;
using namespace nz::udx;
The sample code for the greater of two numbers is mentioned below.
#include "udxinc.h"
#include "udxhelpers.h"
#include <ctype.h>
using namespace nz::udx;

class greaterOfTwo : public Udf
{

  public:
    static Udf* instantiate();

    virtual ReturnValue evaluate()
    {
      int64 first = int64Arg(0);
      int64 second = int64Arg(1);

      int64 returnValue = 0;

      if (first > second) returnValue = first; else returnValue = second;

      NZ_UDX_RETURN_INT64(returnValue);
    }
};

Udf* greaterOfTwo::instantiate()
{
  return new greaterOfTwo();
}


STEP 2:
We use the netezza command line utility (nzudxcompile) to compile the C++ code. The sample code to compile the C++ code is mentioned below.


NZ_DATABASE=MYDB;
nzudxcompile -g --sig "greaterOfTwo(bigint,bigint)" --return "bigint" --class greaterOfTwo /export/home/user/mydata/greatest.cpp
 

NETEZZA SYLLABUS

NETEZZA PERFORMANCE SERVER
  1. INTRODUCTION
  2. NPS ARCHITECTURE
  3. INTRODUCTIONS TO TOOLS
  4. PERFORMANCE SERVER ADMINISTRATOR (INTRODUCTION)
  5. INTRODUCTION TO NPS ENVIRONMENT
  6. DATABASE , TABLES , SYNONYMS, VIEWS
  7. UDX (UDF AND UDA)
  8. ZONE MAPS and EXTENTS
  9. DATA DISTRIBUTION 
  10. DATA TYPES
  11. SEQUENCES
  12. TRANSACTIONS
  13. LOADING AND UNLOADING TABLES (NZLOAD , EXTERNAL TABLES)
  14. GENERATE STATISTICS
  15. OPTIMIZER AND QUERY PLAN
  16. MATERIALIZED VIEW
  17. NZRECLAIM - GROOMING
  18. BACKUP AND RESTORE
  19. LOADING DATA USING SSIS PACKAGES

श्री हनुमान चालीसा (Sri Hanuman Chalisa)

श्री हनुमान चालीसा दोहा श्रीगुरु चरन सरोज रज, निजमन मुकुरु सुधारि। बरनउं रघुबर बिमल जसु, जो दायक फल चारि।। बुद्धिहीन तनु जानिके, सुमिरौं पवन...