Giter Site home page Giter Site logo

Comments (5)

moshewe avatar moshewe commented on May 29, 2024

Have you tried calling the scan method?
Can you detail the call and parameters to the scan method here?

from node-thrift2-hbase.

kuake avatar kuake commented on May 29, 2024

my code:

var scan = hbaseClient.Scan();
    scan.setStartRow(start);
    scan.setStopRow(end);
    scan.add('p');
    scan.setLimit(maxCount);

    hbaseClient.scan(tbName, scan, function(err,data){
      if(err){
        logger.error('scan error:',err);
      }

      hbasePool.release(hbaseClient);
      callback(err, data);
    });

but didn't know how to set filter to key .
keys like:
20170309204003AAAA 20170309204004BBBB 20170309204005CCCC ... 20170309204006AAAA

how to scan filter 'AAAA'
and start='20170309204003'
end='20170309204006'
Thanks for your help!

from node-thrift2-hbase.

moshewe avatar moshewe commented on May 29, 2024

First, you are using an internal object within the library (lib/client.js) - if you use the service made available by require('node-thrift2-hbase'), you can simply call the scan method in the required object and save yourself the pool manupuldation.

Second, your question actually deals with key filtering and design. The "highest" character is ~ , so if you use 20170309204006~ as the stop row key. For the start key, you can use just 20170309204003.

from node-thrift2-hbase.

kuake avatar kuake commented on May 29, 2024

Thanks you for your reply!

First, I find scan in lib/service.js:

Service.prototype.scan = function (table, options, callback) {
    var hbasePool = this.clientPool;

    this.clientPool.acquire(function (err, hbaseClient) {
        if (err)
            return callback(err);

        var scan = hbaseClient.Scan();
        hbaseClient.scan(table, scan,
            function releaseAndCallback(err, data) {
                if (err) {
                    //destroy client on error
                    hbasePool.destroy(hbaseClient);
                    return callback(err);
                }
                //release client in the end of use.
                hbasePool.release(hbaseClient);
                return callback(null, data);
            })
    });
};

parameter options is not effect.
Could you show example code,
and Can you explain what is the best practice? Thank you very much!

Second, when use 20170309204006~ as the stop row key. and 20170309204003 is start row key,
How filter key suffix: 'AAAA', not 'BBBB'? Is there is a simple and efficient way to filter ?

from node-thrift2-hbase.

moshewe avatar moshewe commented on May 29, 2024

I've merged your pull request #3 .
Too bad it doesn't integrate into the main library and just adds the filterString, so scans are still not available to everyone. I'll start working on it though.

from node-thrift2-hbase.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.