Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,34 @@ $else$
$type$ get$Type$(int valueIndex);
$endif$

/**
* Checks if this block has the given value at valueIndex. If at this index we have a
* multivalue, then it returns true if any values match.
*
* @param valueIndex the index at which we should check the value(s)
* @param value the value to check against
*/
default boolean hasValue(int valueIndex, $type$ value) {
final var count = getValueCount(valueIndex);
final var startIndex = getFirstValueIndex(valueIndex);
$if(BytesRef)$
var ref = new BytesRef();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd pass the scratch in for this in BytesRefBlock. One scratch per position feels like a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, long day. Renamed it to position.

I've moved the scratch up one level though in the back of my mind I do wonder if we'll have a net gain from this as we might just break escape analysis 'a stack too far' so to speak.

$endif$
for (int index = startIndex; index < startIndex + count; index++) {
$if(BytesRef)$
ref = getBytesRef(index, ref);
if (value.equals(ref)) {
return true;
}
$else$
if (value == get$Type$(index)) {
return true;
}
$endif$
}
return false;
}

@Override
$Type$Vector asVector();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2102,27 +2102,30 @@ a | [a, b, c] | null | true | true | false | true
mvContainsCombinations_multirow
required_capability: fn_mv_contains

ROW row_number = [1,2,3,4,5], element = "e", n = null, setA = ["b","d"], setB = ["a", "c", "e"]
ROW row_number = [0,1,2,3,4,5], element = "e", n = null, emptyStringSet = [""], setA = ["b","d"], setB = ["a", "c", "e"]
| MV_EXPAND row_number
| EVAL superset = CASE(
row_number == 1, ["a","e"],
row_number == 2, ["b","d"],
row_number == 3, null,
row_number == 4, ["a","e","c","b","d"],
row_number == 5, ["a","d","c","b","e"],
row_number == 0, ["a","e"],
row_number == 1, ["b","d"],
row_number == 2, null,
row_number == 3, ["a","e","c","b","d"],
row_number == 4, ["a","d","c","b","e"],
row_number == 5, ["a","d","c","b","","e"],
null)
| EVAL contains_element = mv_contains(superset, element),
contains_null = mv_contains(superset, n),
contains_setA = mv_contains(superset, setA),
contains_setB = mv_contains(superset, setB)
;

row_number:INTEGER | element:keyword | n:null | setA:keyword | setB:keyword | superset:keyword |contains_element:boolean | contains_null:boolean | contains_setA:boolean | contains_setB:boolean
1 | "e" | null | ["b","d"] | ["a", "c", "e"] | ["a","e"] | true | true | false | false
2 | "e" | null | ["b","d"] | ["a", "c", "e"] | ["b","d"] | false | true | true | false
3 | "e" | null | ["b","d"] | ["a", "c", "e"] | null | false | true | false | false
4 | "e" | null | ["b","d"] | ["a", "c", "e"] | ["a","e","c","b","d"] | true | true | true | true
5 | "e" | null | ["b","d"] | ["a", "c", "e"] | ["a","d","c","b","e"] | true | true | true | true
| EVAL contains_element = mv_contains(superset, element),
contains_null = mv_contains(superset, n),
contains_emptyStringSet = mv_contains(superset, emptyStringSet),
contains_setA = mv_contains(superset, setA),
contains_setB = mv_contains(superset, setB)
;

row_number:INTEGER | element:keyword | n:null | emptyStringSet:keyword | setA:keyword | setB:keyword | superset:keyword |contains_element:boolean | contains_null:boolean | contains_emptyStringSet:boolean | contains_setA:boolean | contains_setB:boolean
0 | "e" | null | [""] | ["b","d"] | ["a", "c", "e"] | ["a","e"] | true | true | false | false | false
1 | "e" | null | [""] | ["b","d"] | ["a", "c", "e"] | ["b","d"] | false | true | false | true | false
2 | "e" | null | [""] | ["b","d"] | ["a", "c", "e"] | null | false | true | false | false | false
3 | "e" | null | [""] | ["b","d"] | ["a", "c", "e"] | ["a","e","c","b","d"] | true | true | false | true | true
4 | "e" | null | [""] | ["b","d"] | ["a", "c", "e"] | ["a","d","c","b","e"] | true | true | false | true | true
5 | "e" | null | [""] | ["b","d"] | ["a", "c", "e"] | ["a","d","c","b","","e"] | true | true | true | true | true
;

mvContains_where
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading