use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext in project flink by apache.
the class RexWindowBoundJsonDeserializer method deserialize.
@Override
public RexWindowBound deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
JsonNode jsonNode = jsonParser.readValueAsTree();
String kind = jsonNode.get(FIELD_NAME_KIND).asText().toUpperCase();
switch(kind) {
case KIND_CURRENT_ROW:
return RexWindowBounds.CURRENT_ROW;
case KIND_UNBOUNDED_FOLLOWING:
return RexWindowBounds.UNBOUNDED_FOLLOWING;
case KIND_UNBOUNDED_PRECEDING:
return RexWindowBounds.UNBOUNDED_PRECEDING;
case KIND_BOUNDED_WINDOW:
RexNode offset = null;
if (jsonNode.get(FIELD_NAME_OFFSET) != null) {
offset = deserializationContext.readValue(jsonNode.get(FIELD_NAME_OFFSET).traverse(jsonParser.getCodec()), RexNode.class);
}
if (offset != null && jsonNode.get(FIELD_NAME_IS_FOLLOWING) != null) {
return RexWindowBounds.following(offset);
} else if (offset != null && jsonNode.get(FIELD_NAME_IS_PRECEDING) != null) {
return RexWindowBounds.preceding(offset);
} else {
throw new TableException("Unknown RexWindowBound: " + jsonNode.toString());
}
default:
throw new TableException("Unknown RexWindowBound: " + jsonNode.toString());
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext in project flink by apache.
the class AggregateCallJsonDeserializer method deserialize.
@Override
public AggregateCall deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException {
final JsonNode jsonNode = jsonParser.readValueAsTree();
final SerdeContext serdeContext = SerdeContext.get(ctx);
final String name = jsonNode.required(FIELD_NAME_NAME).asText();
final SqlAggFunction aggFunction = (SqlAggFunction) RexNodeJsonDeserializer.deserializeSqlOperator(jsonNode, serdeContext);
final List<Integer> argList = new ArrayList<>();
final JsonNode argListNode = jsonNode.required(FIELD_NAME_ARG_LIST);
for (JsonNode argNode : argListNode) {
argList.add(argNode.intValue());
}
final int filterArg = jsonNode.required(FIELD_NAME_FILTER_ARG).asInt();
final boolean distinct = jsonNode.required(FIELD_NAME_DISTINCT).asBoolean();
final boolean approximate = jsonNode.required(FIELD_NAME_APPROXIMATE).asBoolean();
final boolean ignoreNulls = jsonNode.required(FIELD_NAME_IGNORE_NULLS).asBoolean();
final RelDataType relDataType = RelDataTypeJsonDeserializer.deserialize(jsonNode.required(FIELD_NAME_TYPE), serdeContext);
return AggregateCall.create(aggFunction, distinct, approximate, ignoreNulls, argList, filterArg, RelCollations.EMPTY, relDataType, name);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext in project flink by apache.
the class DataTypeJsonDeserializer method deserialize.
@Override
public DataType deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException {
final JsonNode dataTypeNode = jsonParser.readValueAsTree();
final SerdeContext serdeContext = SerdeContext.get(ctx);
return deserialize(dataTypeNode, serdeContext);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext in project flink by apache.
the class LogicalTypeJsonDeserializer method deserialize.
@Override
public LogicalType deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException {
final JsonNode logicalTypeNode = jsonParser.readValueAsTree();
final SerdeContext serdeContext = SerdeContext.get(ctx);
return deserialize(logicalTypeNode, serdeContext);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext in project flink by apache.
the class WindowReferenceJsonDeserializer method deserialize.
@Override
public WindowReference deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
final JsonNode input = jsonParser.readValueAsTree();
String name = input.get(FIELD_NAME_NAME).asText();
LogicalType type = deserializationContext.readValue(input.get(FIELD_NAME_TYPE).traverse(jsonParser.getCodec()), LogicalType.class);
return new WindowReference(name, type);
}
Aggregations