question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Array of string was not implemented?

See original GitHub issue

We migrated to the new driver and we’re getting java.lang.IllegalArgumentException: Only singleton array is allowed. I checked the repo and see that Array of numbers was implemented but not array of other stuff. Am I right? Is there a way to overcome this error?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
zhicwucommented, Mar 4, 2022

I checked the repo and see that Array of numbers was implemented but not array of other stuff.

Unlike array of primitives, array of String is simply treated as Object. That’s why there’s no update(String[]) method in ClickHouseValue class and it’s not handled specifically in update(Object).

We have a table in CH with a field of type Array(String) and we’re trying to insert into it.

I see. I assume that you’re using PreparedStatement for batch insert.

If that’s the case, could you please use input function as shown in examples? To be more specific, instead of insert into mytable values(?,?,?), use insert into mytable select col1, col2, col3 from input('col1 String, col2 DateTime64(3), col3 Array(String)'), or insert into mytable for convenience. The differences are:

  1. the first query has no type information so the driver has to “guess” based on type of given parameters, and worse than that, the driver will generate a large SQL statement like insert into table values(...)(...)... and send it to server
  2. the last two provide type information needed by the driver, so it can take care of type conversion automatically and stream the data(in binary format) to the server, which is usually faster with less memory usage(on client side) and network traffic

Meanwhile, since there’ll be another patch release this weekend. I’ll see if I can enhance the driver accordingly.

0reactions
eugeniasimichcommented, Mar 8, 2022

Thanks @zhicwu!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I implement an array of strings? - Stack Overflow
Firstly. You must ALLOT permanent storage to the strings. In ciforth (my Forth) there is the word $, that does this in the...
Read more >
Why is the string type not implemented as standard type?
Storing multiple strings as a 2-D char array is lousy, because a list of N strings is not an N-element long array; it's...
Read more >
Java String Array- Tutorial With Code Examples
This tutorial on Java String Array explains how to declare, initialize & create String Arrays in Java and conversions that we can carry...
Read more >
UnimplementedFeatureError: Nested dynamic arrays not ...
1 Answer 1 ... You can't return a dynamic array of dynamic arrays from a Solidity function. From the Solidity docs: Is it...
Read more >
Array.BinarySearch Method (System) - Microsoft Learn
value does not implement the IComparable interface, and the search ... IComparable · Sort · Performing Culture-Insensitive String Operations in Arrays ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found