Git Product home page Git Product logo

perl-dbd-cassandra's People

Contributors

davewood avatar haarg avatar lrocha-bcom avatar tvdw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

perl-dbd-cassandra's Issues

32bit perl cannot work with BIGINT

#   Failed test at t/03-types.t line 31.
# Invalid type 'q' in pack at (eval 8) line 17.

#   Failed test at t/03-types.t line 31.
# Invalid type 'q' in pack at (eval 16) line 28.

#   Failed test at t/03-types.t line 31.
# Invalid type 'q' in pack at (eval 24) line 17.
# Looks like you failed 3 tests of 69.
t/03-types.t ............ 
Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/69 subtests 

Warning message

Duplicated from: https://rt.cpan.org/Public/Bug/Display.html?id=121985

Hello

I am getting this warning all the time from Cassandra::Client (via DBD::Cassandra):

Use of uninitialized value $^GLOBAL_PHASE in string eq at /usr/local/share/perl5/Cassandra/Client.pm line 396.
$ perl -v
This is perl, v5.10.1 (*) built for i386-linux-thread-multi

I would suggest that this code:

sub DESTROY {
    local $@;
    return if ${^GLOBAL_PHASE} eq 'DESTRUCT';

    my $self= shift;
    if ($self->{connected}) {
        $self->shutdown;
    }
}

Needs a slight change to:

sub DESTROY {
    local $@;
    return if (${^GLOBAL_PHASE} and ${^GLOBAL_PHASE} eq 'DESTRUCT');

    my $self= shift;
    if ($self->{connected}) {
        $self->shutdown;
    }
}

But, as they say in recipe books: add salt to taste.

Request: clone() function on $sth

When doing async inserts (as described in the pod), generating the prepared queries for large inserts (in my case 10_000 columns worth) takes quite a while and then is 10-50x more to create the handler for each parallel insert.

Would it be possible to implement a clone() function, which would be able to reused the generated serializers etc. This would make generating handlers way way faster and save hugely on memory (not having to have 10-50x copies of the same generated anonymous sub)

selectall_arrayref problem

it seems that when only 1 result is returned, selectall_arrayref returns a single hashref, rather than an arrayref with a single hashref therein.

Numbers and placeholders

When a column type is text and i provide a number to the place holder, DBD::Cassandra doesnt coerce it properly to a string by quoting it. For example...

my $sth = $dbh->prepare(q/ INSERT INTO foobar (id,text_field) VALUES (?,?) /);
$sth->execute(1,5678);

Gives an Invalid map literal error.

If i quote the number, i still get the same error.
$sth->execute(1,'5678');

So I am guessing it's DBD guessing at what to do rather than looking deep into what perl thinks the variable is.

The solution for me so far, is to quote the placeholder.

my $sth = $dbh->prepare(q/ INSERT INTO foobar (id,text_field) VALUES (?,'?') /);
$sth->execute(1,5678);

Question regarding placeholders

The postgres dbd is clever and converts \@list into a list for IN queries. Does this module do the same?

ie

@ids = qw/ 123 456 789 /;
my $sth->prepare("SELECT something FROM somethings WHERE id IN (?)");
$sth->execute(\@ids);

During rolling restarts, queries fail

Since the driver doesn't disconnect by itself when servers go away, a rolling restart triggers a large amount of errors. I'm sure we can do better than that.

Failure when inserting timestamps

Hi,

I was very happy to see this module on CPAN, thank you for writing it.

I am however having an issue inserting values in to a timestamp column. I have tried formatting my timestamp in several of formats that cassandra accepts and I am getting errors on insert like:

Argument "2016-07-15 18:23:13" isn't numeric in pack at (eval 442) line 9.

Cassandra::Client uses deprecated dependency IO::Socket::INET6

IO::Socket::INET6 causes the installation of Cassandra::Client via cpanm to fail because it has failing tests. IO::Socket::INET6 is deprecated and recommends switching to IO::Socket::IP which supports both IPv4 and IPv6.

Looks like INET6 is only used in one place in Cassandra/Client/Connection.pm

Decimal type

