{ "description": [ "Test the behavior of repeated key-value structures.", "This is influenced strongly by the data-structures used in collecting metrics.", "They have different names but common structure.", "This type of output structure can be handled efficiently with the use of `UNNEST` and projections.", "An alternative is to dump the entire structure to JSON and use javascript UDFs to handle processing." ], "name": "map", "tests": [ { "name": "test_map_with_atomics", "compatible": true, "test": { "avro": { "type": "map", "values": { "type": "long" } }, "bigquery": [ { "fields": [ { "mode": "REQUIRED", "name": "key", "type": "STRING" }, { "mode": "REQUIRED", "name": "value", "type": "INT64" } ], "mode": "REPEATED", "name": "root", "type": "RECORD" } ], "json": { "additionalProperties": { "type": "integer" }, "type": "object" } } }, { "name": "test_map_with_complex", "compatible": true, "test": { "avro": { "type": "map", "values": { "fields": [ { "default": null, "name": "field_1", "type": [ { "type": "null" }, { "type": "string" } ] }, { "default": null, "name": "field_2", "type": [ { "type": "null" }, { "type": "long" } ] } ], "name": "value", "namespace": "root", "type": "record" } }, "bigquery": [ { "description": "root description", "fields": [ { "mode": "REQUIRED", "name": "key", "type": "STRING" }, { "description": "object description", "fields": [ { "description": "field description", "mode": "NULLABLE", "name": "field_1", "type": "STRING" }, { "mode": "NULLABLE", "name": "field_2", "type": "INT64" } ], "mode": "REQUIRED", "name": "value", "type": "RECORD" } ], "mode": "REPEATED", "name": "root", "type": "RECORD" } ], "json": { "additionalProperties": { "description": "object description", "properties": { "field_1": { "description": "field description", "type": "string" }, "field_2": { "type": "integer" } }, "type": "object" }, "description": "root description", "type": "object" } } }, { "name": "test_map_with_pattern_properties", "compatible": true, "test": { "avro": { "type": "map", "values": { "type": "long" } }, "bigquery": [ { "fields": [ { "mode": "REQUIRED", "name": "key", "type": "STRING" }, { "mode": "REQUIRED", "name": "value", "type": "INT64" } ], "mode": "REPEATED", "name": "root", "type": "RECORD" } ], "json": { "additionalProperties": false, "patternProperties": { ".+": { "type": "integer" } }, "type": "object" } } }, { "name": "test_map_with_pattern_and_additional_properties", "compatible": true, "test": { "avro": { "type": "map", "values": { "type": "long" } }, "bigquery": [ { "fields": [ { "mode": "REQUIRED", "name": "key", "type": "STRING" }, { "mode": "REQUIRED", "name": "value", "type": "INT64" } ], "mode": "REPEATED", "name": "root", "type": "RECORD" } ], "json": { "additionalProperties": { "type": "integer" }, "patternProperties": { ".+": { "type": "integer" } }, "type": "object" } } }, { "name": "test_incompatible_map_with_pattern_properties", "compatible": false, "test": { "avro": { "type": "map", "values": { "type": "string" } }, "bigquery": [ { "fields": [ { "mode": "REQUIRED", "name": "key", "type": "STRING" }, { "mode": "REQUIRED", "name": "value", "type": "STRING" } ], "mode": "REPEATED", "name": "root", "type": "RECORD" } ], "json": { "additionalProperties": false, "patternProperties": { "^I_": { "type": "integer" }, "^S_": { "type": "string" } }, "type": "object" } } }, { "name": "test_incompatible_map_with_pattern_and_additional_properties", "compatible": false, "test": { "avro": { "type": "map", "values": { "type": "string" } }, "bigquery": [ { "fields": [ { "mode": "REQUIRED", "name": "key", "type": "STRING" }, { "mode": "REQUIRED", "name": "value", "type": "STRING" } ], "mode": "REPEATED", "name": "root", "type": "RECORD" } ], "json": { "additionalProperties": { "type": "integer" }, "patternProperties": { ".+": { "type": "string" } }, "type": "object" } } } ] }