aweisberg commented on code in PR #2049:
URL: https://github.com/apache/cassandra/pull/2049#discussion_r1063717686
##########
test/unit/org/apache/cassandra/cql3/conditions/ColumnConditionTest.java:
##########
@@ -17,162 +17,421 @@
*/
package org.apache.cassandra.cql3.conditions;
+import java.io.IOException;
import java.nio.ByteBuffer;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.junit.Assert;
import org.junit.Test;
-import org.apache.cassandra.cql3.*;
+import org.apache.cassandra.cql3.CQLTester;
+import org.apache.cassandra.cql3.Constants;
+import org.apache.cassandra.cql3.Lists;
+import org.apache.cassandra.cql3.Maps;
+import org.apache.cassandra.cql3.Operator;
+import org.apache.cassandra.cql3.QueryOptions;
+import org.apache.cassandra.cql3.Sets;
+import org.apache.cassandra.cql3.Term;
+import org.apache.cassandra.cql3.Terms;
+import org.apache.cassandra.cql3.UserTypes;
import org.apache.cassandra.db.Clustering;
+import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.db.marshal.Int32Type;
import org.apache.cassandra.db.marshal.ListType;
import org.apache.cassandra.db.marshal.MapType;
import org.apache.cassandra.db.marshal.SetType;
-import org.apache.cassandra.db.rows.*;
+import org.apache.cassandra.db.marshal.UserType;
+import org.apache.cassandra.db.rows.BTreeRow;
+import org.apache.cassandra.db.rows.BufferCell;
+import org.apache.cassandra.db.rows.Cell;
+import org.apache.cassandra.db.rows.CellPath;
+import org.apache.cassandra.db.rows.Row;
import org.apache.cassandra.exceptions.InvalidRequestException;
+import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.io.util.DataInputBuffer;
+import org.apache.cassandra.io.util.DataOutputBuffer;
+import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.schema.ColumnMetadata;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.serializers.ListSerializer;
+import org.apache.cassandra.serializers.MapSerializer;
+import org.apache.cassandra.serializers.SetSerializer;
import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.Pair;
import org.apache.cassandra.utils.TimeUUID;
+import static org.apache.cassandra.cql3.Operator.CONTAINS;
+import static org.apache.cassandra.cql3.Operator.CONTAINS_KEY;
+import static org.apache.cassandra.cql3.Operator.EQ;
+import static org.apache.cassandra.cql3.Operator.GT;
+import static org.apache.cassandra.cql3.Operator.GTE;
+import static org.apache.cassandra.cql3.Operator.LT;
+import static org.apache.cassandra.cql3.Operator.LTE;
+import static org.apache.cassandra.cql3.Operator.NEQ;
+import static org.apache.cassandra.transport.ProtocolVersion.CURRENT;
+import static org.apache.cassandra.utils.ByteBufferUtil.EMPTY_BYTE_BUFFER;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.apache.cassandra.cql3.Operator.*;
-import static org.apache.cassandra.utils.ByteBufferUtil.EMPTY_BYTE_BUFFER;
-
-public class ColumnConditionTest
+public class ColumnConditionTest extends CQLTester
{
public static final ByteBuffer ZERO = Int32Type.instance.fromString("0");
public static final ByteBuffer ONE = Int32Type.instance.fromString("1");
public static final ByteBuffer TWO = Int32Type.instance.fromString("2");
- private static Row newRow(ColumnMetadata definition, ByteBuffer value)
+ private static final ListType<Integer> listType =
ListType.getInstance(Int32Type.instance, true);
+ private static final MapType<Integer, Integer> mapType =
MapType.getInstance(Int32Type.instance, Int32Type.instance, true);
+ private static final SetType<Integer> setType =
SetType.getInstance(Int32Type.instance, true);
+
+ private Row newRow(ColumnMetadata definition, ByteBuffer value)
{
- BufferCell cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, value, null);
+ BufferCell cell;
+ if (definition.type.isUDT() )
+ {
+ if (definition.type.isMultiCell()) {
+ CellPath cellPath =
udtType.cellPathForField(udtType.fieldName(0));
+ cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, value, cellPath);
+ }
+ else
+ {
+ ByteBuffer udtValue = UserType.buildValue(value, TWO);
+ cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, udtValue, null);
+ }
+ }
+ else
+ {
+ cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, value, null);
+ }
return BTreeRow.singleCellRow(Clustering.EMPTY, cell);
}
private static Row newRow(ColumnMetadata definition, List<ByteBuffer>
values)
{
- Row.Builder builder = BTreeRow.sortedBuilder();
- builder.newRow(Clustering.EMPTY);
- long now = System.currentTimeMillis();
- if (values != null)
+ AbstractType<?> type = definition.type;
+ if (type.isFrozenCollection())
+ {
+ ByteBuffer cellValue = ListSerializer.pack(values, values.size(),
CURRENT);
+ Cell cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, cellValue, null);
+ return BTreeRow.singleCellRow(Clustering.EMPTY, cell);
+ }
+ else
{
- for (int i = 0, m = values.size(); i < m; i++)
+ Row.Builder builder = BTreeRow.sortedBuilder();
+ builder.newRow(Clustering.EMPTY);
+ long now = System.currentTimeMillis();
+ if (values != null)
{
- TimeUUID uuid = TimeUUID.Generator.atUnixMillis(now, i);
- ByteBuffer key = uuid.toBytes();
- ByteBuffer value = values.get(i);
- BufferCell cell = new BufferCell(definition,
- 0L,
- Cell.NO_TTL,
- Cell.NO_DELETION_TIME,
- value,
- CellPath.create(key));
- builder.addCell(cell);
+ for (int i = 0, m = values.size(); i < m; i++)
+ {
+ BufferCell cell;
+ if (type.isUDT())
+ {
+ cell = new BufferCell(definition,
+ 0L,
+ Cell.NO_TTL,
+ Cell.NO_DELETION_TIME,
+ values.get(i),
+
((UserType)type).cellPathForField(((UserType) type).fieldName(i)));
+ }
+ else
+ {
+ TimeUUID uuid = TimeUUID.Generator.atUnixMillis(now,
i);
+ ByteBuffer key = uuid.toBytes();
+ ByteBuffer value = values.get(i);
+ cell = new BufferCell(definition,
+ 0L,
+ Cell.NO_TTL,
+ Cell.NO_DELETION_TIME,
+ value,
+ CellPath.create(key));
+ }
+ builder.addCell(cell);
+ }
}
+ return builder.build();
}
- return builder.build();
}
private static Row newRow(ColumnMetadata definition, SortedSet<ByteBuffer>
values)
{
- Row.Builder builder = BTreeRow.sortedBuilder();
- builder.newRow(Clustering.EMPTY);
- if (values != null)
+ if (definition.type.isFrozenCollection())
{
- for (ByteBuffer value : values)
+ ByteBuffer cellValue = SetSerializer.pack(values, values.size(),
CURRENT);
+ Cell cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, cellValue, null);
+ return BTreeRow.singleCellRow(Clustering.EMPTY, cell);
+ }
+ else
+ {
+ Row.Builder builder = BTreeRow.sortedBuilder();
+ builder.newRow(Clustering.EMPTY);
+ if (values != null)
{
- BufferCell cell = new BufferCell(definition,
- 0L,
- Cell.NO_TTL,
- Cell.NO_DELETION_TIME,
-
ByteBufferUtil.EMPTY_BYTE_BUFFER,
- CellPath.create(value));
- builder.addCell(cell);
+ for (ByteBuffer value : values)
+ {
+ BufferCell cell = new BufferCell(definition,
+ 0L,
+ Cell.NO_TTL,
+ Cell.NO_DELETION_TIME,
+
ByteBufferUtil.EMPTY_BYTE_BUFFER,
+ CellPath.create(value));
+ builder.addCell(cell);
+ }
}
+ return builder.build();
}
- return builder.build();
}
- private static Row newRow(ColumnMetadata definition, Map<ByteBuffer,
ByteBuffer> values)
+ private static Row newRow(ColumnMetadata definition, SortedMap<ByteBuffer,
ByteBuffer> values)
{
- Row.Builder builder = BTreeRow.sortedBuilder();
- builder.newRow(Clustering.EMPTY);
- if (values != null)
+ if (definition.type.isFrozenCollection())
+ {
+ List<ByteBuffer> packableValues =
values.entrySet().stream().flatMap(entry -> Stream.of(entry.getKey(),
entry.getValue())).collect(Collectors.toList());
+ ByteBuffer cellValue = MapSerializer.pack(packableValues,
values.size(), CURRENT);
+ Cell cell = new BufferCell(definition, 0L, Cell.NO_TTL,
Cell.NO_DELETION_TIME, cellValue, null);
+ return BTreeRow.singleCellRow(Clustering.EMPTY, cell);
+ }
+ else
{
- for (Map.Entry<ByteBuffer, ByteBuffer> entry : values.entrySet())
+ Row.Builder builder = BTreeRow.sortedBuilder();
+ builder.newRow(Clustering.EMPTY);
+ if (values != null)
{
- BufferCell cell = new BufferCell(definition,
- 0L,
- Cell.NO_TTL,
- Cell.NO_DELETION_TIME,
- entry.getValue(),
-
CellPath.create(entry.getKey()));
- builder.addCell(cell);
+ for (Map.Entry<ByteBuffer, ByteBuffer> entry :
values.entrySet())
+ {
+ BufferCell cell = new BufferCell(definition,
+ 0L,
+ Cell.NO_TTL,
+ Cell.NO_DELETION_TIME,
+ entry.getValue(),
+
CellPath.create(entry.getKey()));
+ builder.addCell(cell);
+ }
}
+ return builder.build();
+ }
+ }
+
+ private static boolean testRoundtripped(ColumnCondition.Bound bound, Row
row)
+ {
+ DataOutputBuffer dab = new DataOutputBuffer();
+ IVersionedSerializer<ColumnCondition.Bound> serializer =
ColumnCondition.Bound.serializer;
+ int version = MessagingService.current_version;
+ try
+ {
+ serializer.serialize(bound, dab, version);
+ assertEquals(serializer.serializedSize(bound, version),
dab.position());
+ ColumnCondition.Bound deserializedBound =
serializer.deserialize(new DataInputBuffer(dab.buffer(), false), version);
+ boolean originalResult = bound.appliesTo(row);
+ assertEquals(originalResult, deserializedBound.appliesTo(row));
+ return originalResult;
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
}
- return builder.build();
}
- private static boolean conditionApplies(ByteBuffer rowValue, Operator op,
ByteBuffer conditionValue)
+ private boolean conditionApplies(ByteBuffer rowValue, Operator op,
ByteBuffer conditionValue)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", Int32Type.instance);
+ AbstractType<?> columnType = Int32Type.instance;
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, false), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Constants.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ boolean regularColumnResult = testRoundtripped(bound,
newRow(definition, rowValue));
+ // Every simple bound test is also a valid test of the UDT access path
+ boolean conditionUDTApplies = conditionUDTApplies(rowValue, op,
conditionValue);
+ assertEquals(regularColumnResult, conditionUDTApplies);
+ return regularColumnResult;
}
- private static boolean conditionApplies(List<ByteBuffer> rowValue,
Operator op, List<ByteBuffer> conditionValue)
+ private boolean conditionApplies(List<ByteBuffer> rowValue, Operator op,
List<ByteBuffer> conditionValue)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", ListType.getInstance(Int32Type.instance, true));
+ boolean nonFrozenResult = conditionApplies(rowValue, op,
conditionValue, listType);
+ boolean frozenResult = conditionApplies(rowValue, op, conditionValue,
listType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return nonFrozenResult;
+ }
+
+ private boolean conditionApplies(List<ByteBuffer> rowValue, Operator op,
List<ByteBuffer> conditionValue, ListType<Integer> columnType)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Lists.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ return testRoundtripped(bound, newRow(definition, rowValue));
+ }
+
+ private boolean conditionContainsApplies(List<ByteBuffer> rowValue,
Operator op, ByteBuffer conditionValue)
+ {
+ boolean nonFrozenResult = conditionContainsApplies(rowValue, op,
conditionValue, listType);
+ boolean frozenResult = conditionContainsApplies(rowValue, op,
conditionValue, listType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return frozenResult;
}
- private static boolean conditionContainsApplies(List<ByteBuffer> rowValue,
Operator op, ByteBuffer conditionValue)
+ private boolean conditionContainsApplies(List<ByteBuffer> rowValue,
Operator op, ByteBuffer conditionValue, ListType<Integer> columnType)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", ListType.getInstance(Int32Type.instance, true));
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Constants.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ return testRoundtripped(bound, newRow(definition, rowValue));
}
- private static boolean conditionContainsApplies(Map<ByteBuffer,
ByteBuffer> rowValue, Operator op, ByteBuffer conditionValue)
+ private boolean conditionContainsApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, Operator op, ByteBuffer conditionValue)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", MapType.getInstance(Int32Type.instance, Int32Type.instance, true));
+ boolean nonFrozenResult = conditionContainsApplies(rowValue, op,
conditionValue, mapType);
+ boolean frozenResult = conditionContainsApplies(rowValue, op,
conditionValue, mapType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return frozenResult;
+ }
+
+ private boolean conditionContainsApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, Operator op, ByteBuffer conditionValue, MapType<Integer, Integer>
columnType)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Constants.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ return testRoundtripped(bound, newRow(definition, rowValue));
+ }
+
+ private boolean conditionApplies(SortedSet<ByteBuffer> rowValue, Operator
op, SortedSet<ByteBuffer> conditionValue)
+ {
+ boolean nonFrozenResult = conditionApplies(rowValue, op,
conditionValue, setType);
+ boolean frozenResult = conditionApplies(rowValue, op, conditionValue,
setType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return nonFrozenResult;
}
- private static boolean conditionApplies(SortedSet<ByteBuffer> rowValue,
Operator op, SortedSet<ByteBuffer> conditionValue)
+ private boolean conditionApplies(SortedSet<ByteBuffer> rowValue, Operator
op, SortedSet<ByteBuffer> conditionValue, SetType<Integer> columnType)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", SetType.getInstance(Int32Type.instance, true));
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Sets.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ return testRoundtripped(bound, newRow(definition, rowValue));
}
- private static boolean conditionContainsApplies(SortedSet<ByteBuffer>
rowValue, Operator op, ByteBuffer conditionValue)
+ private boolean conditionContainsApplies(SortedSet<ByteBuffer> rowValue,
Operator op, ByteBuffer conditionValue)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", SetType.getInstance(Int32Type.instance, true));
+ boolean nonFrozenResult = conditionContainsApplies(rowValue, op,
conditionValue, setType);
+ boolean frozenResult = conditionContainsApplies(rowValue, op,
conditionValue, setType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return frozenResult;
+ }
+
+ private boolean conditionContainsApplies(SortedSet<ByteBuffer> rowValue,
Operator op, ByteBuffer conditionValue, SetType<Integer> columnType)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Constants.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ return testRoundtripped(bound, newRow(definition, rowValue));
+ }
+
+ private boolean conditionApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, Operator op, SortedMap<ByteBuffer, ByteBuffer> conditionValue)
+ {
+ boolean nonFrozenResult = conditionApplies(rowValue, op,
conditionValue, mapType);
+ boolean frozenResult = conditionApplies(rowValue, op, conditionValue,
mapType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return nonFrozenResult;
}
- private static boolean conditionApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, Operator op, SortedMap<ByteBuffer, ByteBuffer> conditionValue)
+ private boolean conditionApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, Operator op, SortedMap<ByteBuffer, ByteBuffer> conditionValue,
MapType<Integer, Integer> columnType)
{
- ColumnMetadata definition = ColumnMetadata.regularColumn("ks", "cf",
"c", MapType.getInstance(Int32Type.instance, Int32Type.instance, true));
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(new Maps.Value(conditionValue)));
ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
- return bound.appliesTo(newRow(definition, rowValue));
+ return testRoundtripped(bound, newRow(definition, rowValue));
+ }
+
+ private boolean conditionElementApplies(List<ByteBuffer> values,
ByteBuffer elementIndex, Operator op, ByteBuffer elementValue)
+ {
+ boolean nonFrozenResult = conditionElementApplies(values,
elementIndex, op, elementValue, listType);
+ boolean frozenResult = conditionElementApplies(values, elementIndex,
op, elementValue, listType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return nonFrozenResult;
+ }
+
+ private boolean conditionElementApplies(List<ByteBuffer> values,
ByteBuffer elementIndex, Operator op, ByteBuffer elementValue,
ListType<Integer> columnType)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
+ ColumnCondition condition = ColumnCondition.condition(definition, new
Constants.Value(elementIndex), op, Terms.of(new Constants.Value(elementValue)));
+ ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
+ return testRoundtripped(bound, newRow(definition, values));
+ }
+
+ private boolean conditionElementApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, ByteBuffer elementKey, Operator op, ByteBuffer elementValue)
+ {
+ boolean nonFrozenResult = conditionElementApplies(rowValue,
elementKey, op, elementValue, mapType);
+ boolean frozenResult = conditionElementApplies(rowValue, elementKey,
op, elementValue, mapType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return nonFrozenResult;
+ }
+
+ private boolean conditionElementApplies(SortedMap<ByteBuffer, ByteBuffer>
rowValue, ByteBuffer elementKey, Operator op, ByteBuffer elementValue,
MapType<Integer, Integer> columnType)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(columnType, columnType.isFrozenCollection()), "c", columnType);
+ ColumnCondition condition = ColumnCondition.condition(definition, new
Constants.Value(elementKey), op, Terms.of(new Constants.Value(elementValue)));
+ ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
+ return testRoundtripped(bound, newRow(definition, rowValue));
+ }
+
+ private boolean conditionUDTApplies(ByteBuffer fieldValue, Operator op,
ByteBuffer elementValue)
+ {
+ boolean nonFrozenResult = conditionUDTApplies(fieldValue, op,
elementValue, udtType);
+ boolean frozenResult = conditionUDTApplies(fieldValue, op,
elementValue, udtType.freeze());
+ assertEquals(nonFrozenResult, frozenResult);
+ return nonFrozenResult;
+ }
+
+ private boolean conditionUDTApplies(ByteBuffer fieldValue, Operator op,
ByteBuffer elementValue, UserType type)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(type, !type.isMultiCell()), "c", type);
+ ColumnCondition condition = ColumnCondition.condition(definition,
type.fieldName(0), op, Terms.of(new Constants.Value(elementValue)));
+ ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
+ return testRoundtripped(bound, newRow(definition, fieldValue));
+ }
+
+ private boolean conditionUDTApplies(List<ByteBuffer> rowValue, Operator
op, List<ByteBuffer> conditionValue)
+ {
+ ColumnMetadata definition = ColumnMetadata.regularColumn(KEYSPACE,
maybeCreateTable(udtType, false), "c", udtType);
+ Term term = conditionValue == null ? Constants.NULL_VALUE : new
UserTypes.Value(udtType, conditionValue.toArray(new ByteBuffer[0]));
+ ColumnCondition condition = ColumnCondition.condition(definition, op,
Terms.of(term));
+ ColumnCondition.Bound bound = condition.bind(QueryOptions.DEFAULT);
+ return testRoundtripped(bound, newRow(definition, rowValue));
+ }
+
+ public void beforeTest() throws Throwable
Review Comment:
Added
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]