mdayakar commented on code in PR #5182:
URL: https://github.com/apache/hive/pull/5182#discussion_r1570912666
##########
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();
+ }
+ if (value.startsWith("''")) {
Review Comment:
if the `value` has already a quote then `var.toSqlString();` add another one
so remove that extra quote added this check. Anyway I changed the code to add
the quote if it is not present.
--
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]