Jackie-Jiang commented on code in PR #8688:
URL: https://github.com/apache/pinot/pull/8688#discussion_r874231974
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -481,6 +481,17 @@ static void validatePartialUpsertStrategies(TableConfig
tableConfig, Schema sche
UpsertConfig.Strategy columnStrategy = entry.getValue();
Preconditions.checkState(!primaryKeyColumns.contains(column), "Merger
cannot be applied to primary key columns");
+ if (upsertConfig.getComparisonColumn() != null) {
+
Preconditions.checkState(!upsertConfig.getComparisonColumn().equals(column),
+ "Merger cannot be applied to comparison column");
+ }
+
+ if (upsertConfig.getComparisonColumn() == null
+ && tableConfig.getValidationConfig().getTimeColumnName() != null) {
+
Preconditions.checkState(!tableConfig.getValidationConfig().getTimeColumnName().equals(column),
+ "Merger cannot be applied to time column");
+ }
Review Comment:
Time column must exist for upsert table (real-time table), so this check can
be simplified:
```suggestion
if (upsertConfig.getComparisonColumn() != null) {
Preconditions.checkState(!upsertConfig.getComparisonColumn().equals(column),
"Merger cannot be applied to comparison column");
} else {
Preconditions.checkState(!tableConfig.getValidationConfig().getTimeColumnName().equals(column),
"Merger cannot be applied to time column");
}
```
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -481,6 +481,17 @@ static void validatePartialUpsertStrategies(TableConfig
tableConfig, Schema sche
UpsertConfig.Strategy columnStrategy = entry.getValue();
Preconditions.checkState(!primaryKeyColumns.contains(column), "Merger
cannot be applied to primary key columns");
+ if (upsertConfig.getComparisonColumn() != null) {
+
Preconditions.checkState(!upsertConfig.getComparisonColumn().equals(column),
+ "Merger cannot be applied to comparison column");
+ }
+
+ if (upsertConfig.getComparisonColumn() == null
+ && tableConfig.getValidationConfig().getTimeColumnName() != null) {
+
Preconditions.checkState(!tableConfig.getValidationConfig().getTimeColumnName().equals(column),
+ "Merger cannot be applied to time column");
+ }
Review Comment:
A minor optimization on top of this is to pre-compute the comparison column
before getting into the loop:
```
String comparisonColumn = upsertConfig.getComparisonColumn();
if (comparisonColumn == null) {
comparisonColumn = tableConfig.getValidationConfig().getTimeColumnName();
}
```
Then just check if the column is comparison column:
```
Preconditions.checkState(!comparisonColumn.equals(column), "Merger cannot be
applied to comparison column");
```
--
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]