mdayakar commented on code in PR #5182:
URL: https://github.com/apache/hive/pull/5182#discussion_r1570658422


##########
hplsql/src/main/java/org/apache/hive/hplsql/Expression.java:
##########
@@ -565,7 +575,11 @@ public void 
operatorConcatSql(HplsqlParser.Expr_concatContext ctx) {
     sql.append("CONCAT(");
     int cnt = ctx.expr_concat_item().size();
     for (int i = 0; i < cnt; i++) {
-      sql.append(evalPop(ctx.expr_concat_item(i)).toString());
+      String concatStr = evalPop(ctx.expr_concat_item(i)).toString();
+      if (!concatStr.startsWith("'")) {

Review Comment:
   For example below example
   `SELECT '#' || TRIM(' Hello ') || '#';`
   Here HPLSQL internally calls concat and when `TRIM(' Hello ')` is evaluated 
it will become `Hello` without quotes so here concat will throw error. To avoid 
it if the concat item is not starting with single quote then enclosing it with 
single quotes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to