zstan commented on code in PR #13219:
URL: https://github.com/apache/ignite/pull/13219#discussion_r3393686234
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ddl/DdlCommandHandler.java:
##########
@@ -498,4 +516,35 @@ else if (!F.isEmpty(cmd.primaryKeyColumns()) &&
cmd.primaryKeyColumns().size() =
return res;
}
+
+ /** */
+ private void validateTypeName(String typeName) {
Review Comment:
What action points do user need to implement if exception will raised ?
Seems we need to give a some clue here ?
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ddl/DdlCommandHandler.java:
##########
@@ -498,4 +516,35 @@ else if (!F.isEmpty(cmd.primaryKeyColumns()) &&
cmd.primaryKeyColumns().size() =
return res;
}
+
+ /** */
+ private void validateTypeName(String typeName) {
+ String duplicatedTypeName = duplicatedTypeName(typeName);
+ if (duplicatedTypeName != null) {
+ throw new IgniteSQLException(
+ "Duplicate ID [typeId=" +
qryProc.objectContext().binaryContext().typeId(typeName) +
+ ", oldCls=" + duplicatedTypeName +
+ ", newCls=" + typeName + ']');
+ }
+ }
+
+ /** */
+ private boolean hasTypeIdCollisions(String typeName) {
+ return duplicatedTypeName(typeName) != null;
+ }
+
+ /** */
+ private @Nullable String duplicatedTypeName(String typeName) {
+ BinaryContext binCtx = qryProc.objectContext().binaryContext();
+
+ int typeId = binCtx.typeId(typeName);
+
+ String anotherTypeName =
((MarshallerContextImpl)binCtx.marshaller().getContext()).resolveClassName(JAVA_ID,
typeId);
+
+ if (anotherTypeName == null || anotherTypeName.equals(typeName)
+ ||
binCtx.userTypeName(anotherTypeName).equals(binCtx.userTypeName(typeName)))
Review Comment:
binCtx.userTypeName(anotherTypeName).equals(binCtx.userTypeName(typeName)) -
this branch is not covered by 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]