Examples of BytesArray


Examples of org.elasticsearch.common.bytes.BytesArray

        assert (transferId != null);
        PutChunkRequest request = new PutChunkRequest(
            index,
            Hex.decodeHex(digest),
            transferId,
            new BytesArray(buffer.array()),
            size,
            last
        );
        size += buffer.readableBytes();
        PutChunkResponse response = client.execute(PutChunkAction.INSTANCE, request).actionGet();
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

                                        if (recoverySettings.rateLimiter() != null) {
                                            recoverySettings.rateLimiter().pause(toRead);
                                        }

                                        indexInput.readBytes(buf, 0, toRead, false);
                                        BytesArray content = new BytesArray(buf, 0, toRead);
                                        transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.FILE_CHUNK, new RecoveryFileChunkRequest(request.recoveryId(), request.shardId(), md, position, content),
                                                TransportRequestOptions.options().withCompress(shouldCompressRequest).withType(TransportRequestOptions.Type.RECOVERY).withTimeout(internalActionTimeout), EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
                                        readCount += toRead;
                                    }
                                } catch (Exception e) {
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

                    remainingBytes -= bytesRead;

                    transportService.submitRequest(
                        recipientNode,
                        BlobHeadRequestHandler.Actions.PUT_BLOB_HEAD_CHUNK,
                        new PutBlobHeadChunkRequest(transferId, new BytesArray(buffer, 0, bytesRead)),
                        TransportRequestOptions.options(),
                        EmptyTransportResponseHandler.INSTANCE_SAME
                    ).txGet();
                }
            }
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

    @Test
    public void testArgsParser() throws Exception {
        SQLXContentSourceContext context = new SQLXContentSourceContext();
        SQLXContentSourceParser parser = new SQLXContentSourceParser(context);
        BytesArray source = new BytesArray("{\n" +
            "    \"stmt\": \"select * from locations where id = $2\",\n" +
            "    \"args\": [[\"1\", \"2\"], \"1\", 1, 2, 2.0, 99999999999999999999999999999999]\n" +
            "}\n");
        parser.parseSource(source);

View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

    @Test
    public void testArgsParserNestedList() throws Exception {

        SQLXContentSourceContext context = new SQLXContentSourceContext();
        SQLXContentSourceParser parser = new SQLXContentSourceParser(context);
        BytesArray source = new BytesArray("{\n" +
            "    \"stmt\": \"select * from locations where id = $2\",\n" +
            "    \"args\": [[\"1\", \"2\", [\"1\"]], \"1\", 1, 2, 2.0, 99999999999999999999999999999999]\n" +
            "}\n");
        parser.parseSource(source);
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

    @Test
    public void testArgsParserNestedMap() throws Exception {

        SQLXContentSourceContext context = new SQLXContentSourceContext();
        SQLXContentSourceParser parser = new SQLXContentSourceParser(context);
        BytesArray source = new BytesArray("{\n" +
            "    \"stmt\": \"select * from locations where id = $2\",\n" +
            "    \"args\": [{\"1\": \"2\"}, 1]\n" +
            "}\n");
        parser.parseSource(source);
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

    @Test
    public void testArgsParserVeryNestedMap() throws Exception {

        SQLXContentSourceContext context = new SQLXContentSourceContext();
        SQLXContentSourceParser parser = new SQLXContentSourceParser(context);
        BytesArray source = new BytesArray("{\n" +
            "    \"stmt\": \"select * from locations\",\n" +
            "    \"args\": [{\"1\": {\"2\": {\"3\": 3}}}, [{\"1\": {\"2\": [2, 2]}}]]\n" +
            "}\n");
        parser.parseSource(source);
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

Examples of org.elasticsearch.common.bytes.BytesArray

        return source;
    }

    @Required
    public ImportRequest source(String source) {
        return this.source(new BytesArray(source), false);
    }
View Full Code Here

Examples of org.elasticsearch.hadoop.util.BytesArray

                else {
                    pool.get().bytes(val);
                }
            }
            else {
                BytesArray ba = pool.get();
                JacksonJsonGenerator generator = new JacksonJsonGenerator(new FastByteArrayOutputStream(ba));
                valueWriter.write(value, generator);
                generator.flush();
                generator.close();

                // jackson likely will add leading/trailing "" which are added down the pipeline so remove them
                // however that's not mandatory in case the source is a number (instead of a string)
                if ((lookForQuotes && !addQuotesIfNecessary) && ba.bytes()[ba.offset()] == '"') {
                    ba.size(Math.max(0, ba.length() - 2));
                    ba.offset(1);
                }
            }
        }
View Full Code Here

Examples of org.elasticsearch.hadoop.util.BytesArray

    @Override
    protected Object preProcess(Object object, BytesArray storage) {
        // serialize the json early on and copy it to storage
        Assert.notNull(object, "Empty/null JSON document given...");

        BytesArray ba = null;
        if (ConfigurationOptions.ES_OPERATION_UPSERT.equals(settings.getOperation())) {
            ba = storage;
        }
        else {
            scratchPad.reset();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.