Hive Assignment 1, Question 6 Solution Issue, ParseException expecting identifier near EOF



0
Please help me to resolve this issue for Question 6:
FAILED: ParseException line 1:166 extraneous input 'as' expecting Identifier near ''

line 1:279 extraneous input 'as' expecting Identifier near ''

Question 6:Find out highest price and highest dividends for each stock symbol if highest price and highest dividends exist.


I ran the following:


select np.stock_symbol, highest_price, highest_dividends from (select stock_symbol, max(stock_price_close) as highest_price from nasdaq_prices group by stock_symbol) as np join (select stock_symbol, max(dividends) as highest_dividends from nasdaq_dividend group by stock_symbol) as nd on np.stock_symbol = nd.stock_symbol;

AND received this error:

FAILED: ParseException line 1:166 extraneous input 'as' expecting Identifier near ''

line 1:279 extraneous input 'as' expecting Identifier near ''

2 Answer(s)


0

I solved the problem by removing as before np join and nd on but perhaps someone can explain why it is like this? The following is the successful query I ran:

select np.stock_symbol, highest_price, highest_dividends from (select stock_symbol, max(stock_price_close) as highest_price from nasdaq_prices group by stock_symbol) np join (select stock_symbol, max(dividends) as highest_dividends from nasdaq_dividend group by stock_symbol) nd on np.stock_symbol = nd.stock_symbol;



0

hi Robert,

Thank you for raising the issue, this seems like a bug in the query that was provided. Again the Question7 also has the same issue. We will correct these.

Thanks

Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)

Email
Password