zoukankan      html  css  js  c++  java
  • hbase 查询空串空字段

    hbase and or 连用查询空串空字段

    private static void loadAllData2IfStatus(String tableName) {
        try {
            Table table = HbaseUtil.getTable(tableName);
            Scan scan = new Scan();
            FilterList allFilters = new FilterList(FilterList.Operator.MUST_PASS_ONE);
            // 按照平台类型
            allFilters.addFilter(new PrefixFilter(Bytes.toBytes("9" + "#")));
            FilterList allFilters2 = new FilterList(FilterList.Operator.MUST_PASS_ALL);
            SingleColumnValueFilter filterCompanyName = new SingleColumnValueFilter("info".getBytes(), "companyName".getBytes(), CompareFilter.CompareOp.EQUAL, "".getBytes());
            filterCompanyName.setFilterIfMissing(false);
    
            allFilters2.addFilter(filterCompanyName);
            allFilters2.addFilter(allFilters);
    
            scan.setFilter(allFilters2);
            ResultScanner rs = table.getScanner(scan);
            int count = 0;
            for (Result result : rs) {
                count++;
                String shopType = Bytes.toString(result.getValue("info".getBytes(), "shopType".getBytes()));
                String companyName = Bytes.toString(result.getValue("info".getBytes(), "companyName".getBytes()));
                String busLicURL = Bytes.toString(result.getValue("info".getBytes(), "busLicURL".getBytes()));  //busLicURL fodLicURL
                if (StringUtils.isEmpty(busLicURL) || "-1".equals(busLicURL)) {
                    continue;
                }
                if (StringUtils.isNotEmpty(companyName)) {
                    continue;
                }
                if (ArrayUtil.contains(shopTypes, shopType)) {
                    resultUrl.add(result);
                    processLicense();
                }
            }
            System.out.println(count);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    故乡明
  • 相关阅读:
    POJ-1182 食物链
    hdu 1879 继续畅通工程
    HDU 2604 Queuing
    hdu 1232 畅通工程
    POJ-1611 The Suspects
    Free DIY Tour
    Tr A
    不容易系列之(3)―― LELE的RPG难题
    W3C标准冒泡、捕获机制
    JavaScript 浏览器事件解读
  • 原文地址:https://www.cnblogs.com/luweiweicode/p/14072570.html
Copyright © 2011-2022 走看看