ivandasch commented on a change in pull request #9167: URL: https://github.com/apache/ignite/pull/9167#discussion_r684304772
########## File path: modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/database/inlinecolumn/ComputeInlineSizeTest.java ########## @@ -0,0 +1,148 @@ +/* + * 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.processors.query.h2.database.inlinecolumn; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.cache.query.index.Index; +import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexImpl; +import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexTree; +import org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy; +import org.apache.ignite.internal.processors.cache.GridCacheContext; +import org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest; +import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; +import org.junit.Test; + +/** Tests for the computation inline size. */ +public class ComputeInlineSizeTest extends AbstractIndexingCommonTest { + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + } + + /** */ + @Test + public void testAnnotaitionPrecision() throws Exception { + IgniteEx ignite = startGrid(); + + CacheConfiguration ccfg = new CacheConfiguration<>() + .setName("TEST_CACHE") + .setIndexedTypes(Long.class, Person.class); + + GatewayProtectedCacheProxy cache = (GatewayProtectedCacheProxy) ignite.createCache(ccfg); + + checkIdxsInlineSizes(ignite, cache.context()); + } + + /** */ + @Test + public void testSQLIndexes() throws Exception { + IgniteEx ignite = startGrid(); + + GatewayProtectedCacheProxy cache = (GatewayProtectedCacheProxy) ignite.createCache( + new CacheConfiguration<>().setName("CACHE")); + + SqlFieldsQuery qry = new SqlFieldsQuery("create table TABLE (" + + "id long primary key" + + ", str varchar" + + ", bytes binary" + + ", strprec varchar(" + (InlineIndexTree.IGNITE_VARIABLE_TYPE_DEFAULT_INLINE_SIZE + 10) + ")" + + ", strprecbig varchar(" + (PageIO.MAX_PAYLOAD_SIZE * 2) + " )" + + ", bytesprec binary(" + (InlineIndexTree.IGNITE_VARIABLE_TYPE_DEFAULT_INLINE_SIZE + 20) + " )" + + ")with \"cache_name=TEST_CACHE_TABLE\";"); + cache.query(qry); + + qry = new SqlFieldsQuery("create index PERSON_STR_IDX on TABLE (str);"); Review comment: I suppose that this can be rewritten to loop easily. If you call queryProcessor directly, you can execute all of these in one multiline statement -- 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]
