admin管理员组

文章数量:1122832

I need to transform text from one field to a new one. Currently the TEXTVALUE is "202411219999". The NEWVALUE to obtain must be like this: "2024-11-21"

I managed to use substring("TEXTVALUE", 1, 4) in the expresion function, getting first 4 characters from TEXTVALUE.

Do you know how can I use 3 substrings maybe in one expersion to obtain final "2024-11-21" ? I think palantir is using spark SQL for this.

Thank you

I need to transform text from one field to a new one. Currently the TEXTVALUE is "202411219999". The NEWVALUE to obtain must be like this: "2024-11-21"

I managed to use substring("TEXTVALUE", 1, 4) in the expresion function, getting first 4 characters from TEXTVALUE.

Do you know how can I use 3 substrings maybe in one expersion to obtain final "2024-11-21" ? I think palantir is using spark SQL for this.

Thank you

Share Improve this question asked Nov 21, 2024 at 9:40 TurpanTurpan 5352 gold badges8 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

you can use concat to concatenate multiple substings,

concat(substring("TEXTVALUE", 1, 4), '-', 
       substring("TEXTVALUE", 5, 2), '-', 
       substring("TEXTVALUE", 7, 2))

本文标签: apache spark sqlformating text to a new field in foundry contourStack Overflow