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


##########
hplsql/src/main/java/org/apache/hive/hplsql/Expression.java:
##########
@@ -110,7 +110,17 @@ else if (ctx.interval_item() != null) {
     }
     else {
       visitChildren(ctx);
-      sql.append(exec.stackPop().toString());
+      Var value = exec.stackPop();
+      if (value.type == Type.NULL && sql.toString().length() == 0) {
+        exec.stackPush(new Var());
+        return;
+      } else if (exec.buildSql && value.type == Type.DATE) {
+        sql.append(String.format("DATE '%s'", value.toString()));
+      } else if (exec.buildSql && value.type == Type.TIMESTAMP) {
+        sql.append(String.format("TIMESTAMP '%s'", value.toString()));
+      } else {
+        sql.append(value.toString());
+      }

Review Comment:
   Added Var.toSqlString(boolean isBuildSql) API and using the same.



##########
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:
   Fixed



-- 
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