BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JayS
Obsidian | Level 7

I'm fairly New to querying HADOOP data from SAS.
The below code returns 0 Obs, and I know there is a InsertDate of '01Aug2020'

Reading up, but have not found the solution as of yet.

 

I am using this driver... CLASS="com.cloudera.hive.jdbc.HS2Driver" 

Do I need to change the data type in order for HADOOP to resolve the string value.


TIA, Jay

 

proc sql;

*******************************************************************************

*** All the Connect To Hadoop Schema Table info works, I connect ***

*******************************************************************************

CREATE TABLE NewTable AS
SELECT *
FROM CONNECTION TO hadoop
/* file stored in HADOOP */
/*****************************/
( select * from HADOOPData
Where InsertDate = '01Aug2020' );
disconnect from hadoop;
quit;

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

@JayS,

 

You're using explicit pass through SQL.  Whenever there are phrases like "FROM CONNECTION TO hadoop" or "disconnect from hadoop", explicit pass through SQL is being used.  Pardon me if you already know this but just in case:  When explicit pass through is used, you're basically telling SAS, just hand this over to the database as is.  In other words, SAS will perform no "translation" from SAS SQL to the SQL (or in this case HQL) of the database.  Therefore all statements must be coded using the syntax of the database not SAS syntax.

 

In your case, you need to code the date in the format that Hadoop uses, i.e. '2020-08-01'.

 

Jim

View solution in original post

5 REPLIES 5
ballardw
Super User

Try using '01Aug2020'd . The d immediately after the value in quotes tells SAS to treat it as a DATE literal, otherwise it would be a character value.

jimbarbour
Meteorite | Level 14

@JayS,

 

You're using explicit pass through SQL.  Whenever there are phrases like "FROM CONNECTION TO hadoop" or "disconnect from hadoop", explicit pass through SQL is being used.  Pardon me if you already know this but just in case:  When explicit pass through is used, you're basically telling SAS, just hand this over to the database as is.  In other words, SAS will perform no "translation" from SAS SQL to the SQL (or in this case HQL) of the database.  Therefore all statements must be coded using the syntax of the database not SAS syntax.

 

In your case, you need to code the date in the format that Hadoop uses, i.e. '2020-08-01'.

 

Jim

JayS
Obsidian | Level 7

Thank you both for the quick response.

I'll give them a try and confirm my findings.

Thanks again.

Jay

JayS
Obsidian | Level 7
Perfect, thanks Jim....
jimbarbour
Meteorite | Level 14

You're welcome; glad to help out.

 

Jim

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 1480 views
  • 2 likes
  • 3 in conversation