Github user maryannxue commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/301#discussion_r190428434
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java ---
@@ -549,7 +549,7 @@ public MutationPlan compile(UpsertStatement upsert)
throws SQLException {
select = SelectStatement.create(select, hint);
// Pass scan through if same table in upsert and select so
that projection is computed correctly
// Use optimizer to choose the best plan
- QueryCompiler compiler = new QueryCompiler(statement, select,
selectResolver, targetColumns, parallelIteratorFactoryToBe, new
SequenceManager(statement), false, false, null);
+ QueryCompiler compiler = new QueryCompiler(statement, select,
selectResolver, targetColumns, parallelIteratorFactoryToBe, new
SequenceManager(statement), true, false, null);
--- End diff --
"Tuple projection" was first used for join queries so that columns are
accessed based on positions instead of names. We later applied this to
single-table queries, but for some reason (reason that I can't recall right
now), we wanted to avoid tuple projection in UPSERT. If this change won't cause
any existing test failure, I think it's just fine.
---