ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / Big Data / Managing HBase databases
  • Properties specific to the description of hbScanParameter variables
  • Iterating over data with the filter
  • Examples of filters
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The hbScanParameter type is used to define the parameters for iterating over the records in an HBase database. The characteristics of these iteration parameters can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// 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"": """ + ...
Encode("Title", encodeBASE64) + """ }"
// Loops through and displays the filtered data
// MyResult is an hbScanResult variable
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 iteration parameters:
Property nameType usedEffect
ColumnArray of hbColumnFamilies or columns (items) found in the result of the iteration.
ConnectionhbConnection variableConnection to the HBase server to be used for the iteration.
EndRowBufferIdentifier of the last row (record) of the iteration. This row will not be included in the iteration.
EndTimestampDateTimeEnd date and time for selecting rows. The iteration will only return the rows containing cells up to this date and time.
FilterCharacter stringFilter that will be applied during the iteration. This filter is in JSON format. The literal values must be encoded in Base64, by using Encode for example.
See the HBase documentation for more details.
MaxVersionIntegerMaximum number of versions returned for each cell (value of item). Indeed, a history of values is stored in the HBase database for each cell.
StartRowBufferIdentifier of the first row (record) of the iteration. This row will be included in the iteration.
StartTimestampDateTimeStart date and time for selecting rows. The iteration will only return the rows containing cells from this date and time.
TableCharacter stringName of the HBase table to iterate over.

Iterating over data with the filter

To iterate over data with a filter:
  • Define the Filter property of the variable.
  • Use the FOR EACH syntax to initialize the iteration 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

  1. Filter on the column value: MyFamily:MyQualifier = ‘Value'
    MyScan.Filter = ...
    "{" + ...
    """type"": ""SingleColumnValueFilter""," + ...
    """op"": ""EQUAL""," + ...
    """family"": """ + Encode("MyFamily", encodeBASE64) + """," + ...
    """qualifier"": """ + Encode("MyQualifier", encodeBASE64) + """," + ...
    """latestVersion"": true," + ...
    """comparator"": {" + ...
    """type"": ""BinaryComparator""," + ...
    """value"": """ + Encode("Value", encodeBASE64) + """}" + ...
    "}"
  2. Filter the columns whose name starts with "Title":
    MyScan.Filter = ...
    "{" + ...
     """type"": ""ColumnPrefixFilter""," + ...
     """value"": """ + Encode("Title", encodeBASE64) + """," + ...
    "}"
  3. Filter the data according to several filters:
    MyScan.Filter = ...
    "{" + ...
     """type"": ""FilterList""," + ...
     """op"": ""MUST_PASS_ALL""," + ...
     """filters"": [" + ...
       "{" + ...
    filter1 + ...
       "}," + ...
    "{" + ...
    filter2 + ...
    "}" + ...
     "]" + ...
    "}"
Minimum version required
  • Version 21
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help