static StaticDataTask fromJson(JsonNode jsonNode) {
    Preconditions.checkArgument(jsonNode != null, "Invalid JSON node for data task: null");
    Preconditions.checkArgument(
        jsonNode.isObject(), "Invalid JSON node for data task: non-object (%s)", jsonNode);

    Schema schema = SchemaParser.fromJson(JsonUtil.get(SCHEMA, jsonNode));
    Schema projectedSchema = SchemaParser.fromJson(JsonUtil.get(PROJECTED_SCHEMA, jsonNode));
    DataFile metadataFile =
        (DataFile)
            ContentFileParser.fromJson(
                JsonUtil.get(METADATA_FILE, jsonNode), PartitionSpec.unpartitioned());

    JsonNode rowsArray = JsonUtil.get(ROWS, jsonNode);
    Preconditions.checkArgument(
        rowsArray.isArray(), "Invalid JSON node for rows: non-array (%s)", rowsArray);

    StructLike[] rows = new StructLike[rowsArray.size()];
    for (int i = 0; i < rowsArray.size(); ++i) {
      JsonNode rowNode = rowsArray.get(i);
      rows[i] = (StructLike) SingleValueParser.fromJson(schema.asStruct(), rowNode);
    }

    return new StaticDataTask(metadataFile, schema, projectedSchema, rows);
  }
@Test
  public void invalidJsonNode() throws Exception {
    String jsonStr = "{\"str\":\"1\", \"arr\":[]}";
    ObjectMapper mapper = new ObjectMapper();
    JsonNode rootNode = mapper.reader().readTree(jsonStr);

    assertThatThrownBy(() -> DataTaskParser.fromJson(rootNode.get("str")))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageContaining("Invalid JSON node for data task: non-object ");

    assertThatThrownBy(() -> DataTaskParser.fromJson(rootNode.get("arr")))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessageContaining("Invalid JSON node for data task: non-object ");
  }