1 year ago

#73377

test-img

Hassam

concat regex specific columns hive sql

I have a table having columns

__word__|__f0__|__f1__|__f2__|__..__|__f99__|
   ..   |  ..  |  ..  |  ..  |  ..  |  ...  | 

columns f0-f99 have real numbers (vector embeddings of the word). I want to concatenate all these into single columns named embeddings as an array separated by ','

for example:

__word__|__embeddings___|
any word| [f0,f1,..f99] |

I am using wild cards for columns selection and it works fine for select statement

select word
        , `f.*`
from my_table

but doesn't work in concat_ws function

select word
        , CONCAT_WS(",", `f.*`) embeddings
from my_table

giving an error: Semantic analysis exception - column f.* cannot be resolved.

Does anyone have an idea how can I achieve this by using wild card or regex column specification?

sql

database

hive

hiveql

0 Answers

Your Answer

Accepted video resources