Java Code Examples for org.elasticsearch.common.io.stream.StreamInput#readGenericValue()

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readGenericValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SQLResponse.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);

    boolean negative = in.readBoolean();
    rowCount = in.readVLong();
    if (negative) {
        rowCount = -rowCount;
    }

    int numCols = cols().length;
    int numRows = in.readInt();
    rows = new Object[numRows][numCols];
    for (int i = 0; i < numRows; i++) {
        for (int j = 0; j < numCols; j++) {
            rows[i][j] = in.readGenericValue();
        }
    }
}
 
Example 2
Source File: SQLBulkRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);

    int bulkArgsLength = in.readVInt();
    if (bulkArgsLength == 0) {
        bulkArgs = EMPTY_BULK_ARGS;
    } else {
        bulkArgs = new Object[bulkArgsLength][];
        for (int i = 0; i < bulkArgsLength; i++) {
            int bulkArgLength = in.readVInt();
            bulkArgs[i] = new Object[bulkArgLength];
            for (int j = 0; j < bulkArgLength; j++) {
                bulkArgs[i][j] = in.readGenericValue();
            }
        }
    }
}
 
Example 3
Source File: Settings.java    From crate with Apache License 2.0 6 votes vote down vote up
public static Settings readSettingsFromStream(StreamInput in) throws IOException {
    Builder builder = new Builder();
    int numberOfSettings = in.readVInt();
    for (int i = 0; i < numberOfSettings; i++) {
        String key = in.readString();
        Object value = in.readGenericValue();
        if (value == null) {
            builder.putNull(key);
        } else if (value instanceof List) {
            builder.putList(key, (List<String>) value);
        } else {
            builder.put(key, value.toString());
        }
    }
    return builder.build();
}
 
Example 4
Source File: SQLRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int length = in.readVInt();
    args = new Object[length];
    for (int i = 0; i < length; i++) {
        args[i] = in.readGenericValue();
    }
}
 
Example 5
Source File: InternalScriptedMetric.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    if (in.readBoolean()) {
        reduceScript = Script.readScript(in);
    }
    aggregation = in.readGenericValue();
}
 
Example 6
Source File: BucketSelectorPipelineAggregator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    script = Script.readScript(in);
    gapPolicy = GapPolicy.readFrom(in);
    bucketsPathsMap = (Map<String, String>) in.readGenericValue();
}
 
Example 7
Source File: BucketScriptPipelineAggregator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    script = Script.readScript(in);
    formatter = ValueFormatterStreams.readOptional(in);
    gapPolicy = GapPolicy.readFrom(in);
    bucketsPathsMap = (Map<String, String>) in.readGenericValue();
}
 
Example 8
Source File: Lucene.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private static Object readMissingValue(StreamInput in) throws IOException {
    final byte id = in.readByte();
    switch (id) {
    case 0:
        return in.readGenericValue();
    case 1:
        return SortField.STRING_FIRST;
    case 2:
        return SortField.STRING_LAST;
    default:
        throw new IOException("Unknown missing value id: " + id);
    }
}
 
Example 9
Source File: AnalyzeResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    term = in.readString();
    startOffset = in.readInt();
    endOffset = in.readInt();
    position = in.readVInt();
    type = in.readOptionalString();
    if (in.getVersion().onOrAfter(Version.V_2_2_0)) {
        attributes = (Map<String, Object>) in.readGenericValue();
    }
}
 
Example 10
Source File: MultiValuesSourceAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
/**
 * Read from a stream.
 */
@SuppressWarnings("unchecked")
private void read(StreamInput in) throws IOException {
  fields = (ArrayList<String>) in.readGenericValue();
  valueType = in.readOptionalWriteable(ValueType::readFromStream);
  format = in.readOptionalString();
  missingMap = in.readMap();
}
 
Example 11
Source File: ExtendedAnalyzeResponse.java    From elasticsearch-extended-analyze with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    term = in.readString();
    startOffset = in.readInt();
    endOffset = in.readInt();
    position = in.readVInt();
    type = in.readOptionalString();
    extendedAttributes = (Map<String, Map<String, Object>>) in.readGenericValue();
}
 
Example 12
Source File: UncheckedObjectType.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public Map<Object, Object> readValueFrom(StreamInput in) throws IOException {
    if (in.readBoolean()) {
        int size = in.readInt();
        HashMap<Object, Object> m = new HashMap<>(size);
        for (int i = 0; i < size; i++) {
            Object key = in.readGenericValue();
            Object val = in.readGenericValue();
            m.put(key, val);
        }
        return m;
    }
    return null;
}
 
Example 13
Source File: ObjectType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public Map<String, Object> readValueFrom(StreamInput in) throws IOException {
    return (Map<String, Object>) in.readGenericValue();
}
 
Example 14
Source File: UndefinedType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public Object readValueFrom(StreamInput in) throws IOException {
    return in.readGenericValue();
}
 
Example 15
Source File: UndefinedType.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public Object readValueFrom(StreamInput in) throws IOException {
    return in.readGenericValue();
}