Discussion:
trim special character in table column
Divya Gehlot
2018-09-17 09:26:16 UTC
Permalink
Hi,
I am using Drill 1.10
My apologies if My query is naive .
One of the table column field has special character like '/'
when I am doing RTRIM on it to just get the data before the '/' , it's not
working :(

Appreciate if anybody know how it works in Apache Drill !

Thanks,
Divya
Karthikeyan Manivannan
2018-09-18 19:00:57 UTC
Permalink
Hi Divya,

Can you please post your query and and an example of the column data. And
have you tried this on Drill 1.14 ?

Thanks.

Karthik
Post by Divya Gehlot
Hi,
I am using Drill 1.10
My apologies if My query is naive .
One of the table column field has special character like '/'
when I am doing RTRIM on it to just get the data before the '/' , it's not
working :(
Appreciate if anybody know how it works in Apache Drill !
Thanks,
Divya
Divya Gehlot
2018-09-19 03:32:50 UTC
Permalink
Hi ,
I haven't upgraded to Drill 1.14 yet .
Here is the query and data
SELECT `IP_Subnet`,LTRIM(`IP_Subnet`,'/') AS Subnets FROM
`tmp`.`default`.`./mapping/` ;

The LTRIM not working on special characters :(

IP_Subnet
Subnets
10.128.18.0/23 10.128.18.0/23
10.128.20.0/24 10.128.20.0/24
10.128.36.0/23 10.128.36.0/23
10.128.86.0/23 10.128.86.0/23
10.128.18.0/23 10.128.18.0/23


Thanks,
Divya
Post by Karthikeyan Manivannan
Hi Divya,
Can you please post your query and and an example of the column data. And
have you tried this on Drill 1.14 ?
Thanks.
Karthik
Post by Divya Gehlot
Hi,
I am using Drill 1.10
My apologies if My query is naive .
One of the table column field has special character like '/'
when I am doing RTRIM on it to just get the data before the '/' , it's
not
Post by Divya Gehlot
working :(
Appreciate if anybody know how it works in Apache Drill !
Thanks,
Divya
Arina Yelchiyeva
2018-09-19 13:10:32 UTC
Permalink
Hi Divya,

are you trying to replace slash in the middle? ltrim will do the
replacement at the begging of the string. If yes, you might new
regexp_replace function.

select '/abc', ltrim('/abc', '/') from (values(1));

-------------------------------------------------------------------------------------
| EXPR$0<VARCHAR(REQUIRED)> | EXPR$1<VARCHAR(REQUIRED)>
|
-------------------------------------------------------------------------------------
| /abc | abc
|
-------------------------------------------------------------------------------------


select 'a/bc', regexp_replace('a/bc', '/', '') from (values(1));

-------------------------------------------------------------------------------------
| EXPR$0<VARCHAR(REQUIRED)> | EXPR$1<VARCHAR(REQUIRED)>
|
-------------------------------------------------------------------------------------
| a/bc | abc
|
-------------------------------------------------------------------------------------

Kind regards,
Arina
Post by Divya Gehlot
Hi ,
I haven't upgraded to Drill 1.14 yet .
Here is the query and data
SELECT `IP_Subnet`,LTRIM(`IP_Subnet`,'/') AS Subnets FROM
`tmp`.`default`.`./mapping/` ;
The LTRIM not working on special characters :(
IP_Subnet
Subnets
10.128.18.0/23 10.128.18.0/23
10.128.20.0/24 10.128.20.0/24
10.128.36.0/23 10.128.36.0/23
10.128.86.0/23 10.128.86.0/23
10.128.18.0/23 10.128.18.0/23
Thanks,
Divya
Post by Karthikeyan Manivannan
Hi Divya,
Can you please post your query and and an example of the column data. And
have you tried this on Drill 1.14 ?
Thanks.
Karthik
Post by Divya Gehlot
Hi,
I am using Drill 1.10
My apologies if My query is naive .
One of the table column field has special character like '/'
when I am doing RTRIM on it to just get the data before the '/' , it's
not
Post by Divya Gehlot
working :(
Appreciate if anybody know how it works in Apache Drill !
Thanks,
Divya
Loading...