Member since
06-04-2018
10
Posts
0
Kudos Received
0
Solutions
07-02-2018
10:43 AM
Hi, Thank you, I figured this out using substring substr(item_desc,instr(item_desc,' ')+1,length(item_desc)) This is giving me the desired results Regards Souveek
... View more
07-02-2018
09:50 AM
@Vinicius Higa Murakami
... View more
07-02-2018
09:47 AM
I am doing a couple of operations of which I am extracting the first word by using split(item_desc, ' ')[0] I also need to extract all words excluding the first word. Can anyone suggest a way please? Regards, Souveek
... View more
07-02-2018
07:13 AM
Thanks a lot, this worked. but for my requirement I used the below syntax from_unixtime(unix_timestamp(date_add(add_months(current_timestamp,-1),-9) ,'yyyy-MM-dd'), 'yyyyMM') Thanks a lot. Regards, Souveek
... View more
06-27-2018
12:18 PM
Hi, I am trying to convert a postgres Greenplum function to Hive and encountered the below problem: cast(from_unixtime(unix_timestamp(current_timestamp - interval 1 Month 9 days),'YYYYMM') as int) This is working in pyspark when I use a Hive context but the same is failing in Ambari. Can anyone explain this? What should we use instead of interval to reduce 1 month and 9 days? We cant use 39 days as this will sometimes be 39 and sometimes 40 Regards, Souveek
... View more
Labels:
- Labels:
-
Apache Hive
06-07-2018
07:48 AM
Hi, @Vinicius Higa Murakami Thank you for taking out your time to help me. The regexp_extract didnt work correctly but I got the idea and modified the code to get the desired results. Here is what I did: trim(concat_ws(' ',
case when instr( lower(col4) , 'abcd' ) >0 then 'abcd' else '' end, case when instr( lower(col4) , 'pqrs' ) >0 then 'pqrs' else '' end)) This worked perfectly. Thank you so much Regards Souveek
... View more
06-05-2018
01:51 PM
Let me give you an example of the code that is working in postgres based on the code I gave. CREATE OR REPLACE VIEW XYZ_V AS( Select col1, col2, col3, col4,trim(both ' ' from case when substring( lower(col4) from 'abcd' ) is null then '' else substring( lower(col4) from 'abcd') end ||' '|| case when substring( lower(col4) from 'pqrs' ) is null then '' else substring( lower(col4) from 'pqrs') end ||' '|| case when substring( lower(col4) from 'mnop' ) is null then '' else substring( lower(col4) from 'mnop') end) as col5 FROM XYZ); Example: COL1\t COL2\t COL3\t COL4\t COL5 1\t pdf\t page1\t efgh opsdw mnop\t mnop 2\t txt\t page4\t abcd qwerty pqrs\t abcd pqrs 3\t txt\t page3\t abcd pqrs xyzsd mnop\t abcd pqrs mnop (\t denotes the break in columns) Regards, Souveek
... View more
06-05-2018
01:06 PM
Thank you for replying but my main concern is to replicate the part using substring in Hive. I can't figure out a way to get the exact output
... View more
06-04-2018
02:04 PM
Hi, I am trying to create a view in Hortonworks that I have in postgres greenplum where I am trying to find a word/words that exists in a column that has lot of words. If the word exists, the new column should show the word and if there are multiple words, the multiple words should be reflected with a space in between. Below is a running code in postgres Greenplum. Can anyone help me with the code in Hive? CREATE OR REPLACE VIEW XYZ_V AS(
Select col1, col2, col3, col4,trim(both ' ' from case when substring( lower(col4) from 'abcd' ) is null then '' else substring( lower(col4) from 'abcd') end ||' '|| case when substring( lower(col4) from 'pqrs' ) is null then '' else substring( lower(col4) from 'pqrs') end ||' '|| case when substring( lower(col4) from 'mnop' ) is null then '' else substring( lower(col4) from 'mnop') end) as col5 FROM XYZ); Thanks a lot in advance Regards
... View more
Labels:
- Labels:
-
Apache Hive
-
Apache Spark