Jackie-Jiang commented on a change in pull request #6153:
URL: https://github.com/apache/incubator-pinot/pull/6153#discussion_r507933640
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/util/TableConfigUtils.java
##########
@@ -265,6 +265,10 @@ protected static void validateUpsertConfig(TableConfig
tableConfig, Schema schem
tableConfig.getRoutingConfig() != null &&
RoutingConfig.REPLICA_GROUP_INSTANCE_SELECTOR_TYPE
.equalsIgnoreCase(tableConfig.getRoutingConfig().getInstanceSelectorType()),
"Upsert table must use replica-group (i.e. replicaGroup) based
routing");
+ // no startree index
+ Preconditions.checkState(
+ tableConfig.getIndexingConfig().getStarTreeIndexConfigs() == null ||
tableConfig.getIndexingConfig()
+ .getStarTreeIndexConfigs().isEmpty(), "The upsert table cannot
have star-tree index.");
Review comment:
```suggestion
Collections.isEmpty(tableConfig.getIndexingConfig().getStarTreeIndexConfigs())
&& !tableConfig.getIndexingConfig().isEnableDefaultStarTree(), "The upsert
table cannot have star-tree index.");
```
##########
File path:
pinot-core/src/test/java/org/apache/pinot/core/util/SchemaUtilsTest.java
##########
@@ -221,6 +221,30 @@ public void testValidateTimeFieldSpec() {
SchemaUtils.validate(pinotSchema);
}
+ @Test
+ public void testValidatePrimaryKeyColumns() {
+ Schema pinotSchema;
+ // non-existing column used as primary key
+ pinotSchema = new Schema.SchemaBuilder()
+ .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS,
"time"),
+ new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS,
"time")).addSingleValueDimension("col", DataType.INT)
+ .setPrimaryKeyColumns(Lists.newArrayList("test")).build();
+ checkValidationFails(pinotSchema);
+ // time column used as primary key
+ pinotSchema = new Schema.SchemaBuilder()
+ .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS,
"time"),
+ new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS,
"time")).addSingleValueDimension("col", DataType.INT)
+ .setPrimaryKeyColumns(Lists.newArrayList("time")).build();
+ checkValidationFails(pinotSchema);
+
+ // valid primary key
+ pinotSchema = new Schema.SchemaBuilder()
+ .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS,
"time"),
+ new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS,
"time")).addSingleValueDimension("col", DataType.INT)
+ .setPrimaryKeyColumns(Lists.newArrayList("col")).build();
+ checkValidationFails(pinotSchema);
Review comment:
Still fail??
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/SchemaUtils.java
##########
@@ -92,6 +93,9 @@ public static void validate(Schema schema) {
"Exception in getting arguments for transform function '" +
transformFunction + "' for column '"
+ column + "'", e);
}
+ } else if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)
&& fieldSpec.getFieldType()
Review comment:
Why putting this in the else? Also, this filter can never match because
a field cannot be both TIME and DATE_TIME
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]