... | ... | @@ -72,7 +72,7 @@ second one. This should be written using a `columnNo` parameter to a more gen |
|
|
kernel, and performing the necessary number of `ScanTo` and `Advance` operations.
|
|
|
The name of the kernel should actually be different for each columnNo.
|
|
|
```
|
|
|
MaskOutField::MaskOutField2(BuilderRef b, StreamSet * Record_separators,
|
|
|
MaskOutField::MaskOutField(BuilderRef b, StreamSet * Record_separators,
|
|
|
StreamSet * Field_separators,
|
|
|
StreamSet * toKeep,
|
|
|
unsigned columnNo)
|
... | ... | @@ -85,3 +85,24 @@ MaskOutField::MaskOutField2(BuilderRef b, StreamSet * Record_separators, |
|
|
Finally, the first column must be handled differently. In this case, there is
|
|
|
no preceding comma, so the mask should zero out the following comma rather than the
|
|
|
preceding comma.
|
|
|
|
|
|
## Matching and Deleting a Row
|
|
|
|
|
|
Suppose that we have a regular expression R to select CSV rows for deletion.
|
|
|
The Parabix regular expression engine can be used to perform the matching and
|
|
|
`FilterByMask` can be used for the deletion.
|
|
|
|
|
|
Using the ICGrepKernel to perform the matching may be implemented as follows.
|
|
|
|
|
|
```
|
|
|
auto options = std::make_unique<GrepKernelOptions>(&cc::UTF8);
|
|
|
options->setSource(BasisBits);
|
|
|
StreamSet * MatchResults = P->CreateStreamSet(1, 1);
|
|
|
options->setResults(MatchResults);
|
|
|
options->setRE(R);
|
|
|
P->CreateKernelCall<ICGrepKernel>(std::move(options));
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|