Hi!
Cassandra is great, this module is great!
How about to add support of decimal type? Is it planned?

Pod Tests failing

For various reasons, I am running DBD::Cassandra on centos/rhel 6 with Test::Pod 1.4

cpanm DBD::Cassandra fails because the Test::Pod tests fail

Once i cpanm Test::Pod (which takes Test::Pod to 1.51) the tests pass

I think you just need to manually set a minimum for Test::Pod in the dist.ini (although youre using autorepreq, so i didnt want to send a PR)

Unexpected warning from Policy/LoadBalancing/Default.pm

While used from DBI->DBD::Cassandra keep seeing warning
Warning: Use of uninitialized value in string eq at /usr/lib/x86_64-linux-gnu/perl5/5.22/Cassandra/Client/Policy/LoadBalancing/Default.pm line 45.

Looks, like $node->{data_center} is not set during initialization somehow.

Protocol version

Add the ability to change protocol_version. As I think this driver support only protocol version 3.

Cassandra::Client - Can't call method "get_one_cb" on an undefined value

When connection to Cassandra is lost, I often observe error:

EV: error in callback (ignoring): Can't call method "get_one_cb" on an undefined value at /usr/local/lib/x86_64-linux-gnu/perl/5.22.1/Cassandra/Client/NetworkStatus.pm line 61

61 $self->{pool}->get_one_cb($next);

Probably there should be if ($self->{pool}) { ... }

Cassandra::Client 0.13, Perl 5.22.1 on Ubuntu 16.04.3

bigendian-littleendian issue with double type

in Cassandra/Type.pm
there are the following lines:

sub p2c_double { return pack('d', 8, undef, @) }
sub c2p_double { return unpack('d', 8, undef, @) }

this causes double values to be stored incorrectly in the database (atleast for cassandra 3.3, havent tested in other versions)
(It may apply to float values also.. havent tested)

the correct code should be
sub p2c_double { return pack('d>', 8, undef, @) }
sub c2p_double { return unpack('d>', 8, undef, @) }

for example
123.4 ends up getting stored as -1.54234871456036e-180 in the database ...
if you read the value with the DBD::Cassandra you will however get the correct value out again due to the same incorrect conversion there
My issue is I used perl to store values into database and java for reading the values out again...

I solved my problem for now by doing:
my $newval = unpack('d' , pack('d>', $val));
and storing newval instead...

I see one issue though with fixing the bug... people that have been using the bugged code for storing and reading values from database would start getting wrong values for values previously stored in database... you you might need to create some kind of compatibility modus...

Expected behaviour with multiple servers

i am feeding a lot of data in to cassanda, to do so i am using the async option with 200 $sth's which are being recycled as they become available.

The connect string I am using features host=192.0.2.1,192.0.2.2,192.0.2.3,192.0.2.4 and consistency=any

My expected behaviour is that all four servers would be kept busy with the inserts, however it seems that only the first server is doing any work (based on cpu load)

I would also mention that the pod example suggests a host=$hostname, then the bullet list offers hostname and hosts which i assume are synonyms? This isnt clear though

Add a CI system

A CI system would help finding any issues as soon as you push the code to GitHub, long before it reaches CPAN.
If you are interested I'd be glad to send a pull-request configuring GitHub Actions.

How to insert a user-defined type

Hello,
I have a user-defined type as

CREATE TYPE address (
  street text,
  city text,
  zip_code int
);

and a table defined as

create table person (
  person_id int PRIMARY KEY,    
  first_name text,
  last_name text,
  email text,
  mobile text,
  address_book map<text, frozen<address>>
);  

In my perl script, I got error message like
Cannot encode type 48. Sending a NULL instead, this is probably not what you want !
when I run

$sth->prepare("INSERT INTO person (person_id, first_name, last_name, email, mobile, address_book) VALUES (?, ?, ?, ?, ?, ?)");
$sth->execute((453654, 'John', 'Lucy', 'JLucy@gmail', '33086567423', { "book_1" => { street => 'No, 34 cats road', city => 'main', zip_code => 23356}} ));

I can run however insert command in cql. Dose DBD::Cassandra support user-defined type?

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.