<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: pass-through to hadoop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684042#M207246</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Thanks for helping me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When im using the libname with simple sql (without the calculated column age as i shown in previous example) it works fine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Find attach the error from the proc sql query&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20200912_223359.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49386iB1BAAC5E0A820506/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG_20200912_223359.jpg" alt="IMG_20200912_223359.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2020 19:33:17 GMT</pubDate>
    <dc:creator>jony123</dc:creator>
    <dc:date>2020-09-15T19:33:17Z</dc:date>
    <item>
      <title>pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/683897#M207183</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I tried to run this code and got out of memory error: connet time out exception&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table bda.temp as&lt;/P&gt;&lt;P&gt;select a.*, (today()-input( substr( date,1,10),yymmdd10.))/365 as age&lt;/P&gt;&lt;P&gt;from&amp;nbsp;bda.aaa as a&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now i&amp;nbsp; want to try do it with pass-through to hadoop and create the age calculation by using hive functions&lt;/P&gt;&lt;P&gt;can someone share with me some code? i am pretty new to this kind of feature&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 09:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/683897#M207183</guid>
      <dc:creator>jony123</dc:creator>
      <dc:date>2020-09-15T09:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684003#M207226</link>
      <description>&lt;P&gt;Before you invest too much time into it, can you connect?&amp;nbsp; If you can't connect via a Libname, then it's unlikely that you will be able to connect using explicit pass through SQL.&amp;nbsp; I think the connection issue is the first priority.&amp;nbsp; A Timeout could just be a lack of resources, so connect should be tried at different junctures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, explicit pass through SQL is often a better option with Hadoop than regular Proc SQL with a Libname, so let me dig up some code for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 17:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684003#M207226</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-15T17:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684012#M207229</link>
      <description>&lt;P&gt;OK, here's the first bit of code.&amp;nbsp; This is a Libname statement.&amp;nbsp; Yes, I know you want explicit pass through code.&amp;nbsp; I'll get to that in a minute.&amp;nbsp; First, I'd like to see what's going on with your connection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTION SASTRACE=',,,ds' SASTRACELOC=saslog nostsuffix;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;
%MACRO	Allo_Hadoop(Libname, Host, Port, Schema, User, Password, Subprotocol=hive2);
	LIBNAME 	&amp;amp;Libname	HADOOP
		SERVER		=	&amp;amp;Host
		PORT		=	&amp;amp;Port
		SCHEMA		=	&amp;amp;Schema
		USER		=	&amp;amp;SysuserID 
		PASSWORD	=	"&amp;amp;Password" 
		SUBPROTOCOL	=	&amp;amp;Subprotocol
		PROPERTIES	=	"mapred.job.queue.name=root.ctm_q1.dev_sq1"
		;
