Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 4b75710

Browse files
committed
updated od4h samples
1 parent 2c9381d commit 4b75710

17 files changed

+46
-99
lines changed

samples/od4h_samples/Readme_OTA4H_Demo.txt renamed to samples/od4h_samples/Readme_OD4H_Demo.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
INTRODUCTION
33
=============
44

5-
The demo illustrates a simple use case of Oracle Table Access for Hadoop and
6-
Spark. It creates Hive external tables with different table properties to query
5+
The demo illustrates a simple use case of Oracle Datasource for Apache Hadoop.
6+
It creates Hive external tables with different table properties to query
77
Oracle Tables. We use simple and partition based splitters issue queries that
88
do predicate pushdown while executing.
99

@@ -18,7 +18,7 @@ System Requirements
1818
HOW TO RUN
1919
==========
2020

21-
1. Extract ota4h_demo.zip to any location. Bash scripts to create tables and
21+
1. Extract od4h_samples.zip to any location. Bash scripts to create tables and
2222
run queries are located under shell directory.
2323

2424
2. Execute createOracleTables.sh to create staging Oracle tables. You may have
@@ -31,3 +31,6 @@ table for a PDB user.
3131

3232
5. Use Apache/Cloudera tools to set logging levels and check out the queries
3333
generated by Oracle Storage Handler for querying Oracle tables.
34+
35+
6. Movieplex demo contains scripts under shell directory to use OutputFormat
36+
to write the result of a join query to a hive external table.

samples/od4h_samples/od4h_basic_demos/data/EmployeeData.log

-60
This file was deleted.

samples/od4h_samples/od4h_basic_demos/shell/createHiveTables.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/createHiveTables.sh /main/1 2015/03/20 13:52:02 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_basic_demos/shell/createHiveTables.sh ratiwary_od4h_demos/2 2018/01/19 05:07:14 ratiwary Exp $
44
#
55
# createHiveTables.sh
66
#
7-
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# createHiveTables.sh
@@ -42,4 +42,6 @@ SHELL_DIR=`dirname "$0"`
4242
DEMO_DIR=`cd "../"; pwd`
4343
cd ${DEMO_DIR}/sql
4444

45+
# Storing password in plain text is not recommended. OD4H recommends using
46+
# strong password authentication like Kerberos
4547
hive -i hive_init.hql -f CreateEmployeeDataHive.hql -hiveconf connection_string="$conn_string" -hiveconf oracle_user=$username -hiveconf oracle_pwd=$password

samples/od4h_samples/od4h_basic_demos/shell/createOracleTable.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/createOracleTable.sh /main/1 2015/03/20 13:52:02 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_basic_demos/shell/createOracleTable.sh ratiwary_od4h_demos/2 2018/01/19 05:07:14 ratiwary Exp $
44
#
55
# createOracleTable.sh
66
#
7-
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# createOracleTable.sh
@@ -30,6 +30,7 @@ SHELL_DIR=`dirname "$0"`
3030
DEMO_DIR=`cd "../"; pwd`
3131
cd ${DEMO_DIR}/sql
3232

33+
export TWO_TASK=orcl
3334
echo "Enter password for the User"
3435
sqlplus -S $username/ @CreateEmployeeData.sql;
3536

samples/od4h_samples/od4h_basic_demos/shell/joinQuery.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/joinQuery.sh ratiwary_osh_newsplitters_outputformat/2 2016/03/05 06:41:50 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_basic_demos/shell/joinQuery.sh ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
44
#
55
# joinQueryHive.sh
66
#
7-
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# joinQueryHive.sh

samples/od4h_samples/od4h_basic_demos/shell/partitionPruningQuery.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/partitionPruningQuery.sh ratiwary_osh_newsplitters_outputformat/1 2016/03/05 06:41:51 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_basic_demos/shell/partitionPruningQuery.sh ratiwary_od4h_demos/2 2018/01/11 01:45:07 ratiwary Exp $
44
#
55
# partitionPruningQueryHive.sh
66
#
7-
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# partitionPruningQueryHive.sh
@@ -38,7 +38,7 @@ if [ $choice -eq 1 ]; then
3838
hive -i hive_init.hql -e "${QUERY}"
3939
elif [ $choice -eq 2 ]; then
4040
echo "sqlContext.sql(\""${QUERY}"\").show();System.exit(0);" > query.scala
41-
spark-shell --jars /opt/oracle/od4h/jlib/osh.jar,/opt/oracle/od4h/jlib/ojdbc7.jar,/opt/oracle/od4h/jlib/ucp.jar -i query.scala
41+
spark-shell --jars /opt/oracle/od4h/jlib/osh.jar,/opt/oracle/od4h/jlib/ojdbc8.jar,/opt/oracle/od4h/jlib/ucp.jar -i query.scala
4242
rm query.scala
4343
else
4444
echo "Invalid input"

