
- Apache Tajo Tutorial
- Apache Tajo - Home
- Apache Tajo - Introduction
- Apache Tajo - Architecture
- Apache Tajo - Installation
- Apache Tajo - Configuration Settings
- Apache Tajo - Shell Commands
- Apache Tajo - Data Types
- Apache Tajo - Operators
- Apache Tajo - SQL Functions
- Apache Tajo - Math Functions
- Apache Tajo - String Functions
- Apache Tajo - DateTime Functions
- Apache Tajo - JSON Functions
- Apache Tajo - Database Creation
- Apache Tajo - Table Management
- Apache Tajo - SQL Statements
- Aggregate & Window Functions
- Apache Tajo - SQL Queries
- Apache Tajo - Storage Plugins
- Integration with HBase
- Apache Tajo - Integration with Hive
- OpenStack Swift Integration
- Apache Tajo - JDBC Interface
- Apache Tajo - Custom Functions
- Apache Tajo Useful Resources
- Apache Tajo - Quick Guide
- Apache Tajo - Useful Resources
- Apache Tajo - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Apache Tajo - Custom Functions
Apache Tajo supports the custom / user defined functions (UDFs). The custom functions can be created in python.
The custom functions are just plain python functions with decorator “@output_type(<tajo sql datatype>)” as follows −
@ouput_type(“integer”) def sum_py(a, b): return a + b;
The python scripts with UDFs can be registered by adding the below configuration in “tajosite.xml”.
<property> <name>tajo.function.python.code-dir</name> <value>file:///path/to/script1.py,file:///path/to/script2.py</value> </property>
Once the scripts are registered, restart the cluster and the UDFs will be available right in the SQL query as follows −
select sum_py(10, 10) as pyfn;
Apache Tajo supports user defined aggregate functions as well but does not support user defined window functions.
Advertisements