%MEND	Allo_Hadoop;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;%Allo_Hadoop(&amp;amp;Lib, Host=apvrp817, Port=10486, Schema=Rsc1, User=&amp;amp;SysuserID, Password=&amp;amp;Password);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post your Libname as well?&amp;nbsp; And &lt;EM&gt;&lt;STRONG&gt;exactly&lt;/STRONG&gt;&lt;/EM&gt; which error are you getting?&amp;nbsp; Would you please post the log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then some very simple SQL.&amp;nbsp; Yes, this is very very simple SQL.&amp;nbsp; If it doesn't work with simple SQL, then it won't work with complex SQL, so please try (after you've allocated a Libname) running the below SQL and posting the log with any errors.&amp;nbsp; You'll need to specify the Libname and the Table name.&amp;nbsp; Also please set these options before you run your Libname or SQL code:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTION SASTRACE=',,,ds' SASTRACELOC=saslog nostsuffix ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	%LET	Lib		=	XXXXXX;
	%LET	Table	=	YYYYYY;

	PROC	SQL;
		SELECT	COUNT(1)	AS	Row_Count	FORMAT=COMMA22.	
			INTO	:			Row_Count
			FROM	&amp;amp;Lib..&amp;amp;Table;
	QUIT;

	%PUT	NOTE:  &amp;amp;Lib..&amp;amp;Table rows=%QCMPRES(&amp;amp;Row_Count);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please try a Libname and the above count SQL and post the log for them.&amp;nbsp; Let's see if we can figure out what's going on with the connection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, let me go dig up some explicit pass through code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 17:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684012#M207229</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-15T17:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684015#M207231</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/235130"&gt;@jony123&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, here's some explicit pass through code.&amp;nbsp; Please try to get the Libname/regular Proc SQL code I posted previously first, and then let's try this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS	SASTRACE	=	",,,ds";
OPTIONS	SASTRACELOC	=	SASLOG;
OPTIONS	NOSTSUFFIX;
OPTIONS	MsgLevel	=	I;

**------------------------------------------------------------------------------**;

%LET	Conn	=	Hdp_Conn;
%LET	SAS_Eng	=	HADOOP;

%LET	Engine	=	MR;
*%LET	Engine	=	Spark;
*%LET	Engine	=	Tez;


%LET	W_Queue	=	root.analyt_sq1;
%LET	L_Queue	=	root.dev_sq1;

**------------------------------------------------------------------------------**;

%IF	%QUPCASE(&amp;amp;SAS_Eng)		=	HADOOP	%THEN
	%DO;
		%LET	Type		=	Lnx_JDBC;
		%LET	Connect		=	%NRSTR(SERVER		=	&amp;amp;Host
										PORT		=	&amp;amp;Port
										SCHEMA		=	&amp;amp;Schema
										USER		=	&amp;amp;SysuserID 
										PASSWORD	=	"&amp;amp;Password" 
										SUBPROTOCOL	=	Hive2);
	%END;
%ELSE
	%DO;
		%LET	Type		=	Win_ODBC;
		%LET	Connect		=	%NRSTR(NOPROMPT		=	"uid=&amp;amp;SysuserID; 
														pwd=&amp;amp;PASSWORD;
														host=&amp;amp;host;	
														dsn=&amp;amp;DSN; 
														schema=&amp;amp;Schema;
														port=&amp;amp;port; 
														authmech=3");
	%END;

**------------------------------------------------------------------------------**;

PROC	SQL;
	CONNECT	TO	&amp;amp;SAS_Eng	AS	&amp;amp;Conn	(&amp;amp;Connect);

	EXECUTE(set	hive.resultset.use.unique.column.names		=	FALSE) 							BY	&amp;amp;Conn;

	%IF	%QUPCASE(&amp;amp;SAS_Eng)									=	HADOOP	%THEN
		%DO;
			EXECUTE(set	mapred.job.queue.name				=	&amp;amp;L_Queue)						BY	&amp;amp;Conn;
		%END;
	%ELSE
		%DO;
			EXECUTE(set	mapred.job.queue.name				=	&amp;amp;W_Queue)						BY	&amp;amp;Conn;
		%END;

	EXECUTE(set	hive.execution.engine						=	&amp;amp;Engine) 						BY	&amp;amp;Conn;

	EXECUTE(set	mapred.job.name								=	&amp;amp;Type._Mems_Mem_Prov_Rel)		BY	&amp;amp;Conn;

	CREATE	TABLE	WORK.Provs_Mem_Prov_Rel					AS
		SELECT	*	
			FROM	CONNECTION	TO	&amp;amp;Conn					(
				SELECT	COUNT(1)
					FROM			&amp;amp;Schema..ALL_MEMBERS
					);

	DISCONNECT	FROM	&amp;amp;Conn;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The explicit pass through code above may look a little complicated, but it's not really too bad.&amp;nbsp; I connect from different machines, so I use macro variables to control the parameters depending on which machine I'm running on.&amp;nbsp; Many of these macro variables can be left as is, but you'll need to add %LET statements to set the value of:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Password&lt;/LI&gt;
&lt;LI&gt;Host&lt;/LI&gt;
&lt;LI&gt;Schema&lt;/LI&gt;
&lt;LI&gt;DSN&lt;/LI&gt;
&lt;LI&gt;Port&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;But first, let's get your connection working with a Libname and regular Proc SQL, then let's try the explicit pass through code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 18:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684015#M207231</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-15T18:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684042#M207246</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Thanks for helping me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When im using the libname with simple sql (without the calculated column age as i shown in previous example) it works fine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Find attach the error from the proc sql query&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20200912_223359.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49386iB1BAAC5E0A820506/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG_20200912_223359.jpg" alt="IMG_20200912_223359.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 19:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684042#M207246</guid>
      <dc:creator>jony123</dc:creator>
      <dc:date>2020-09-15T19:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684045#M207248</link>
      <description>&lt;P&gt;Thank you for posting your log.&amp;nbsp; I was thinking that since it was just text that you could copy it into your reply, but a photo works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, a simple SQL command works but a more complex one does not?&amp;nbsp; Fascinating.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you see the "NOTE:?"&amp;nbsp; It says "Validate the contents of the Hadoop configuration file and ensure user permissions are correct."&amp;nbsp; I suspect that this is the problem, i.e. that it is a permissions problem.&amp;nbsp; You should definitely talk to your Data Architecture or Hadoop DBA group (or whatever it is called at your workplace) and describe the problem and have them look into it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the mean time, though, now that we've diagnosed the "connection" problem a bit (actually it looks more like a permissions problem now that I've seen your log), it's time to try the explicit pass through SQL.&amp;nbsp; Part of why I had you set your options to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OPTIONS	SASTRACE		=	",,,ds";
OPTIONS	SASTRACELOC		=	SASLOG;
OPTIONS	NOSTSUFFIX;
OPTIONS	MsgLevel		=	I;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;was so that we could see what SAS was doing behind the scenes.&amp;nbsp; If you scroll up a bit, you'll see that SAS is trying to create some kind of intermediate work table -- and failing.&amp;nbsp; The simple counts query probably doesn't need any intermediate tables, so it runs fine, but when SAS determines that an intermediate table is required (as in this case), your query fails.&amp;nbsp; This is consistent with a permissions problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is where explicit pass through SQL comes in really handy.&amp;nbsp; When using regular Proc SQL, we don't have much choice about what SAS passes to Hadoop.&amp;nbsp; However, with explicit pass through, we have a great deal more control.&amp;nbsp; Please, now let's try the explicit pass through code that I gave you.&amp;nbsp; First, let's get the simple query I gave you working, then let's try using date functions.&amp;nbsp; However, note:&amp;nbsp; SAS date functions and Hadoop date functions may differ slightly.&amp;nbsp; Even if we get the explicit pass through code working, you should still get the permissions issue taken care of so that you can use regular Proc SQL and SAS functions instead of having to figure out Hadoop functions and adjust for their differences.&amp;nbsp; SAS has already identified and compensated for the differences in date functions when using Proc SQL with a Hadoop Libname, so we will want to used this already tested and de-bugged code from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try the explicit pass through code and let me know how it goes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 19:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684045#M207248</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-15T19:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684052#M207250</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;Our&amp;nbsp; DBA needs to sent me those parameters&amp;nbsp; first&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Password&lt;/LI&gt;&lt;LI&gt;Host&lt;/LI&gt;&lt;LI&gt;Schema&lt;/LI&gt;&lt;LI&gt;DSN&lt;/LI&gt;&lt;LI&gt;Port&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;after that&amp;nbsp; i will run the simple query and let you know whats going on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for helping me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 19:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684052#M207250</guid>
      <dc:creator>jony123</dc:creator>
      <dc:date>2020-09-15T19:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: pass-through to hadoop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684057#M207253</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/235130"&gt;@jony123&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're welcome.&amp;nbsp; Not every one of those parameters will be necessary for every environment.&amp;nbsp; Some environments are, for example, set up to not use passwords but use Kerberos (or something similar) for security.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many of those parameters may already be on your Libname.&amp;nbsp; If one of the parameters I listed is not on the Libname, you may not need that parameter in your environment.&amp;nbsp; If the DBA takes a long time to get back to you, you could try connecting with what parameters you have and see what happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 20:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pass-through-to-hadoop/m-p/684057#M207253</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-15T20:07:10Z</dc:date>
    </item>
  </channel>
</rss>

