'Define query in talend context using tSystem component

I am trying to run an impala command using the tSystem component in Talend Studio. I am able to run the command in terminal .

impala-shell -i hostname:21000 -d default -k --ssl -q "COMPUTE STATS DEFAULT.TABLENAME;"

I tried to apply the same command in tSystem component. so, the command in TOS will be appied by this way:

In Talend context:

 hostname = hostname:21000
    database = default 
    tablename = default.tablename

Impala command I defined in tSystem component:

"impala-shell -i context.hostname -d context.database -k --ssl -q "COMPUTE STATS context.tablename;""

However, I got an error for this line -> -q "COMPUTE STATS context.tablename;"

Error: enter image description here

Is there any ways I could use the string query in my impala command using tSystem component in TOS? Appreciate any helps. Thanks.



Solution 1:[1]

Yes, you just need to concatenate the context variables with your query string:

"impala-shell -i " + context.hostname + " -d " + context.database + " -k --ssl -q \"COMPUTE STATS " + context.tablename + ";\""

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ibrahim Mezouar