From 3500cbea89ff299d55303617466672f575d73da2 Mon Sep 17 00:00:00 2001 From: mdayakar Date: Thu, 10 Sep 2026 12:27:43 +0530 Subject: [PATCH 1/2] HIVE-29850: Remove HOST command from HPLSQL --- content/docs/latest/language/hplsql/_index.md | 9 ---- .../hplsql/built-in-variables/hostcode.md | 29 ---------- .../hplsql/statements/copy-from-ftp.md | 32 ----------- .../hplsql/statements/copy-from-local.md | 45 ---------------- .../latest/language/hplsql/statements/copy.md | 1 - .../latest/language/hplsql/statements/host.md | 53 ------------------- .../hplsql/statements/insert-directory.md | 1 - .../hplsql/user-guide/configuration.md | 2 +- .../hplsql/user-guide/error-handling.md | 2 +- 9 files changed, 2 insertions(+), 172 deletions(-) delete mode 100644 content/docs/latest/language/hplsql/built-in-variables/hostcode.md delete mode 100644 content/docs/latest/language/hplsql/statements/copy-from-ftp.md delete mode 100644 content/docs/latest/language/hplsql/statements/copy-from-local.md delete mode 100644 content/docs/latest/language/hplsql/statements/host.md diff --git a/content/docs/latest/language/hplsql/_index.md b/content/docs/latest/language/hplsql/_index.md index 4281765a..20640bad 100644 --- a/content/docs/latest/language/hplsql/_index.md +++ b/content/docs/latest/language/hplsql/_index.md @@ -62,7 +62,6 @@ Initially it was provided as a stand alone command line tool. As a part of ([HIV | Name | Description | | --- | --- | | [ACTIVITY_COUNT]({{< ref "activity_count" >}}) | Number of rows affected by last SQL statement | -| [HOSTCODE]({{< ref "hostcode" >}}) | Return code of the last OS command | | [SQLCODE]({{< ref "sqlcode" >}}) | Return code of the last SQL statement | | [SQLSTATE]({{< ref "sqlstate" >}}) | Return status of the last SQL statement | @@ -77,8 +76,6 @@ Initially it was provided as a stand alone command line tool. As a part of ([HIV | [CLOSE]({{< ref "close" >}}) | Close a cursor | | [CMP]({{< ref "cmp" >}}) | Compare data in tables | | [COPY]({{< ref "copy" >}}) | Copy data between tables and files | -| [COPY FROM FTP]({{< ref "copy-from-ftp" >}}) | Copy FTP files to Hadoop compatible file system | -| [COPY FROM LOCAL]({{< ref "copy-from-local" >}}) | Copy local files to Hadoop compatible file system | | [CREATE DATABASE]({{< ref "create-database" >}}) | Create a database | | [CREATE FUNCTION]({{< ref "create-function" >}}) | Create a user-defined SQL function | | [CREATE LOCAL TEMPORARY TABLE]({{< ref "create-local-temporary-table" >}}) | Create a session-level temporary table | @@ -100,7 +97,6 @@ Initially it was provided as a stand alone command line tool. As a part of ([HIV | [FOR cursor]({{< ref "for-cursor" >}}) | FOR statement (Cursor loop) | | [FOR range]({{< ref "for-range" >}}) | FOR statement (Integer range) | | [GET DIAGNOSTICS]({{< ref "get-diagnostics" >}}) | Get execution information | -| [HOST]({{< ref "host" >}}) | Execute an OS command or run an external process | | [IF]({{< ref "if" >}}) | IF statement | | [INCLUDE]({{< ref "include" >}}) | Include statements from another script | | [INSERT]({{< ref "insert" >}}) | INSERT statement | @@ -167,11 +163,6 @@ Initially it was provided as a stand alone command line tool. As a part of ([HIV | [UPPER]({{< ref "upper" >}}) | Convert a string to upper case | | [USER]({{< ref "functions/user.md" >}}) | Get the current user name | -## Commands - -| Command | Description | -| --- | --- | -| [! cmd;]({{< ref "host" >}}) | Execute an OS command or run an external process | ## File I/O Operations diff --git a/content/docs/latest/language/hplsql/built-in-variables/hostcode.md b/content/docs/latest/language/hplsql/built-in-variables/hostcode.md deleted file mode 100644 index bb8282ff..00000000 --- a/content/docs/latest/language/hplsql/built-in-variables/hostcode.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Apache Hive : HPL/SQL - HOSTCODE" -date: 2026-08-12 ---- - -# Apache Hive : HPL/SQL - HOSTCODE - -HOSTCODE built-in variable contains the return code of the last OS command. - -``` -SET hplsql.onerror = SETERROR; - -HOST 'echo hello, world'; -IF HOSTCODE <> 0 THEN - PRINT 'Error'; -END IF; -``` - -**Notes**: - -- Typically HOSTCODE is 0 when the process terminated successfully, and 1 if it terminated with an error. -- By default [hplsql.onerror]({{< ref "configuration#hplsqlonerror" >}}) is set to EXCEPTION, so if the OS command cannot be executed (the process does not exist, no permissions i.e.) the exception is raised and you are not be able to check HOSTCODE in IF statement. - -For more information, see [Error Handling]({{< ref "error-handling" >}}). - -**Compatibility:** HPL/SQL Extension. - -**See also:** -- [SQLCODE]({{< ref "sqlcode" >}}) diff --git a/content/docs/latest/language/hplsql/statements/copy-from-ftp.md b/content/docs/latest/language/hplsql/statements/copy-from-ftp.md deleted file mode 100644 index 89e0308b..00000000 --- a/content/docs/latest/language/hplsql/statements/copy-from-ftp.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "Apache Hive : HPL/SQL - COPY FROM FTP Statement" -date: 2026-08-12 ---- - -# Apache Hive : HPL/SQL - COPY FROM FTP Statement - -COPY FROM FTP statement allows to copy files from a FTP server to local or any Hadoop compatible file system. Using this statement you can easily copy FTP subdirectories into HDFS i.e. - -The NEW option helps you build a ETL process and download only new files from FTP. - -**Syntax**: - -``` -COPY FROM FTP host [USER user [PWD password]] [DIR directory] [FILES files_wildcard] - [TO [LOCAL] target_directory] [options] - -options: - OVERWRITE | NEW - SUBDIR - SESSIONS num -``` - -Notes: -- *host, user* and *pwd* specify the FTP host name, user name and password (identifier, string literal, variable or expression can be specified). -- DIR option specifies the directory to get files, optional. If skipped, the current working FTP directory is used -- FILES option specifies a wildcard (Java regular expression) to choose which files to transfer. By default, all files from the specified directory are transferred. -- LOCAL keyword means that files are copied to the local file system. By default files are copied to HDFS compatible file system. -- OVERWRITE means that the existing files will be overwritten, this is the default. -- NEW means that only new files will be transferred, and existing files will be skipped. -- SUBDIR option specifies to transfer files in sub-directories. The directory structure is recreated in the target. By default, the command transfers files only from the directory specified by DIR option. -- SESSIONS specifies the number of concurrent FTP sessions to transfer the files. Each session transfers the whole file. By default, files are copied in the single session. diff --git a/content/docs/latest/language/hplsql/statements/copy-from-local.md b/content/docs/latest/language/hplsql/statements/copy-from-local.md deleted file mode 100644 index cfee65ef..00000000 --- a/content/docs/latest/language/hplsql/statements/copy-from-local.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Apache Hive : HPL/SQL - COPY FROM LOCAL Statement" -date: 2026-08-12 ---- - -# Apache Hive : HPL/SQL - COPY FROM LOCAL Statement - -COPY FROM LOCAL statement allows to copy local directories and files to Hadoop compatible file system. Using this statement you can easily copy subdirectories into HDFS i.e. - -**Syntax**: - -``` -COPY FROM LOCAL src [, src2, ...] TO tgt [options] - -options: - OVERWRITE - DELETE - IGNORE -``` - -Notes: - -- *srcN* specifies a file or directory. If a directory is specified all subdirectories and their files are copied as well. -- *srcN* can be an expression, variable, quoted or unquoted string. -- If a single file is copied *tgt* must specify a path including the target file name. -- If multiple files are copied *tgt* must specify a directory. -- If the target directory does not exist it is created. -- OVERWRITE specifies to overwrite the target files if they exist. -- DELETE specifies to delete the source file upon successfull copy. -- IGNORE specifies to ignore errors when copying a file and proceed to copy the remaining files. - -**Example**: - -Copy files from a directory and its subdirectories to a daily backup directory: - -``` -COPY FROM LOCAL '/home/data' TO '/user/backup/' || CURRENT_DATE; -``` - -**Compatibility:** HPL/SQL Extension - - - -See also: -- [COPY]({{< ref "copy" >}}) diff --git a/content/docs/latest/language/hplsql/statements/copy.md b/content/docs/latest/language/hplsql/statements/copy.md index fe24b32a..21b5c592 100644 --- a/content/docs/latest/language/hplsql/statements/copy.md +++ b/content/docs/latest/language/hplsql/statements/copy.md @@ -71,5 +71,4 @@ COPY sales.users TO sales.users2 AT tdconn; See also: -- [COPY FROM LOCAL]({{< ref "copy-from-local" >}}) - [INSERT DIRECTORY]({{< ref "insert-directory" >}}) diff --git a/content/docs/latest/language/hplsql/statements/host.md b/content/docs/latest/language/hplsql/statements/host.md deleted file mode 100644 index eedda32c..00000000 --- a/content/docs/latest/language/hplsql/statements/host.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "Apache Hive : HPL/SQL - Execute OS Command or External Process" -date: 2026-08-12 ---- - -# Apache Hive : HPL/SQL - Execute OS Command or External Process - -HPL/SQL allows you to execute an OS command or external process from a HPL/SQL script: - -**Syntax**: - -! command: - -``` -!cmd [arguments]; -``` - -HOST statement: - -``` -HOST string_expr -``` - -**Parameters:** - -| **Parameter** | **Description** | -| --- | --- | -| cmd | Any OS command or process | -| arguments | Optional argument list | -| string_expr | Command line for HOST statement | - -**Notes**: - -- Blank characters are allowed between ! and cmd -- The ! command must be terminated by a semicolon (;) - -**Example:** - -Using ! command: - -``` -!echo Hello, world; -``` - -Using HOST statement: - -``` -HOST 'echo Hello, world'; -``` - -**Compatibility**: Apache Hive (! command), Oracle (HOST statement). - - diff --git a/content/docs/latest/language/hplsql/statements/insert-directory.md b/content/docs/latest/language/hplsql/statements/insert-directory.md index a8dfc5bd..0bd83026 100644 --- a/content/docs/latest/language/hplsql/statements/insert-directory.md +++ b/content/docs/latest/language/hplsql/statements/insert-directory.md @@ -40,4 +40,3 @@ insert overwrite directory '/data/sales_' || current_date See also: - [COPY]({{< ref "copy" >}}) -- [COPY FROM LOCAL]({{< ref "copy-from-local" >}}) diff --git a/content/docs/latest/language/hplsql/user-guide/configuration.md b/content/docs/latest/language/hplsql/user-guide/configuration.md index c1959841..fcc1c634 100644 --- a/content/docs/latest/language/hplsql/user-guide/configuration.md +++ b/content/docs/latest/language/hplsql/user-guide/configuration.md @@ -272,7 +272,7 @@ The *hplsql.onerror* option defines how HPL/SQL handles errors. Values: - **exception** - HPL/SQL raises an exception when an error occurs. This is the default. -- **seterror** - HPL/SQL sets the error code to SQLCODE or HOSTCODE variables and continues execution +- **seterror** - HPL/SQL sets the error code to SQLCODE variables and continues execution - **stop** - HPL/SQL stops executing the script and exits. For more information, see [Error Handling]({{< ref "error-handling" >}}). diff --git a/content/docs/latest/language/hplsql/user-guide/error-handling.md b/content/docs/latest/language/hplsql/user-guide/error-handling.md index 8c49e740..49b6510e 100644 --- a/content/docs/latest/language/hplsql/user-guide/error-handling.md +++ b/content/docs/latest/language/hplsql/user-guide/error-handling.md @@ -13,7 +13,7 @@ In this case when an error occurs, HPL/SQL raises an exception. If there is an e - **Seterror** -When Seterror is specified, HPL/SQL sets the error code to SQLCODE or HOSTCODE variables and continues execution. +When Seterror is specified, HPL/SQL sets the error code to SQLCODE variables and continues execution. - **Stop** From f32ba1d12676abe47c2d52f58e628f47a6479cc7 Mon Sep 17 00:00:00 2001 From: mdayakar Date: Fri, 11 Sep 2026 21:56:17 +0530 Subject: [PATCH 2/2] HIVE-29850: Removed COPY command from HPLSQL --- content/docs/latest/language/hplsql/_index.md | 1 - .../latest/language/hplsql/statements/copy.md | 74 ------------------- .../hplsql/statements/insert-directory.md | 2 - 3 files changed, 77 deletions(-) delete mode 100644 content/docs/latest/language/hplsql/statements/copy.md diff --git a/content/docs/latest/language/hplsql/_index.md b/content/docs/latest/language/hplsql/_index.md index 20640bad..aad25f5d 100644 --- a/content/docs/latest/language/hplsql/_index.md +++ b/content/docs/latest/language/hplsql/_index.md @@ -75,7 +75,6 @@ Initially it was provided as a stand alone command line tool. As a part of ([HIV | [CALL]({{< ref "call" >}}) | Execute a stored procedure | | [CLOSE]({{< ref "close" >}}) | Close a cursor | | [CMP]({{< ref "cmp" >}}) | Compare data in tables | -| [COPY]({{< ref "copy" >}}) | Copy data between tables and files | | [CREATE DATABASE]({{< ref "create-database" >}}) | Create a database | | [CREATE FUNCTION]({{< ref "create-function" >}}) | Create a user-defined SQL function | | [CREATE LOCAL TEMPORARY TABLE]({{< ref "create-local-temporary-table" >}}) | Create a session-level temporary table | diff --git a/content/docs/latest/language/hplsql/statements/copy.md b/content/docs/latest/language/hplsql/statements/copy.md deleted file mode 100644 index 21b5c592..00000000 --- a/content/docs/latest/language/hplsql/statements/copy.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "Apache Hive : HPL/SQL - COPY Statement" -date: 2026-08-12 ---- - -# Apache Hive : HPL/SQL - COPY Statement - -COPY statement allows to transfer data between tables and files. Use it to transfer relatively small volumes of data i.e. query results, look-up and dimension tables. - -When you copy data between tables they can be located in different databases. - -**Syntax**: - -Export data to a file: - -``` -COPY table_name | (select_stmt) TO [HDFS] file_name [options] - -options: - DELIMITER 'char' -| SQLINSERT target_table_name -``` - -Copy data between existing tables: - -``` -COPY table_name | (select_stmt) TO target_table_name AT target_conn_name [options] - -options: - BATCHSIZE num -``` - -Notes: - -- *table_name* is an identifier. -- *file_name* can be an expression, quoted or unquoted string. -- If *file_name* already exists it is overwritten. -- When HDFS is specified, the data is copied to a HDFS-compatible file system. -- DELIMITER specifies the delimiter between column values, '\t' (TAB character) is the default. -- SQLINSERT specifies to generate SQL INSERT statements to insert data to *target_table_name*. The statements are just stored in the file, and not executed. -- When you copy data into another table, the table must exist. -- BATCHSIZE specifies the number of rows to transfer in a single batch when copying rows between tables, the default is 1000. - -**Example 1**: - -Export the query results to a file: - -``` -COPY (SELECT id, name FROM sales.users WHERE local_dt = CURRENT_DATE) - TO /data/users.txt DELIMITER '\t'; -``` - -**Example 2**: - -Generate SQL INSERT statements: - -``` -COPY sales.users TO /data/users2.sql SQLINSERT sales.users; -``` - -**Example 3**: - -Copy rows from between tables in different databases: - -``` -COPY sales.users TO sales.users2 AT tdconn; -``` - -**Compatibility:** HPL/SQL Extension, PostgreSQL - - - -See also: -- [INSERT DIRECTORY]({{< ref "insert-directory" >}}) diff --git a/content/docs/latest/language/hplsql/statements/insert-directory.md b/content/docs/latest/language/hplsql/statements/insert-directory.md index 0bd83026..5f131b9d 100644 --- a/content/docs/latest/language/hplsql/statements/insert-directory.md +++ b/content/docs/latest/language/hplsql/statements/insert-directory.md @@ -38,5 +38,3 @@ insert overwrite directory '/data/sales_' || current_date -See also: -- [COPY]({{< ref "copy" >}})