AMashenkov commented on code in PR #2493:
URL: https://github.com/apache/ignite-3/pull/2493#discussion_r1304612706
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogParamsValidationUtils.java:
##########
@@ -95,6 +105,83 @@ static void validateRenameZoneParams(RenameZoneParams
params) {
validateZoneName(params.newZoneName(), "Missing new zone name");
}
+ static void validateDropTableParams(DropTableParams params) {
+ validateCommonTableParams(params);
+ }
+
+ static void validateCreateTableParams(CreateTableParams params) {
+ validateCommonTableParams(params);
+
+ List<String> columnNames =
Objects.<List<ColumnParams>>requireNonNullElse(params.columns(),
List.of()).stream()
+ .peek(CatalogParamsValidationUtils::validateColumnParams)
+ .map(ColumnParams::name)
+ .collect(toList());
+
+ validateColumns(
+ columnNames,
+ Table.TABLE_DEFINITION_ERR,
+ "Columns not specified",
+ "Duplicate columns are present: {}"
+ );
+
+ validateColumns(
+ params.primaryKeyColumns(),
+ Table.TABLE_DEFINITION_ERR,
+ "Primary key columns not specified",
+ "Duplicate primary key columns are present: {}"
+ );
+
+ validateColumnsContainsInAnotherColumns(
+ params.primaryKeyColumns(),
+ columnNames,
+ Table.TABLE_DEFINITION_ERR,
+ "Primary key columns missing in columns: {}"
+ );
+
+ validateColumns(
+ params.colocationColumns(),
+ Table.TABLE_DEFINITION_ERR,
+ "Colocation columns not specified",
+ "Duplicate colocation columns are present: {}"
+ );
Review Comment:
AFAIK, we use PK columns if colocation columns were not set.
So, we have to check duplicates only.
--
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]