0

I am using Hypertable::ThriftClient, and using mutator for mass insertion. Here is the code sample: $master, $port and $namespace are all defined.

Table:

show create table users; # Table schema is below

CREATE TABLE GROUP_COMMIT_INTERVAL "100" users (
    'column_name_fake' MAX_VERSIONS 1,
    ACCESS GROUP audience ('column_name_fake'),
)

:hypertable$ SELECT * FROM users limit 1; # displays
2342345 sf_following:1000234
2342346 sf_following:1234234

Code:

my $ht = new Hypertable::ThriftClient($master, $port);
my $ns = $ht->namespace_open($namespace);
my $users_mutator = $ht->mutator_open($ns, 'table_name', 2);

Subroutine:

sub batch_insert {                                                                       
    my ($ht, $mutator, $column_family, $row, $val) = @_;

    my $keys;                                                                            
    my $cell;                                                                            
    try {                                                                                
        $keys = new Hypertable::ThriftGen::Key({
            row           => $row, 
            column_family => $column_family });

        $cell = new Hypertable::ThriftGen::Cell({key => $keys, value => $val});          
    }                                                                                    
    catch {                                                                              
        warn Dumper({ 'Error' => $_ });                                                  
    };                                                                                    
    $ht->mutator_set_cell($mutator, $cell);                                              
    $ht->mutator_flush($mutator);                                                        
    return 1;                                                                            
}                                                                                                                                                                                 

Function called:

for(.....) {    # Just for example
    batch_insert($ht, $users_mutator, '', $fs, "node:$node_u");
}

Here I get an exception,

 Hypertable::ThriftGen::ClientException=HASH(0x54d7380)

Can anyone clarify, why?

Edit: I added table structure for more clarity?

NullException
  • 4,232
  • 8
  • 24
  • 44
  • 1
    That's an object of class `Hypertable::ThriftGen::ClientException`. It surely has methods to give a more meaningful message, though I can't find documentation for it. – ikegami Jun 26 '13 at 04:01
  • @ikegami Thanks for your response. I understand where is it coming from but don't know, why? I am passing all that is required. I am looking directly into the internal module code itself. – NullException Jun 26 '13 at 04:08
  • The first step in determining the problem is finding out what error you got. – ikegami Jun 26 '13 at 04:10
  • It appears that, column_family => $column_family line is an issue. $column_family is undef. Could this be an issue? I provided undef for column_family because, in actual rows (2342345 sf_following:1000234), there is no column family name. I am confused, here? – NullException Jun 26 '13 at 05:08
  • I don't know anything about Hypertable. I just know that the people who do will want to know what error message you got. What error message is contained in the exception? – ikegami Jun 26 '13 at 05:32
  • Hypertable::ThriftGen::ClientException::Hash(x2546) formatted exception, thats it. I tried to catch exception using Try::Tiny but still the same exact message. – NullException Jun 26 '13 at 05:34
  • That's an object of class `Hypertable::ThriftGen::ClientException`. It surely has methods to give a more meaningful message. So, for the fourth time, what error did you actually get? – ikegami Jun 26 '13 at 05:36
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/32374/discussion-between-curious-mind-and-ikegami) – NullException Jun 26 '13 at 05:39

2 Answers2

1

The ClientException class is defined as follows:

exception ClientException { 1: i32 code 2: string message }

Try catching the exception and printing out the code (in hex) and message. That should help pinpoint what's going on.

Doug Judd
  • 362
  • 3
  • 7
0
FIX: So, this exception is raised is a required parameter 'column_qualifier' was not
     passed as per the table design. See below:

sub batch_insert {
    my ($ht, $mutator, $cf, $cq, $row, $val) = @_;
    my $keys = new Hypertable::ThriftGen::Key({
        row              => $row, 
        column_family    => $cf, 
        column_qualifier => $cq });

    my $cell = new Hypertable::ThriftGen::Cell({key => $keys, value => $val});
    $ht->mutator_set_cell($mutator, $cell);
    #$ht->mutator_flush($mutator);
}

Calling the above function:
--------------------------
batch_insert($ht, $users_mutator, 'column_family' , 'column_qualifier, 'row_key',  '');

and it worked like a charm. If you are in similar types of issues, Let me know, I can help out. I spent quite a bit of time, reading about the Thrift api.

NullException
  • 4,232
  • 8
  • 24
  • 44