Cmdlets for Avro

Build 24.0.9062

Raw データ

Below is the raw data used throughout this chapter. The data includes entries for people, the cars they own, and various maintenance services performed on those cars:

{
  "type": "record",
  "name": "People",
  "fields": [
    {
      "name": "personal",
      "type": [
        "null",
        {
          "type": "record",
          "name": "Personal",
          "namespace": "root",
          "fields": [
            {
              "name": "name",
              "type": [
                "null",
                {
                  "type": "record",
                  "name": "Name",
                  "namespace": "root.personal",
                  "fields": [
                    {
                      "name": "last",
                      "type": ["null", "string"]
                    },
                    {
                      "name": "first",
                      "type": ["null",  "string"]
                    }
                  ]
                }
              ]
            },
            {
              "name": "gender",
              "type": ["null", "string"]
            },
            {
              "name": "age",
              "type": ["null", "long"]
            }
          ]
        }
      ]
    },
    {
      "name": "vehicles",
      "type": {
        "type": "array",
        "items": {
          "type": "record",
          "name": "Vehicles",
          "namespace": "root",
          "fields": [
            {
              "name": "insurance",
              "type": [
                "null",
                {
                  "type": "record",
                  "name": "Insurance",
                  "namespace": "root.vehicles",
                  "fields": [
                    {
                      "name": "policy_num",
                      "type": ["null", "long"]
                    },
                    {
                      "name": "company",
                      "type": ["null", "string"]
                    }
                  ]
                }
              ]
            },
            {
              "name": "maintenance",
              "type": {
                "type": "array",
                "items": {
                  "type": "record",
                  "name": "Maintenance",
                  "namespace": "root.vehicles",
                  "fields": [
                    {
                      "name": "desc",
                      "type": ["null", "string"]
                    },
                    {
                      "name": "date",
                      "type": ["null", "string"]
                    }
                  ]
                }
              }
            },
            {
              "name": "model",
              "type": ["null", "string"]
            },
            {
              "name": "type",
              "type": ["null", "string"]
            }
          ]
        }
      }
    },
    {
      "name": "source",
      "type": ["null", "string"]
    }
  ]
}

The following is the sample data set for the "People" table:

{
  "people": [
    {
      "personal": {
        "age": 20,
        "gender": "M",
        "name": {
          "first": "John",
          "last": "Doe"
        }
      },
      "vehicles": [
        {
          "type": "car",
          "model": "Honda Civic",
          "insurance": {
            "company": "ABC Insurance",
            "policy_num": "12345"
          },
          "maintenance": [
            {
              "date": "07-17-2017",
              "desc": "oil change"
            },
            {
              "date": "01-03-2018",
              "desc": "new tires"
            }
          ]
        },
        {
          "type": "truck",
          "model": "Dodge Ram",
          "insurance": {
            "company": "ABC Insurance",
            "policy_num": "12345"
          },
          "maintenance": [
            {
              "date": "08-27-2017",
              "desc": "new tires"
            },
            {
              "date": "01-08-2018",
              "desc": "oil change"
            }
          ]
        }
      ],
      "source": "internet"
    },
    {
      "personal": {
        "age": 24,
        "gender": "F",
        "name": {
          "first": "Jane",
          "last": "Roberts"
        }
      },
      "vehicles": [
        {
          "type": "car",
          "model": "Toyota Camry",
          "insurance": {
            "company": "Car Insurance",
            "policy_num": "98765"
          },
          "maintenance": [
            {
              "date": "05-11-2017",
              "desc": "tires rotated"
            },
            {
              "date": "11-03-2017",
              "desc": "oil change"
            }
          ]
        },
        {
          "type": "car",
          "model": "Honda Accord",
          "insurance": {
            "company": "Car Insurance",
            "policy_num": "98765"
          },
          "maintenance": [
            {
              "date": "10-07-2017",
              "desc": "new air filter"
            },
            {
              "date": "01-13-2018",
              "desc": "new brakes"
            }
          ]
        }
      ],
      "source": "phone"
    }
  ]
}

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9062