blob: 3dec889661bedae2a6173bb4a5a15a6a24ec49ce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "feed_reject_helper.h"
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/fieldvalue/boolfieldvalue.h>
namespace document {
bool
FeedRejectHelper::isFixedSizeSingleValue(const document::FieldValue & fv) {
return fv.isFixedSizeSingleValue();
}
bool
FeedRejectHelper::mustReject(const document::ValueUpdate & valueUpdate) {
using namespace document;
switch (valueUpdate.getType()) {
case ValueUpdate::Add:
case ValueUpdate::TensorAdd:
case ValueUpdate::TensorModify:
case ValueUpdate::Map:
return true;
case ValueUpdate::Assign: {
const auto & assign = dynamic_cast<const AssignValueUpdate &>(valueUpdate);
if (assign.hasValue()) {
if ( ! isFixedSizeSingleValue(assign.getValue())) {
return true;
}
}
}
default:
break;
}
return false;
}
bool
FeedRejectHelper::mustReject(const DocumentUpdate & documentUpdate) {
for (const auto & update : documentUpdate.getUpdates()) {
for (const auto & valueUpdate : update.getUpdates()) {
if (mustReject(*valueUpdate)) {
return true;
}
}
}
return ! documentUpdate.getFieldPathUpdates().empty();
}
}
|