Skip to content

Commit 3193c63

Browse files
author
王平10304955
committed
Add SFTP support to gpfdist for data ingestion
Feature:Supporting the Loading of bz Format Files gpfdist, Cloudberry's parallel file distribution program, traditionally required data files to be co-located with the gpfdist process. This limitation made it cumbersome to load data from remote servers, often requiring an extra data transfer step. This commit extends gpfdist to support the SFTP protocol, enabling users to ingest data directly from remote servers. This enhancement streamlines ETL workflows by allowing `CREATE EXTERNAL TABLE` to specify SFTP locations. Key change information: Implement the loading of .bz2 files by utilizing the read functions provided by the libssh2 library. Add SFTP support to gpfdist for data ingestion Feature:Supporting the Loading of bz(bz2) Format Files gpfdist, Cloudberry's parallel file distribution program, traditionally required data files to be co-located with the gpfdist process. This limitation made it cumbersome to load data from remote servers, often requiring an extra data transfer step. This commit extends gpfdist to support the SFTP protocol, enabling users to ingest data directly from remote servers. This enhancement streamlines ETL workflows by allowing `CREATE EXTERNAL TABLE` to specify SFTP locations. Key change information: Implement the loading of .bz2 files by utilizing the read functions provided by the libssh2 library.
1 parent ecf10ac commit 3193c63

File tree

1 file changed

+11
-2
lines changed
  • src/backend/utils/misc/fstream

1 file changed

+11
-2
lines changed

src/backend/utils/misc/fstream/gfile.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,17 @@ bz_file_read(gfile_t *fd, void *ptr, size_t len)
241241

242242
while (z->in_size < sizeof z->in)
243243
{
244-
s = read_and_retry(fd, z->in + z->in_size, sizeof z->in
245-
- z->in_size);
244+
if (fd->is_sftp)
245+
{
246+
#ifdef LIBSSH2
247+
gfile_printf_then_putc_newline("sftp_read : Read bz files from an SFTP server");
248+
s = sftp_read(fd, z->in + z->in_size, sizeof z->in - z->in_size);
249+
#endif
250+
}
251+
252+
else
253+
s = read_and_retry(fd, z->in + z->in_size, sizeof z->in
254+
- z->in_size);
246255
if (s == 0)
247256
break;
248257
if (s < 0)

0 commit comments

Comments
 (0)