samples/od4h_samples/od4h_basic_demos/shell/partitionQuery.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/partitionQuery.sh ratiwary_osh_newsplitters_outputformat/1 2016/03/05 06:41:50 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_basic_demos/shell/partitionQuery.sh ratiwary_od4h_demos/2 2018/01/11 01:45:07 ratiwary Exp $
44
#
55
# partitionQueryHive.sh
66
#
7-
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# partitionQueryHive.sh
@@ -38,7 +38,7 @@ if [ $choice -eq 1 ]; then
3838
hive -i hive_init.hql -e "${QUERY}"
3939
elif [ $choice -eq 2 ]; then
4040
echo "sqlContext.sql(\""${QUERY}"\").show();System.exit(0);" > query.scala
41-
spark-shell --jars /opt/oracle/od4h/jlib/osh.jar,/opt/oracle/od4h/jlib/ojdbc7.jar,/opt/oracle/od4h/jlib/ucp.jar -i query.scala
41+
spark-shell --jars /opt/oracle/od4h/jlib/osh.jar,/opt/oracle/od4h/jlib/ojdbc8.jar,/opt/oracle/od4h/jlib/ucp.jar -i query.scala
4242
rm query.scala
4343
else
4444
echo "Invalid Input"

samples/od4h_samples/od4h_basic_demos/shell/simpleQuery.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/simpleQuery.sh ratiwary_osh_newsplitters_outputformat/1 2016/03/05 06:41:50 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_basic_demos/shell/simpleQuery.sh ratiwary_od4h_demos/3 2018/01/19 05:07:14 ratiwary Exp $
44
#
55
# simpleQueryHive.sh
66
#
7-
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# simpleQueryHive.sh
@@ -33,10 +33,10 @@ cd ${DEMO_DIR}/sql
3333

3434
QUERY="select First_Name, Last_Name from EmployeeDataSimple where Emp_ID=39332"
3535
if [ $choice -eq 1 ]; then
36-
hive -i hive_init.hql -e "${QUERY}"
36+
hive -i hive_init.hql -e "${QUERY}"
3737
elif [ $choice -eq 2 ]; then
3838
echo "sqlContext.sql(\""${QUERY}"\").show();System.exit(0);" > query.scala
39-
spark-shell --jars /opt/oracle/od4h/jlib/osh.jar,/opt/oracle/od4h/jlib/ojdbc7.jar,/opt/oracle/od4h/jlib/ucp.jar -i query.scala
39+
spark-shell --jars /opt/oracle/od4h/jlib/osh.jar,/opt/oracle/od4h/jlib/ojdbc8.jar,/opt/oracle/od4h/jlib/ucp.jar -i query.scala
4040
rm query.scala
4141
else
4242
echo "Invalid Input"

samples/od4h_samples/od4h_basic_demos/sql/CreateEmployeeData.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Rem
2-
Rem $Header: hadoop/demo/osh/sql/CreateEmployeeData.sql ratiwary_osh_newsplitters_outputformat/1 2016/01/19 05:23:49 ratiwary Exp $
2+
Rem $Header: hadoop/demo/od4h_samples/od4h_basic_demos/sql/CreateEmployeeData.sql ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
33
Rem
44
Rem CreateEmployeeData.sql
55
Rem
6-
Rem Copyright (c) 2015, 2016, Oracle and/or its affiliates.
6+
Rem Copyright (c) 2015, 2018, Oracle and/or its affiliates.
77
Rem All rights reserved.
88
Rem
99
Rem NAME

samples/od4h_samples/od4h_basic_demos/sql/CreateEmployeeDataHive.hql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--
2-
-- $Header: hadoop/demo/osh/sql/CreateEmployeeDataHive.hql ratiwary_osh_newsplitters_outputformat/2 2016/01/19 05:57:36 ratiwary Exp $
2+
-- $Header: hadoop/demo/od4h_samples/od4h_basic_demos/sql/CreateEmployeeDataHive.hql ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
33
--
44
-- CreateEmployeeDataHive.hql
55
--
6-
-- Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
6+
-- Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
77
--
88
-- NAME
99
-- CreateEmployeeDataHive.hql

samples/od4h_samples/od4h_basic_demos/sql/hive_init.hql

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--
2-
-- $Header: hadoop/demo/osh/sql/hive_init.hql ratiwary_osh_newsplitters_outputformat/1 2016/02/08 05:53:41 ratiwary Exp $
2+
-- $Header: hadoop/demo/od4h_samples/od4h_basic_demos/sql/hive_init.hql ratiwary_od4h_demos/2 2018/01/11 01:45:07 ratiwary Exp $
33
--
44
-- hive_init.hql
55
--
6-
-- Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
6+
-- Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
77
--
88
-- NAME
99
-- hive_init.hql
@@ -17,5 +17,5 @@
1717
--
1818

