BookmarkSubscribeRSS Feed
johny
Calcite | Level 5

I would like to write a table in sas to hadoop. How do I write. My current code...

 

proc sql;
connect to hadoop (user=john password=xxxxx server="myhadoopmachine.public.com" port=10000 SCHEMA=hiveSchema subprotocol=hive2 dbmax_text=300 CFG="/opt/sas/myhadoopmachine/myhadoopmachine_core_hdfs_site.xml");
execute ( create table hivelib.mytable as
select *
from saslib.mytable
) by hadoop ;

 

 

results in error:

 

ERROR: Execute error: Error while compiling statement: FAILED: SemanticException [Error 10001]: Line 1:49 Table not found 'mytable'

 

The basic issue is that I can execute sql command on hive. The above expects the saslib.mytable to be on hadoop server under the schema saslib.mytable.  saslib.mytable is my sas lib with table name mylib. 

 

How do I pass this information in the above proc sql to copy the sas data set to hadoop.

 

Thanks,

 

John

 

 

 

2 REPLIES 2
brusso
SAS Employee

John,

 

it doesn't look like your procedure is complete in your example. See this techniques in processing in Hadoop paper, it has a few examples using proc sql;

 

https://support.sas.com/resources/papers/proceedings14/SAS033-2014.pdf 

 

It has this sample code to write to hadoop using proc sql that might help;

 

proc sql; connect to hadoop (server=duped user=myUserID);

execute (create table myUserID_store_cnt row format delimited fields terminated by '\001' stored as textfile as select customer_rk, count(*) as total_orders from order_fact group by customer_rk) by hadoop;

disconnect from hadoop;

quit;

 

 

LinusH
Tourmaline | Level 20
If your source data resides in SAS (outside hadoop) you can't use explicit pass through, Hive is not aware of SAS data.
For most situations a simple create table on a Hive Libref is sufficient.
Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1376 views
  • 0 likes
  • 3 in conversation