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


##########
hplsql/src/main/java/org/apache/hive/hplsql/Stmt.java:
##########
@@ -787,8 +787,19 @@ public Integer 
insertValues(HplsqlParser.Insert_stmtContext ctx) {
     for (int i = 0; i < rows; i++) {
       HplsqlParser.Insert_stmt_rowContext row 
=ctx.insert_stmt_rows().insert_stmt_row(i);
       int cols = row.expr().size();
-      for (int j = 0; j < cols; j++) {         
-        String value = evalPop(row.expr(j)).toSqlString();
+      for (int j = 0; j < cols; j++) {
+        Var var = evalPop(row.expr(j));
+        String value =  null;
+        if (var.type == Type.TIMESTAMP) {
+          value = String.format("TIMESTAMP '%s'", var.toString());
+        } else if (var.type == Type.DATE) {
+          value = String.format("DATE '%s'", var.toString());
+        } else {
+          value = var.toSqlString();
+        }

Review Comment:
   As explained at 
https://github.com/apache/hive/pull/5182#discussion_r1570337451 comment, this 
format is required for insert also otherwise it throws exception. Example: 
insert into test values('Bob', 2024-04-17 10:20:30) throws exception here even 
the the type of second column is timestamp.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to