1 PACKAGE DBMS_HADOOP
2 AUTHID CURRENT_USER
3 IS
4 --
5 -- NAME
6 -- CREATE_EXTDDL_FOR_HIVE
7 --
8 -- DESCRIPTION
9 -- Declaration for the CREATE_EXTDDL_FOR_HIVE procedure. This procedure
10 -- allows one to generate the CREATE EXTERNAL TABLE ... DDL statement for
11 -- a given Hive table. The procedure invokes a pipelined C function
12 -- (getHiveTable()), which in turns fetches the necessary metadata from
13 -- the concerned hive metastore via JNI calls. The metadata pieces from
14 -- Hive are assembled to generate a syntatically correct CREATE EXTERNAL
15 -- TABLE statement.
16 --
17 -- PARAMETERS
18 -- CLUSTER_ID - The hadoop cluster id where the hive table is located.
19 -- DB_NAME - The database name where the hive table belongs to.
20 -- HIVE_TABLE_NAME - The name of the hive table, for which the CREATE
21 -- EXTERNAL TABLE statement is being generated
22 -- HIVE_PARTITION - This is a boolean value, indicating whether the hive
23 -- table partitions need to be included in the CREATE
24 -- EXTERNAL TABLE statement
25 -- TABLE_NAME - If TABLE_NAME is NULL, then the HIVE_TABLE_NAME will be
26 -- the name of the Oracle external table. Otherwise,
27 -- TABLE_NAME will be the name of the Oracle external
28 -- table
29 -- PERFORM_DDL - This is a boolean value, indicating whether to execute
30 -- the generated DDL on Oracle and immediately create
31 -- an external table
32 -- TEXT_OF_DDL - This is the output of the procedure, where the
33 -- generated CREATE EXTERNAL TABLE ... statement is stored
34 --
35 -- RETURNS
36 -- NONE
37 --
38 -- EXCEPTIONS
39 -- HIVE_TABLE_NOT_FOUND
40 -- INVALID_USER
41 -- INVALID_CLUSTER
42 --
43
44 PROCEDURE CREATE_EXTDDL_FOR_HIVE(
45 CLUSTER_ID IN VARCHAR2,
46 DB_NAME IN VARCHAR2,
47 HIVE_TABLE_NAME IN VARCHAR2,
48 HIVE_PARTITION IN BOOLEAN,
49 TABLE_NAME IN VARCHAR2,
50 PERFORM_DDL IN BOOLEAN := FALSE,
51 TEXT_OF_DDL OUT CLOB
52 );
53
54
55 FUNCTION GET_USER_MAP(cluster_name IN VARCHAR2 DEFAULT '[DEFAULT]',
56 current_database_user IN VARCHAR2) -- NOT NULL
57 RETURN VARCHAR2;
58
59
60 END DBMS_HADOOP;