Github user selvaganesang commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/380#discussion_r56245070
--- Diff: core/sql/optimizer/BindRelExpr.cpp ---
@@ -10171,17 +10164,26 @@ matched clause of merge). If the upsert caused a
row to be updated in the
base table then the old version of the row will have to be deleted from
indexes, and a new version inserted. Upsert is being transformed to merge
so that we can delete the old version of an updated row from the index.
+
+Upsert is also converted into merge when there are omitted cols with
default values and
+TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS is set to OFF in case of
aligned format table or
+omitted current timestamp cols in case of non-aligned row format
--- End diff --
In fact, we always generate assignment for all columns at the time of
upsert even if the column is omitted in both formats. We had to do this because
these columns need to flow to IM operators. In case of non-aligned format,
these columns are removed from put into hbase at the executor. But these
columns would exist in the raw index table in hbase if we happen to have an
index on the omitted column. See PR #340
For the first change request: If we always assign the current timestamp,
what happens if the row exists. Won't we replace it the current timestamp even
when some other column is updated or upserted.
For the second change request: When the CQD
TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS (aligned format) is set to ON, we
just don't change it merge if there are no secondary indexes.
For non-aligned format, I need to recheck if the same CQD can be used.
Though I had concluded we need to populate the default values for the
non-aligned format earlier, there might be a way out of this. We can file a
JIRA for it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---