1919
add jar /opt/oracle/od4h/jlib/osh.jar;
20-
add jar /opt/oracle/od4h/jlib/ojdbc7.jar;
20+
add jar /opt/oracle/od4h/jlib/ojdbc8.jar;
2121
add jar /opt/oracle/od4h/jlib/ucp.jar;

samples/od4h_samples/od4h_movieplex_demo/shell/createHiveTable.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/createHiveTables.sh /main/1 2015/03/20 13:52:02 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_movieplex_demo/shell/createHiveTable.sh ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
44
#
55
# createHiveTables.sh
66
#
7-
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# createHiveTables.sh

samples/od4h_samples/od4h_movieplex_demo/shell/createOracleTable.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/createOracleTable.sh /main/1 2015/03/20 13:52:02 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_movieplex_demo/shell/createOracleTable.sh ratiwary_od4h_demos/2 2018/01/19 05:07:14 ratiwary Exp $
44
#
55
# createOracleTable.sh
66
#
7-
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# createOracleTable.sh
@@ -30,5 +30,6 @@ SHELL_DIR=`dirname "$0"`
3030
DEMO_DIR=`cd "../"; pwd`
3131
cd ${DEMO_DIR}/sql
3232

33+
export TWO_TASK=orcl
3334
echo "Enter password for the User"
3435
sqlplus -S $username/ @CreateMovieData.sql;

samples/od4h_samples/od4h_movieplex_demo/shell/insertQuery.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
#
3-
# $Header: hadoop/demo/osh/shell/joinQuery.sh ratiwary_osh_newsplitters_outputformat/2 2016/03/05 06:41:50 ratiwary Exp $
3+
# $Header: hadoop/demo/od4h_samples/od4h_movieplex_demo/shell/insertQuery.sh ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
44
#
55
# joinQueryHive.sh
66
#
7-
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
7+
# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
88
#
99
# NAME
1010
# joinQueryHive.sh

samples/od4h_samples/od4h_movieplex_demo/sql/CreateMovieData.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Rem
2-
Rem $Header: hadoop/demo/osh/sql/CreateMovieData.sql ratiwary_osh_newsplitters_outputformat/1 2016/01/19 05:23:49 ratiwary Exp $
2+
Rem $Header: hadoop/demo/od4h_samples/od4h_movieplex_demo/sql/CreateMovieData.sql ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
33
Rem
44
Rem CreateMovieData.sql
55
Rem
6-
Rem Copyright (c) 2015, 2016, Oracle and/or its affiliates.
6+
Rem Copyright (c) 2015, 2018, Oracle and/or its affiliates.
77
Rem All rights reserved.
88
Rem
99
Rem NAME

samples/od4h_samples/od4h_movieplex_demo/sql/CreateMovieDataHive.hql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--
2-
-- $Header: hadoop/demo/osh/sql/CreateMovieDataHive.hql ratiwary_osh_newsplitters_outputformat/2 2016/01/19 05:57:36 ratiwary Exp $
2+
-- $Header: hadoop/demo/od4h_samples/od4h_movieplex_demo/sql/CreateMovieDataHive.hql ratiwary_od4h_demos/1 2018/01/11 01:40:05 ratiwary Exp $
33
--
44
-- CreateMovieDataHive.hql
55
--
6-
-- Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
6+
-- Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
77
--
88
-- NAME
99
-- CreateMovieDataHive.hql

samples/od4h_samples/od4h_movieplex_demo/sql/hive_init.hql

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
--
2-
-- $Header: hadoop/demo/osh/sql/hive_init.hql ratiwary_osh_newsplitters_outputformat/1 2016/02/08 05:53:41 ratiwary Exp $
2+
-- $Header: hadoop/demo/od4h_samples/od4h_movieplex_demo/sql/hive_init.hql ratiwary_od4h_demos/2 2018/01/11 01:45:07 ratiwary Exp $
33
--
44
-- hive_init.hql
55
--
6-
-- Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
6+
-- Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
77
--
88
-- NAME
99
-- hive_init.hql
@@ -17,5 +17,5 @@
1717
--
1818

1919
add jar /opt/oracle/od4h/jlib/osh.jar;
20-
add jar /opt/oracle/od4h/jlib/ojdbc7.jar;
20+
add jar /opt/oracle/od4h/jlib/ojdbc8.jar;
2121
add jar /opt/oracle/od4h/jlib/ucp.jar;

0 commit comments

Comments
 (0)