Network Functions and Operators¶
Prerequisites¶
Apache Tajo provides network functions and operations using GeoIP databases. To use these functions and operations, the GeoIP database should be precedently installed in local disks of all the workers. (Please refer the install instruction in http://dev.maxmind.com/geoip/legacy/downloadable/)
Once the GeoIP database is installed, you should specify the install location in conf/tajo-site.xml as follows.
<property>
<name>tajo.function.geoip-database-location</name>
<value>/path/to/geoip/database/file</value>
</property>
Supported Functions¶
- geoip_country_code(string addr)¶
Convert an ipv4 address string to a geoip country code.
Parameters: addr – ipv4 address string Return type: text Example: select geoip_country_code('163.152.71.31') > 'KR'
- geoip_country_code(inet4 addr)
Convert an ipv4 address to a geoip country code.
Parameters: addr – ipv4 address Return type: text Example: select geoip_country_code(163.152.71.31) > 'KR'
- geoip_in_country(string addr, string code)¶
If the given country code is same with the country code of the given address, it returns true. Otherwise, returns false.
Parameters: - addr – ipv4 address string
- code – country code
Return type: boolean
Example: select geoip_in_country('163.152.71.31', 'KR') > true
- geoip_in_country(inet4 addr, string code)
If the given country code is same with the country code of the given address, it returns true. Otherwise, returns false.
Parameters: - addr – ipv4 address
- code – country code
Return type: boolean
Example: select geoip_in_country(163.152.71.31, 'KR') > true