tvdw / perl-dbd-cassandra Goto Github PK
View Code? Open in Web Editor NEWDBD::Cassandra is a DBI driver for Cassandra/CQL3
DBD::Cassandra is a DBI driver for Cassandra/CQL3
# 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
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.
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)
How to connections on 3 nodes? Thanks.
it seems that when only 1 result is returned, selectall_arrayref returns a single hashref, rather than an arrayref with a single hashref therein.
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);
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);
Deep recursion on subroutine "Cassandra::Client::_command_dequeue" at /[...]/site/lib/Cassandra/Client.pm line 294.
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.
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.
Let's face it, we can speed this up a lot by moving encoding and decoding to XS.
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
Hi!
Cassandra is great, this module is great!
How about to add support of decimal type? Is it planned?
Error -1: Cannot find a stream ID to post query with
0.13_006
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)
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.
eg Possible unintended interpolation of @attempts in string at lib/Cassandra/Client/Pool.pm line 163.
Add the ability to change protocol_version. As I think this driver support only protocol version 3.
Bareword found where operator expected at (eval 29) line 18, near "s/\A(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})\z/$1-$2-$3-$4-$5/r"
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
It seems that you are using this bugtracking system, bit MetaCPAN https://metacpan.org/release/Cassandra-Client still links to RT as the "Issues".
Probably it would be better to include the link to the GtHub issues in the META.json file included in the distribution.
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...
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
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.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.