You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "lowka (via GitHub)" <gi...@apache.org> on 2024/03/04 13:54:35 UTC
[PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
lowka opened a new pull request, #3344:
URL: https://github.com/apache/ignite-3/pull/3344
WIP
https://issues.apache.org/jira/browse/IGNITE-21353
---
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1523083868
##########
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:
is it possible case?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1517181451
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncSingleNodeTest.java:
##########
@@ -121,7 +121,7 @@ void readWriteOperationInTxAfterAlteringSchemaOnTargetTableIsRejected(Operation
private void createTable() {
cluster.doInSession(0, session -> {
- executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int PRIMARY KEY, val varchar)", session);
+ executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int, val varchar, PRIMARY KEY USING HASH (id))", session);
Review Comment:
1. This test does not care about index type.
2. An error in OrderedPublisher is not correctly propagated (https://issues.apache.org/jira/browse/IGNITE-21684). So error message checks in this test are going to fail, if a sorted index is used.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1525332655
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
it might be worth renaming it to something like `TablePrimaryKey` or `PrimaryKeyColumns`... :thinking:
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
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 expected to get an error no primary key. This case is covered by existing tests.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1526163032
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
Well, I think it still better to rename it. Renamed to `Table*PrimaryKey`.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1525327081
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
Review Comment:
```suggestion
/** Base class for a primary key. */
```
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
it might be worth renaming it to something like `TablePrimaryKey` or `PrimaryKeyColumns`... :thinking:
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImplTest.java:
##########
@@ -828,4 +846,15 @@ private static ColumnParams column(String name, ColumnType columnType, int preci
return builder.build();
}
+
+ private static CatalogPrimaryKey primaryKey(String column, String... columns) {
+ List<String> pkColumns = new ArrayList<>();
+ pkColumns.add(column);
+ pkColumns.addAll(Arrays.asList(columns));
+
+ // There is no d
Review Comment:
:thinking: :thinking:
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1526156165
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
It can't be plural, since it _a_ primary key (a key consist of columns)- and there are several flavours of it hash-index-backed / sorted-index-backed. At the moment only a table can have primary key.
I think when something new comes up, that requires its own `primary key`, then this entity can be renamed.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1526163032
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
Well, I think it still better to rename it. Renamed to `Table*PrimaryKey`. Because it is not a catalog entity (which have `Catalog` prefix).
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1523108880
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/CreateTableCommand.java:
##########
@@ -18,15 +18,26 @@
package org.apache.ignite.internal.sql.engine.prepare.ddl;
import java.util.List;
+import org.apache.ignite.internal.sql.engine.schema.IgniteIndex.Collation;
import org.jetbrains.annotations.Nullable;
/**
* CREATE TABLE statement.
*/
public class CreateTableCommand extends AbstractTableDdlCommand {
+
+ /** Primary key index type. */
+ public enum PrimaryKeyIndexType {
Review Comment:
is it possible to have single enum for index types? We already has org.apache.ignite.catalog.IndexType
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1523552435
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlToCatalogCommandConverter.java:
##########
@@ -63,12 +67,33 @@ class DdlToCatalogCommandConverter {
static CatalogCommand convert(CreateTableCommand cmd) {
List<ColumnParams> columns = cmd.columns().stream().map(DdlToCatalogCommandConverter::convert).collect(Collectors.toList());
+ PrimaryKeyIndexType pkIndexType = cmd.primaryIndexType();
+ CatalogPrimaryKey primaryKey;
+
+ if (pkIndexType == PrimaryKeyIndexType.SORTED) {
Review Comment:
Fixed.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1523112487
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/CreateTableCommand.java:
##########
@@ -18,15 +18,26 @@
package org.apache.ignite.internal.sql.engine.prepare.ddl;
import java.util.List;
+import org.apache.ignite.internal.sql.engine.schema.IgniteIndex.Collation;
import org.jetbrains.annotations.Nullable;
/**
* CREATE TABLE statement.
*/
public class CreateTableCommand extends AbstractTableDdlCommand {
+
+ /** Primary key index type. */
+ public enum PrimaryKeyIndexType {
Review Comment:
However seems them can be different in the future and have two enums is a good...
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern merged PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1525332655
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
it might be worth renaming it to something like `TablePrimaryKey`... :thinking:
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1523105177
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlToCatalogCommandConverter.java:
##########
@@ -63,12 +67,33 @@ class DdlToCatalogCommandConverter {
static CatalogCommand convert(CreateTableCommand cmd) {
List<ColumnParams> columns = cmd.columns().stream().map(DdlToCatalogCommandConverter::convert).collect(Collectors.toList());
+ PrimaryKeyIndexType pkIndexType = cmd.primaryIndexType();
+ CatalogPrimaryKey primaryKey;
+
+ if (pkIndexType == PrimaryKeyIndexType.SORTED) {
Review Comment:
why not switch/case statements?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1526151638
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
Review Comment:
Fixed.
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImplTest.java:
##########
@@ -828,4 +846,15 @@ private static ColumnParams column(String name, ColumnType columnType, int preci
return builder.build();
}
+
+ private static CatalogPrimaryKey primaryKey(String column, String... columns) {
+ List<String> pkColumns = new ArrayList<>();
+ pkColumns.add(column);
+ pkColumns.addAll(Arrays.asList(columns));
+
+ // There is no d
Review Comment:
Thanks, fixed.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1526156165
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
It can't be plural, since it _a_ primary key - and there are several flavours of it hash-index-backed / sorted-index-backed. At the moment only a table can have primary key.
I think when something new comes up, that requires an its own primary it, then this entity can be renamed.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21353: Sql. Support for choosing the primary key index type [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #3344:
URL: https://github.com/apache/ignite-3/pull/3344#discussion_r1526156165
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
It can't be plural, since it _a_ primary key - and there are several flavours of it hash-index-backed / sorted-index-backed. At the moment only a table can have primary key.
I think when something new comes up, that requires its own primary it, then this entity can be renamed.
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogPrimaryKey.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.commands;
+
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.ignite.internal.catalog.CatalogValidationException;
+
+/** Base class of for a primary key. */
+public abstract class CatalogPrimaryKey {
Review Comment:
It can't be plural, since it _a_ primary key - and there are several flavours of it hash-index-backed / sorted-index-backed. At the moment only a table can have primary key.
I think when something new comes up, that requires its own `primary key`, then this entity can be renamed.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org