org.apache.flink.api.common.typeinfo.Types.OBJECT_ARRAY()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.apache.flink.api.common.typeinfo.Types.OBJECT_ARRAY()方法的一些代码示例,展示了Types.OBJECT_ARRAY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.OBJECT_ARRAY()方法的具体详情如下:
包路径:org.apache.flink.api.common.typeinfo.Types
类名称:Types
方法名:OBJECT_ARRAY

Types.OBJECT_ARRAY介绍

[英]Returns type information for Java arrays of object types (such as String[], Integer[]). The array itself must not be null. Null values for elements are supported.
[中]返回对象类型的Java数组的类型信息(例如String[]Integer[])。数组本身不能为空。支持元素的空值。

代码示例

代码示例来源:origin: apache/flink

private TypeInformation<?> convertObjectArray() {
  nextToken(TokenType.BEGIN);
  nextToken(TokenType.LITERAL);
  final TypeInformation<?> elementTypeInfo = convertType();
  nextToken(TokenType.END);
  return Types.OBJECT_ARRAY(elementTypeInfo);
}

代码示例来源:origin: apache/flink

case ARRAY:
  return Types.OBJECT_ARRAY(convertToTypeInfo(schema.getElementType()));
case MAP:
  return Types.MAP(Types.STRING, convertToTypeInfo(schema.getValueType()));

代码示例来源:origin: apache/flink

private static TypeInformation<?> convertArray(String location, JsonNode node, JsonNode root) {
  // validate items
  if (!node.has(ITEMS)) {
    throw new IllegalArgumentException(
      "Arrays must specify an '" + ITEMS + "' property in node: " + location);
  }
  final JsonNode items = node.get(ITEMS);
  // list (translated to object array)
  if (items.isObject()) {
    final TypeInformation<?> elementType = convertType(
      location + '/' + ITEMS,
      items,
      root);
    // result type might either be ObjectArrayTypeInfo or BasicArrayTypeInfo for Strings
    return Types.OBJECT_ARRAY(elementType);
  }
  // tuple (translated to row)
  else if (items.isArray()) {
    final TypeInformation<?>[] types = convertTypes(location + '/' + ITEMS, items, root);
    // validate that array does not contain additional items
    if (node.has(ADDITIONAL_ITEMS) && node.get(ADDITIONAL_ITEMS).isBoolean() &&
        node.get(ADDITIONAL_ITEMS).asBoolean()) {
      throw new IllegalArgumentException(
        "An array tuple must not allow additional items in node: " + location);
    }
    return Types.ROW(types);
  }
  throw new IllegalArgumentException(
    "Invalid type for '" + ITEMS + "' property in node: " + location);
}

代码示例来源:origin: apache/flink

Types.VOID,
Types.BOOLEAN,
Types.OBJECT_ARRAY(Types.STRING),
Types.OBJECT_ARRAY(Types.BOOLEAN),
Types.OBJECT_ARRAY(Types.STRING),
Types.STRING,
Types.MAP(Types.STRING, Types.LONG),

代码示例来源:origin: apache/flink

Types.OBJECT_ARRAY(TypeExtractor.createTypeInfo(TestPojo.class)));

代码示例来源:origin: com.alibaba.blink/flink-table-common

private TypeInformation<?> convertObjectArray() {
  nextToken(TokenType.BEGIN);
  nextToken(TokenType.LITERAL);
  final TypeInformation<?> elementTypeInfo = convertType();
  nextToken(TokenType.END);
  return Types.OBJECT_ARRAY(elementTypeInfo);
}

代码示例来源:origin: org.apache.flink/flink-table-common

private TypeInformation<?> convertObjectArray() {
  nextToken(TokenType.BEGIN);
  nextToken(TokenType.LITERAL);
  final TypeInformation<?> elementTypeInfo = convertType();
  nextToken(TokenType.END);
  return Types.OBJECT_ARRAY(elementTypeInfo);
}

代码示例来源:origin: org.apache.flink/flink-avro

case ARRAY:
  return Types.OBJECT_ARRAY(convertToTypeInfo(schema.getElementType()));
case MAP:
  return Types.MAP(Types.STRING, convertToTypeInfo(schema.getValueType()));

代码示例来源:origin: com.alibaba.blink/flink-avro

case ARRAY:
  return Types.OBJECT_ARRAY(convertToTypeInfo(schema.getElementType()));
case MAP:
  return Types.MAP(Types.STRING, convertToTypeInfo(schema.getValueType()));

代码示例来源:origin: com.alibaba.blink/flink-json

private static TypeInformation<?> convertArray(String location, JsonNode node, JsonNode root) {
  // validate items
  if (!node.has(ITEMS)) {
    throw new IllegalArgumentException(
      "Arrays must specify an '" + ITEMS + "' property in node: " + location);
  }
  final JsonNode items = node.get(ITEMS);
  // list (translated to object array)
  if (items.isObject()) {
    final TypeInformation<?> elementType = convertType(
      location + '/' + ITEMS,
      items,
      root);
    // result type might either be ObjectArrayTypeInfo or BasicArrayTypeInfo for Strings
    return Types.OBJECT_ARRAY(elementType);
  }
  // tuple (translated to row)
  else if (items.isArray()) {
    final TypeInformation<?>[] types = convertTypes(location + '/' + ITEMS, items, root);
    // validate that array does not contain additional items
    if (node.has(ADDITIONAL_ITEMS) && node.get(ADDITIONAL_ITEMS).isBoolean() &&
        node.get(ADDITIONAL_ITEMS).asBoolean()) {
      throw new IllegalArgumentException(
        "An array tuple must not allow additional items in node: " + location);
    }
    return Types.ROW(types);
  }
  throw new IllegalArgumentException(
    "Invalid type for '" + ITEMS + "' property in node: " + location);
}

代码示例来源:origin: org.apache.flink/flink-json

private static TypeInformation<?> convertArray(String location, JsonNode node, JsonNode root) {
  // validate items
  if (!node.has(ITEMS)) {
    throw new IllegalArgumentException(
      "Arrays must specify an '" + ITEMS + "' property in node: " + location);
  }
  final JsonNode items = node.get(ITEMS);
  // list (translated to object array)
  if (items.isObject()) {
    final TypeInformation<?> elementType = convertType(
      location + '/' + ITEMS,
      items,
      root);
    // result type might either be ObjectArrayTypeInfo or BasicArrayTypeInfo for Strings
    return Types.OBJECT_ARRAY(elementType);
  }
  // tuple (translated to row)
  else if (items.isArray()) {
    final TypeInformation<?>[] types = convertTypes(location + '/' + ITEMS, items, root);
    // validate that array does not contain additional items
    if (node.has(ADDITIONAL_ITEMS) && node.get(ADDITIONAL_ITEMS).isBoolean() &&
        node.get(ADDITIONAL_ITEMS).asBoolean()) {
      throw new IllegalArgumentException(
        "An array tuple must not allow additional items in node: " + location);
    }
    return Types.ROW(types);
  }
  throw new IllegalArgumentException(
    "Invalid type for '" + ITEMS + "' property in node: " + location);
}

相关文章