MCPcopy Create free account
hub / github.com/apache/impala / toSql

Method toSql

fe/src/main/java/org/apache/impala/analysis/UpdateStmt.java:88–123  ·  view source on GitHub ↗
(ToSqlOptions options)

Source from the content-addressed store, hash-verified

86 }
87
88 @Override
89 public String toSql(ToSqlOptions options) {
90 if (!options.showRewritten() && sqlString_ != null) return sqlString_;
91
92 StringBuilder b = new StringBuilder();
93 b.append("UPDATE ");
94
95 if (fromClause_ == null) {
96 b.append(targetTableRef_.toSql(options));
97 } else {
98 if (targetTableRef_.hasExplicitAlias()) {
99 b.append(targetTableRef_.getExplicitAlias());
100 } else {
101 b.append(targetTableRef_.toSql(options));
102 }
103 }
104 b.append(" SET");
105
106 boolean first = true;
107 for (Pair<SlotRef, Expr> i : assignments_) {
108 if (!first) {
109 b.append(",");
110 } else {
111 first = false;
112 }
113 b.append(format(" %s = %s", i.first.toSql(options), i.second.toSql(options)));
114 }
115
116 b.append(fromClause_.toSql(options));
117
118 if (wherePredicate_ != null) {
119 b.append(" WHERE ");
120 b.append(wherePredicate_.toSql(options));
121 }
122 return b.toString();
123 }
124
125 // Rewrite or create WHERE predicate to filter out rows that already have the desired
126 // value, thus skipping unnecessary updates.

Callers

nothing calls this directly

Calls 7

showRewrittenMethod · 0.80
getExplicitAliasMethod · 0.80
toSqlMethod · 0.65
appendMethod · 0.45
hasExplicitAliasMethod · 0.45
formatMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected