vadimkolodingg commented on code in PR #6931: URL: https://github.com/apache/ignite-3/pull/6931#discussion_r2559902726
########## modules/java-records-tests/src/testFixtures/java/org/apache/ignite/internal/schema/marshaller/Records.java: ########## @@ -0,0 +1,429 @@ +/* + * 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.schema.marshaller; + +import java.util.Objects; +import org.apache.ignite.catalog.annotations.Column; +import org.apache.ignite.internal.schema.SchemaDescriptor; +import org.apache.ignite.internal.type.NativeTypes; + +/** + * Declaration variants fixture. Each nested class contains record and its class alternative declarations. + */ +class Records { + private Records() {} + + static final String SQL_PATTERN = "CREATE TABLE {} (key INT PRIMARY KEY, val VARCHAR, val2 VARCHAR)"; + + static final SchemaDescriptor schema = new SchemaDescriptor(1, + new org.apache.ignite.internal.schema.Column[]{ + new org.apache.ignite.internal.schema.Column("KEY", NativeTypes.INT32, false) + }, + new org.apache.ignite.internal.schema.Column[]{ + new org.apache.ignite.internal.schema.Column("VAL", NativeTypes.STRING, true), + new org.apache.ignite.internal.schema.Column("VAL2", NativeTypes.STRING, true) + }); + + static class ComponentsExact { + record RecordK(@Column("key") Integer id) { } + record RecordV(@Column("val") String val) { } + record Record(@Column("key") Integer id, @Column("val") String val) { } + + record ExplicitCanonical(@Column("key") Integer id, @Column("val") String val) { + ExplicitCanonical(@Column("key") Integer id, @Column("val") String val) { + this.id = id; + this.val = val; + if (id == null && val == null) { + throw new IllegalArgumentException("null args"); + } + } + } + + record ExplicitCanonicalV(@Column("val") String val) { + ExplicitCanonicalV(@Column("val") String val) { + this.val = val; + if (val == null) { + throw new IllegalArgumentException("null args"); + } + } + } + + public record ExplicitCompact(@Column("key") Integer id, @Column("val") String val) { + public ExplicitCompact { + if (id == null && val == null) { + throw new IllegalArgumentException("null args"); + } + } + } + + public record ExplicitCompactV(@Column("val") String val) { + public ExplicitCompactV { + if (val == null) { + throw new IllegalArgumentException("null args"); + } + } + } + + record ExplicitMultiple(@Column("key") Integer id, @Column("val") String val) { + ExplicitMultiple(Integer id) { + this(id, ""); + } + + ExplicitMultiple(String val) { + this(-1, val); + } + } Review Comment: added, nothing failed -- 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]
