Skip to content
hdfs_fdw

hdfs_fdw

hdfs_fdw : foreign-data wrapper for remote hdfs servers

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
8740
hdfs_fdw
hdfs_fdw
2.3.3
FDW
PostgreSQL
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
pg_parquet
mongo_fdw
kafka_fdw
wrappers
multicorn
jdbc_fdw
aws_s3
duckdb_fdw

Package/source version 2.3.3; SQL extension version 2.0.5. Live queries require a compatible Hive JDBC driver and Hadoop/Hive service.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
MIXED
2.3.3
18
17
16
15
14
hdfs_fdw-
RPM
PGDG
2.3.3
18
17
16
15
14
hdfs_fdw_$v-
DEB
PIGSTY
2.3.3
18
17
16
15
14
postgresql-$v-hdfs-fdwdefault-jre-headless
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
el8.aarch64
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
el9.x86_64
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
el9.aarch64
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
el10.x86_64
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
el10.aarch64
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
PGDG 2.3.3
d12.x86_64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
d12.aarch64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
d13.x86_64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
d13.aarch64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
u22.x86_64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
u22.aarch64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
u24.x86_64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
u24.aarch64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
u26.x86_64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
u26.aarch64
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PIGSTY 2.3.3
PackageVersionOSORGSIZEFile URL
hdfs_fdw_182.3.3el8.x86_64pgdg116.2 KiBhdfs_fdw_18-2.3.3-1PGDG.rhel8.x86_64.rpm
hdfs_fdw_182.3.3el8.aarch64pgdg113.2 KiBhdfs_fdw_18-2.3.3-1PGDG.rhel8.aarch64.rpm
hdfs_fdw_182.3.3el9.x86_64pgdg115.1 KiBhdfs_fdw_18-2.3.3-3PGDG.rhel9.8.x86_64.rpm
hdfs_fdw_182.3.3el9.x86_64pgdg116.4 KiBhdfs_fdw_18-2.3.3-1PGDG.rhel9.x86_64.rpm
hdfs_fdw_182.3.3el9.aarch64pgdg113.1 KiBhdfs_fdw_18-2.3.3-3PGDG.rhel9.8.aarch64.rpm
hdfs_fdw_182.3.3el9.aarch64pgdg114.2 KiBhdfs_fdw_18-2.3.3-1PGDG.rhel9.aarch64.rpm
hdfs_fdw_182.3.3el10.x86_64pgdg115.9 KiBhdfs_fdw_18-2.3.3-3PGDG.rhel10.2.x86_64.rpm
hdfs_fdw_182.3.3el10.x86_64pgdg116.9 KiBhdfs_fdw_18-2.3.3-1PGDG.rhel10.x86_64.rpm
hdfs_fdw_182.3.3el10.aarch64pgdg114.4 KiBhdfs_fdw_18-2.3.3-3PGDG.rhel10.2.aarch64.rpm
hdfs_fdw_182.3.3el10.aarch64pgdg115.6 KiBhdfs_fdw_18-2.3.3-1PGDG.rhel10.aarch64.rpm
postgresql-18-hdfs-fdw2.3.3d12.x86_64pigsty100.8 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~bookworm_amd64.deb
postgresql-18-hdfs-fdw2.3.3d12.aarch64pigsty97.7 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~bookworm_arm64.deb
postgresql-18-hdfs-fdw2.3.3d13.x86_64pigsty101.0 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~trixie_amd64.deb
postgresql-18-hdfs-fdw2.3.3d13.aarch64pigsty98.1 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~trixie_arm64.deb
postgresql-18-hdfs-fdw2.3.3u22.x86_64pigsty109.6 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~jammy_amd64.deb
postgresql-18-hdfs-fdw2.3.3u22.aarch64pigsty108.2 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~jammy_arm64.deb
postgresql-18-hdfs-fdw2.3.3u24.x86_64pigsty104.2 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~noble_amd64.deb
postgresql-18-hdfs-fdw2.3.3u24.aarch64pigsty103.0 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~noble_arm64.deb
postgresql-18-hdfs-fdw2.3.3u26.x86_64pigsty103.2 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~resolute_amd64.deb
postgresql-18-hdfs-fdw2.3.3u26.aarch64pigsty102.5 KiBpostgresql-18-hdfs-fdw_2.3.3-1PIGSTY~resolute_arm64.deb

Source

pig build pkg hdfs_fdw;		# build deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install hdfs_fdw;		# install via package name, for the active PG version

pig install hdfs_fdw -v 18;   # install for PG 18
pig install hdfs_fdw -v 17;   # install for PG 17
pig install hdfs_fdw -v 16;   # install for PG 16
pig install hdfs_fdw -v 15;   # install for PG 15
pig install hdfs_fdw -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION hdfs_fdw;

Usage

hdfs_fdw: Foreign data wrapper for remote HDFS servers

Create Server

CREATE EXTENSION hdfs_fdw;

CREATE SERVER hdfs_server FOREIGN DATA WRAPPER hdfs_fdw
  OPTIONS (host '127.0.0.1', port '10000', client_type 'hiveserver2');

Server Options: host (default localhost), port (default 10000), client_type (hiveserver2 or spark, default hiveserver2), auth_type (NOSASL or LDAP), connect_timeout (default 300), fetch_size (default 10000), log_remote_sql (default false), use_remote_estimate (default false), enable_join_pushdown (default true), enable_aggregate_pushdown (default true), enable_order_by_pushdown (default true).

Create User Mapping

CREATE USER MAPPING FOR postgres SERVER hdfs_server
  OPTIONS (username 'hive_user', password 'hive_password');

For NOSASL authentication, omit the OPTIONS clause entirely.

Create Foreign Table

CREATE FOREIGN TABLE weblogs (
  client_ip text,
  http_status_code text,
  uri text,
  request_count bigint
)
SERVER hdfs_server
OPTIONS (dbname 'default', table_name 'weblogs');

Table Options: dbname (default default), table_name (defaults to foreign table name), enable_join_pushdown, enable_aggregate_pushdown, enable_order_by_pushdown.

Query

SELECT client_ip, count(*) FROM weblogs GROUP BY client_ip ORDER BY count(*) DESC LIMIT 10;

Spark Example

CREATE SERVER spark_server FOREIGN DATA WRAPPER hdfs_fdw
  OPTIONS (host '127.0.0.1', port '10000', client_type 'spark');

CREATE USER MAPPING FOR postgres SERVER spark_server
  OPTIONS (username 'spark_user', password 'spark_pass');

CREATE FOREIGN TABLE spark_table (
  id int,
  name text,
  value double precision
)
SERVER spark_server
OPTIONS (dbname 'default', table_name 'my_table');

Pushdown Features

hdfs_fdw pushes down WHERE clauses, JOINs, aggregate functions, ORDER BY, and LIMIT/OFFSET to the remote Hive/Spark server. Control pushdown at the session level:

SET hdfs_fdw.enable_join_pushdown = on;
SET hdfs_fdw.enable_aggregate_pushdown = on;
SET hdfs_fdw.enable_order_by_pushdown = on;
SET hdfs_fdw.enable_limit_pushdown = on;
Last updated on