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
(addr text)¶ 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
(addr inet4) 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
(addr text, code text)¶ 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
(addr inet4, code text) 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