zstan commented on code in PR #2422:
URL: https://github.com/apache/ignite-3/pull/2422#discussion_r1301140748
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/varbinary/ItVarBinaryIndexTest.java:
##########
@@ -18,20 +18,121 @@
package org.apache.ignite.internal.sql.engine.datatypes.varbinary;
+import static
org.apache.ignite.internal.sql.engine.util.QueryChecker.containsIndexScan;
+import static org.apache.ignite.lang.IgniteStringFormatter.format;
+
+import java.util.stream.Stream;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.ignite.internal.sql.engine.datatypes.DataTypeTestSpecs;
import
org.apache.ignite.internal.sql.engine.datatypes.tests.BaseIndexDataTypeTest;
import org.apache.ignite.internal.sql.engine.datatypes.tests.DataTypeTestSpec;
+import org.apache.ignite.internal.sql.engine.datatypes.tests.TestTypeArguments;
import org.apache.ignite.internal.sql.engine.util.VarBinary;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Named;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests for queries that use indexes with {@link SqlTypeName#VARBINARY} type.
*/
public class ItVarBinaryIndexTest extends BaseIndexDataTypeTest<VarBinary> {
+ @BeforeAll
+ public void createTable() {
+ runSql("CREATE TABLE binary_fixed_length(id INTEGER PRIMARY KEY,
test_key BINARY(10))");
+ runSql("CREATE INDEX binary_fixed_length_test_key_idx on
binary_fixed_length (test_key)");
+
+ runSql("INSERT INTO binary_fixed_length VALUES(1, $0)");
+ runSql("INSERT INTO binary_fixed_length VALUES(2, $1)");
+ runSql("INSERT INTO binary_fixed_length VALUES(3, $2)");
+ }
+
+ /**
+ * Key lookup. Literal, cast, cast with precision against different column
types.
+ */
+ @ParameterizedTest
+ @MethodSource("indexChecks")
+ public void testKeyLookUp2(String table, ValueMode mode) {
+ VarBinary value1 = values.get(0);
+ String value1str = mode.toSql(testTypeSpec, value1);
+
+ // TODO Disable for VARBINARY, remove after
https://issues.apache.org/jira/browse/IGNITE-19931 is fixed
+ Assumptions.assumeFalse(mode == ValueMode.CAST);
+
+ checkQuery(format("SELECT * FROM {} WHERE test_key = {}", table,
value1str))
+ .matches(containsIndexScan("PUBLIC", table, table +
"_TEST_KEY_IDX"))
+ .returns(1, value1)
+ .check();
+ }
+
+ /** {@inheritDoc} */
+ @ParameterizedTest
+ @MethodSource("compoundIndex")
+ @Override
+ public void testCompoundIndex(TestTypeArguments<VarBinary> arguments)
throws InterruptedException {
+ // TODO Disable for VARBINARY, remove after
https://issues.apache.org/jira/browse/IGNITE-19931 is fixed.
+ // Lookups for VARBINARY and VARCHAR/CHAR work
+ Assumptions.assumeFalse(arguments.toString().startsWith("VARBINARY"));
+
+ super.testCompoundIndex(arguments);
+ }
+
+ /** {@inheritDoc} */
+ @Test
+ @Override
+ @Disabled("https://issues.apache.org/jira/browse/IGNITE-19931")
+ public void testIndexDynParam() {
+ super.testIndexDynParam();
+ }
+
/** {@inheritDoc} */
@Override
protected DataTypeTestSpec<VarBinary> getTypeSpec() {
return DataTypeTestSpecs.VARBINARY_TYPE;
}
+
+ private static Stream<Arguments> indexChecks() {
+ return Stream.of(
+ Arguments.of(Named.of("VARBINARY_DEFAULT_LENGTH", "T"),
ValueMode.LITERAL),
+ //Arguments.of(Named.of("VARBINARY_DEFAULT_LENGTH", "T"),
ValueMode.CAST),
Review Comment:
plz remove this 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]