lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1523549079
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CreateTableCommand.java:
##########
@@ -246,14 +275,20 @@ public CreateTableCommandBuilder zone(String zoneName) {
public CatalogCommand build() {
String zoneName = requireNonNullElse(this.zoneName,
CatalogService.DEFAULT_ZONE_NAME);
- List<String> colocationColumns = this.colocationColumns != null
- ? this.colocationColumns
- : primaryKeyColumns;
+ List<String> colocationColumns;
+
+ if (this.colocationColumns != null) {
+ colocationColumns = this.colocationColumns;
+ } else if (primaryKey != null) {
+ colocationColumns = primaryKey.columns();
+ } else {
+ colocationColumns = null;
Review Comment:
Yes, it is. In this particular case CreateTableCommand builder is called w/o
both colocation columns and primary key - we expecte to get an error since it
is not possible to create a table w/o primary key.
This case is covered by existing tests.
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CreateTableCommand.java:
##########
@@ -246,14 +275,20 @@ public CreateTableCommandBuilder zone(String zoneName) {
public CatalogCommand build() {
String zoneName = requireNonNullElse(this.zoneName,
CatalogService.DEFAULT_ZONE_NAME);
- List<String> colocationColumns = this.colocationColumns != null
- ? this.colocationColumns
- : primaryKeyColumns;
+ List<String> colocationColumns;
+
+ if (this.colocationColumns != null) {
+ colocationColumns = this.colocationColumns;
+ } else if (primaryKey != null) {
+ colocationColumns = primaryKey.columns();
+ } else {
+ colocationColumns = null;
Review Comment:
Added a comment.
--
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]