|
- Properties specific to the description of hbScanParameter variables
- Browsing data according to the filter
- Examples of filters
hbScanParameter (Type of variable) In french: hbParamètreScan
The hbScanParameter type is used to define the parameters of a browse performed in a HBase table. The characteristics of these browse parameters can be defined and modified by several WLanguage properties. Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
// Connection Connection is hbConnection Connection..Server = "MyServer" // Filter description MyScan is hbScanParameter MyScan..Connection = Connection MyScan..Table = "blog" // Filters, for all the rows, the values of columns whose name starts with "Title" MyScan..Filter = "{ ""type"": ""ColumnPrefixFilter"", ""value"": """ + ... Crypt("Title", "", compressNone + cryptNone, encodeBASE64) + """ }" // Browse the filter and display the filtered data // The type of the browse variable MyResult is hbScanResult FOR EACH MyResult OF MyScan Trace("The column " + MyResult..Column..Family + ":" + ... MyResult..Column..Qualifier + ... " of the row " + MyResult..Row + " is set to " + MyResult..Value) END
Remarks Properties specific to the description of hbScanParameter variables The following properties can be used to handle the description of browse parameters: | | | Property name | Type used | Effect |
---|
Column | Array of hbColumn | Families or columns (items) found in the browse result. | Connection | hbConnection variable | Connection to the HBase server that will be used for the browse. | StartTimestamp | DateTime | Start date and time for selecting rows. The browse will return the rows containing cells from this date and time. | EndTimestamp | DateTime | End date and time for selecting rows. The browse will return the rows containing cells up to this date and time. | Filter | Character string | Filter that will be applied during the browse. This filter is in JSON format. The literal values must be encoded in Base64, by using Encrypt for example. See the HBase documentation for more details. | StartRow | Buffer | Identifier of the row (record) for start of browse. This row will be included in the browse. | EndRow | Buffer | Identifier of the row (record) for end of browse. This row will not be included in the browse. | MaxVersion | Integer | Maximum number of versions returned for each cell (value of item). Indeed, a history of values is stored in the HBase database for each cell. | Table | Character string | Name of HBase table to browse. |
Remark: These properties can be handled by using one of the following syntaxes: - <Variable name>..<Property name>
- <Variable name>.<Property name>
Browsing data according to the filter To browse data according to a filter, you must: - Define the ..Filter property of the variable.
- Use the FOR EACH syntax to initialize the browse with the filter. The following syntax must be used:
FOR EACH <Result> ON <Variable Of Scan Setting>
In this syntax, <Result> is a hbScanResult (see the example).
Examples of filters - Filter on the column value: MyFamily:MyQualifier = ‘Value’
MyScan..Filter = ... "{" + ... """type"": ""SingleColumnValueFilter""," + ... """op"": ""EQUAL""," + ... """family"": """ + Crypt("MyFamily", "", compressNone + cryptNone, encodeBASE64) + """," + ... """qualifier"": """ + Crypt("MyQualifier", "", ... compressNone + cryptNone, encodeBASE64) + """," + ... """latestVersion"": true," + ... """comparator"": {" + ... """type"": ""BinaryComparator""," + ... """value"": """ + Crypt("Value", "", ... compressNone + cryptNone, encodeBASE64) + """}" + ... "}"
- Filter the columns whose name starts with "Title":
MyScan..Filter = ... "{" + ... """type"": ""ColumnPrefixFilter""," + ... """value"": """ + Crypt("Title", "", compressNone + cryptNone, encodeBASE64) + """," + ... "}"
- Filter the data according to several filters:
MyScan..Filter = ... "{" + ... """type"": ""FilterList""," + ... """op"": ""MUST_PASS_ALL""," + ... """filters"": [" + ... "{" + ... filter1 + ... "}," + ... "{" + ... filter2 + ... "}" + ... "]" + ... "}"
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |