Unable to retrieve more than 14 columns from a table (cassandra-driver)

已查看 79 次
跳至第一个未读帖子

na...@desker.co

未读,
2017年12月30日 02:02:122017/12/30
收件人 DataStax Node.js Driver for Apache Cassandra Mailing List
Hi,
    When trying to retrieve more than 14 columns from a table (cassandra-driver).
    
{ RangeError [ERR_INDEX_OUT_OF_RANGE]: Index out of range
    at checkOffset (buffer.js:1019:11)
    at Buffer.readInt32BE (buffer.js:1186:5)


The table has 28 columns.

Thanks.

Jorge Bay Gondra

未读,
2018年1月3日 05:25:202018/1/3
收件人 nodejs-dr...@lists.datastax.com
Hi,
The amount of columns in the results is represented with an int, so you are not hitting a limitation on that side.

In order to reproduce the issue, can you give more information:
a) Which version of the driver are you using? If you are using an older version, have you tried upgrading to the last version of the driver?
b) Does this issue occurred after altering the table?
c) Are you using the prepare flag?
d) Can you provide a code sample?

Thanks,
Jorge

Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

--
You received this message because you are subscribed to the Google Groups "DataStax Node.js Driver for Apache Cassandra Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.

Nani Kalyan

未读,
2018年1月3日 05:57:092018/1/3
收件人 nodejs-dr...@lists.datastax.com
Thank you very much for your response.

a) Version: cassandr...@3.3.0 
b) I did not alter the table but ran the query on different tables with different column sizes. Tables with less than 14 columns are working fine but not with more than 14 columns.
c) Yes
d) PFA

To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsubscribe@lists.datastax.com.

--
You received this message because you are subscribed to the Google Groups "DataStax Node.js Driver for Apache Cassandra Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.
code.txt

Jorge Bay Gondra

未读,
2018年1月3日 06:27:312018/1/3
收件人 nodejs-dr...@lists.datastax.com
It looks like the signature of the method is invalid, you must declare optional parameters from left to right (except callback).

These are valid calls:

client.execute(query, callback)
client.execute(query, params, callback)
client.execute(query, params, options, callback)

but this is not:

client.execute(query, options, callback)

In your case, it would be:

client.execute(query, null, { prepare: true }, callback)

To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsubscribe@lists.datastax.com.


Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

--
You received this message because you are subscribed to the Google Groups "DataStax Node.js Driver for Apache Cassandra Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.

Nani Kalyan

未读,
2018年1月3日 07:31:202018/1/3
收件人 nodejs-dr...@lists.datastax.com
I modified the code accordingly. I do not think that is the cause of the issue.

Still, the issue persists

query failed | SELECT * FROM transactionsbyactivity;
{ RangeError [ERR_INDEX_OUT_OF_RANGE]: Index out of range
    at checkOffset (buffer.js:1019:11)
    at Buffer.readInt32BE (buffer.js:1186:5)
    at Function.Long.fromBuffer (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/types/index.js:469:25)
    at Encoder.decodeLong (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/encoder.js:147:17)
    at Encoder.decodeTimestamp (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/encoder.js:156:26)
    at Encoder.decode (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/encoder.js:1239:18)
    at Parser.parseRows (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/streams.js:377:36)
    at Parser.parseResult (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/streams.js:335:10)
    at Parser.parseBody (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/streams.js:185:19)
    at Parser._transform (/home/nani/Documents/CassandraNodeJs/node_modules/cassandra-driver/lib/streams.js:137:10)
  coordinator: '127.0.0.1:9042',
  query: 'SELECT * FROM transactionsbyactivity;' }

===============================================================================================================================
When it is only one column then it is working fine and below is the output

- query success | SELECT actvtyid FROM transactionsbyactivity;
Success
Result : {"info":{"queriedHost":"127.0.0.1:9042","triedHosts":{"127.0.0.1:9042":null},"speculativeExecutions":0,"achievedConsistency":10},"rows":[{"actvtyid":"104"},{"actvtyid":"104"},{"actvtyid":"103"},{"actvtyid":"103"},{"actvtyid":"103"},{"actvtyid":"103"},{"actvtyid":"103"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"10347"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"},{"actvtyid":"0"}],"rowLength":86,"columns":[{"name":"actvtyid","type":{"code":2,"type":null}}],"pageState":null}




To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.

Jorge Bay Gondra

未读,
2018年1月3日 07:49:042018/1/3
收件人 nodejs-dr...@lists.datastax.com
It looks like a driver bug but I can't reproduce it.

According to the stack trace, it looks related to the data and not the column metadata:

My guess is that is related to the data more than the schema itself...

Can you select a single row? like:

SELECT * FROM table LIMIT 1

Can you select based on column names, adding 1 by 1, like:

SELECT col1, col2, col3 FROM table;

And continue adding columns to the result set until you find the offending cell value / column? ...

SELECT col1, col2, col3, col4, col5, col6 FROM table;

And so on...

Thanks,
Jorge


To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.

Nani Kalyan

未读,
2018年1月3日 08:21:052018/1/3
收件人 nodejs-dr...@lists.datastax.com
I did this before and it fails exactly when I add the 15th column. 
Now I will do it again and email you the results.

Thanks,
Nani Kalyan V.

To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.

Nani Kalyan

未读,
2018年1月5日 04:55:262018/1/5
收件人 nodejs-dr...@lists.datastax.com

---------- Forwarded message ----------
From: Jorge Bay Gondra <jorgeba...@gmail.com>
Date: Fri, Jan 5, 2018 at 3:15 PM
Subject: Re: Unable to retrieve more than 14 columns from a table (cassandra-driver)
To: Nani Kalyan <na...@desker.co>


Hi Nani,
Glad to hear you found the root cause!!
You've replied to my private email instead of the mailing list, could you move this message to the public mailing list?
That way other people can benefit from your findings.

It looks like a driver bug, once we nailed the origin of the issue, we can submit a ticket and fix it.
Can you use timestampAsBlob() function to see whats the value in bytes and post the results? 
SELECT timestampAsBlob(reqtime) FROM transactionsbyactivity LIMIT 2

Hope I hear from you on the mailing list.
Thanks,
Jorge



2018-01-05 10:26 GMT+01:00 Nani Kalyan <na...@desker.co>:
Hi,
     I think I found the solution. It is not the problem with the number of columns. 
     In my case, there are four timestamp columns (15th column in one). If I retrieve any of these timestamp columns in the query and the column has no data (empty) then the error is occurring. The error is not occurring when there is data in the column.

I modified my code like SELECT toDate(reqtime) FROM transactionsbyactivity LIMIT 2;" to handle the empty timestamp column and it is not throwing an error.

Thanks a lot for helping me.

Can I know why is this happening with empty timestamp columns? Why can't the driver handle it?

Thanks,
V Nani Kalyan.

Nani Kalyan

未读,
2018年1月5日 06:45:562018/1/5
收件人 nodejs-dr...@lists.datastax.com
Hi,
     PFA for the output of the statement

     SELECT timestampAsBlob(reqtime) FROM transactionsbyactivity LIMIT 2

Thanks

On Fri, Jan 5, 2018 at 3:15 PM, Jorge Bay Gondra <jorgeba...@gmail.com> wrote:
Hi Nani,
Glad to hear you found the root cause!!
You've replied to my private email instead of the mailing list, could you move this message to the public mailing list?
That way other people can benefit from your findings.

It looks like a driver bug, once we nailed the origin of the issue, we can submit a ticket and fix it.
Can you use timestampAsBlob() function to see whats the value in bytes and post the results? 
SELECT timestampAsBlob(reqtime) FROM transactionsbyactivity LIMIT 2

Hope I hear from you on the mailing list.
Thanks,
Jorge


2018-01-05 10:26 GMT+01:00 Nani Kalyan <na...@desker.co>:
Hi,
     I think I found the solution. It is not the problem with the number of columns. 
     In my case, there are four timestamp columns (15th column in one). If I retrieve any of these timestamp columns in the query and the column has no data (empty) then the error is occurring. The error is not occurring when there is data in the column.

I modified my code like SELECT toDate(reqtime) FROM transactionsbyactivity LIMIT 2;" to handle the empty timestamp column and it is not throwing an error.

Thanks a lot for helping me.

Can I know why is this happening with empty timestamp columns? Why can't the driver handle it?

Thanks,
V Nani Kalyan.
output.txt

Jorge Bay Gondra

未读,
2018年1月5日 11:38:512018/1/5
收件人 nodejs-dr...@lists.datastax.com
Thanks Nani, I'll try to reproduce locally.

Can you double check if its a buffer of length 0?
Which version of Apache Cassandra or DataStax Enterprise are you using?

To unsubscribe from this group and stop receiving emails from it, send an email to nodejs-driver-user+unsub...@lists.datastax.com.

回复全部
回复作者
转发
0 个新帖子