2020import com .clickhouse .client .api .query .QuerySettings ;
2121import com .clickhouse .data .ClickHouseFormat ;
2222import com .clickhouse .data .ClickHouseVersion ;
23- import com .clickhouse .data .stream .ByteArrayQueueInputStream ;
2423import org .apache .commons .lang3 .StringEscapeUtils ;
2524import org .testcontainers .shaded .org .apache .commons .lang3 .RandomStringUtils ;
2625import org .testng .Assert ;
3837import java .util .ArrayList ;
3938import java .util .Arrays ;
4039import java .util .Collections ;
41- import java .util .LinkedList ;
4240import java .util .List ;
43- import java .util .Queue ;
4441import java .util .UUID ;
4542import java .util .concurrent .TimeUnit ;
4643
@@ -70,7 +67,6 @@ public InsertTests(boolean useClientCompression, boolean useHttpCompression) {
7067 public void setUp () throws IOException {
7168 ClickHouseNode node = getServer (ClickHouseProtocol .HTTP );
7269 int bufferSize = (7 * 65500 );
73-
7470 client = new Client .Builder ()
7571 .addEndpoint (Protocol .HTTP , node .getHost (), node .getPort (), false )
7672 .setUsername ("default" )
@@ -81,6 +77,7 @@ public void setUp() throws IOException {
8177 .setSocketRcvbuf (bufferSize )
8278 .setClientNetworkBufferSize (bufferSize )
8379 .build ();
80+
8481 settings = new InsertSettings ()
8582 .setDeduplicationToken (RandomStringUtils .randomAlphabetic (36 ))
8683 .setQueryId (String .valueOf (UUID .randomUUID ()));
@@ -233,38 +230,6 @@ public void insertRawData() throws Exception {
233230 assertEquals (records .size (), 1000 );
234231 }
235232
236-
237- @ Test (groups = { "integration" }, enabled = true )
238- public void insertRawDataQueued () throws Exception {
239- final String tableName = "raw_data_table" ;
240- final String createSQL = "CREATE TABLE " + tableName +
241- " (Id UInt32, event_ts Timestamp, name String, p1 Int64, p2 String) ENGINE = MergeTree() ORDER BY ()" ;
242-
243- initTable (tableName , createSQL );
244- settings .setInputStreamCopyBufferSize (8198 * 2 );
245- settings .compressClientRequest (true );
246- Queue <byte []> queue = new LinkedList <>();
247- ByteArrayQueueInputStream qIn = new ByteArrayQueueInputStream (queue , null );
248- for (int i = 0 ; i < 10 ; i ++) {
249- if (i > 2 && i < 5 ) {
250- queue .add (new byte [0 ]);
251- } else {
252- queue .add (String .format ("{ \" Id\" : %d, \" events_ts\" : \" %s\" , \" name\" : \" %s\" , \" p1\" : \" %d\" , \" p2\" : \" %s\" }\n " , i , "2021-01-01 00:00:00" , "name" + i , i , "p2" ).getBytes ());
253- }
254- }
255- InsertResponse response = client .insert (tableName , qIn ,
256- ClickHouseFormat .JSONEachRow , settings ).get (30 , TimeUnit .SECONDS );
257-
258- assertEquals ((int )response .getWrittenRows (), 10 );
259-
260- List <GenericRecord > records = client .queryAll ("SELECT * FROM " + tableName );
261- assertEquals (records .size (), 10 );
262- for (GenericRecord record : records ) {
263- System .out .println (record .getString (1 ) + " " +record .getString (2 ) + " " +record .getString (3 ) + " " +record .getString (4 ) + " " +record .getString (5 ) + " " );
264- }
265- }
266-
267-
268233 @ Test (groups = { "integration" }, enabled = true )
269234 public void insertRawDataSimple () throws Exception {
270235 insertRawDataSimple (1000 );
0 commit comments