{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-timestream/json-schema/amazon-timestream-query-response-schema.json",
  "title": "QueryResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-timestream-query-api-openapi.yml#/components/schemas/QueryResponse",
  "type": "object",
  "properties": {
    "QueryId": {
      "type": "string",
      "description": "A unique ID for the given query."
    },
    "NextToken": {
      "type": "string",
      "description": "A pagination token that can be used again on a Query call to get the next set of results."
    },
    "Rows": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Row"
      },
      "description": "The result set rows returned by the query."
    },
    "ColumnInfo": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ColumnInfo"
      },
      "description": "The column data types of the returned result set."
    },
    "QueryStatus": {
      "$ref": "#/$defs/QueryStatus"
    },
    "QueryInsightsResponse": {
      "$ref": "#/$defs/QueryInsightsResponse"
    }
  },
  "required": [
    "QueryId",
    "Rows",
    "ColumnInfo"
  ],
  "$defs": {
    "ColumnInfo": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "The name of the result set column. The name of the result set is available for columns of all data types except for arrays."
        },
        "Type": {
          "$ref": "#/$defs/Type"
        }
      },
      "required": [
        "Type"
      ]
    },
    "Datum": {
      "type": "object",
      "properties": {
        "ScalarValue": {
          "type": "string",
          "description": "Indicates if the data point is a scalar value such as integer, string, double, or Boolean."
        },
        "TimeSeriesValue": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TimeSeriesDataPoint"
          },
          "description": "Indicates if the data point is a timeseries data type."
        },
        "ArrayValue": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Datum"
          },
          "description": "Indicates if the data point is an array."
        },
        "RowValue": {
          "$ref": "#/$defs/Row"
        },
        "NullValue": {
          "type": "boolean",
          "description": "Indicates if the data point is null."
        }
      }
    },
    "QueryInsightsResponse": {
      "type": "object",
      "properties": {
        "QuerySpatialCoverage": {
          "$ref": "#/$defs/QuerySpatialCoverage"
        },
        "QueryTemporalRange": {
          "$ref": "#/$defs/QueryTemporalRange"
        },
        "QueryTableCount": {
          "type": "integer",
          "description": "Indicates the number of tables in the query."
        },
        "OutputRows": {
          "type": "integer",
          "description": "Indicates the total number of rows returned as part of the query result set. You can use this data to validate if the number of rows in the result set have changed as part of the query tuning exercise."
        },
        "OutputBytes": {
          "type": "integer",
          "description": "Indicates the size of query result set in bytes. You can use this data to validate if the result set has changed as part of the query tuning exercise."
        },
        "UnloadPartitionCount": {
          "type": "integer",
          "description": "Indicates the partitions created by the Unload operation."
        },
        "UnloadWrittenRows": {
          "type": "integer",
          "description": "Indicates the rows written by the Unload query."
        },
        "UnloadWrittenBytes": {
          "type": "integer",
          "description": "Indicates the size, in bytes, written by the Unload operation."
        }
      }
    },
    "QuerySpatialCoverage": {
      "type": "object",
      "properties": {
        "Max": {
          "$ref": "#/$defs/QuerySpatialCoverageMax"
        }
      }
    },
    "QuerySpatialCoverageMax": {
      "type": "object",
      "properties": {
        "Value": {
          "type": "number",
          "description": "The maximum ratio of spatial coverage."
        },
        "TableArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the table with the most sub-optimal spatial pruning."
        },
        "PartitionKey": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The partition key used for partitioning, which can be a default measure_name or a customer defined partition key."
        }
      }
    },
    "QueryStatus": {
      "type": "object",
      "properties": {
        "ProgressPercentage": {
          "type": "number",
          "description": "The progress of the query, expressed as a percentage."
        },
        "CumulativeBytesScanned": {
          "type": "integer",
          "description": "The amount of data scanned by the query in bytes. This is a cumulative sum and represents the total amount of bytes scanned since the query was started."
        },
        "CumulativeBytesMetered": {
          "type": "integer",
          "description": "The amount of data scanned by the query in bytes that you will be charged for. This is a cumulative sum and represents the total amount of data that you will be charged for since the query was started. The charge is applied only once and is either applied when the query completes running or when the query is cancelled."
        }
      }
    },
    "QueryTemporalRange": {
      "type": "object",
      "properties": {
        "Max": {
          "$ref": "#/$defs/QueryTemporalRangeMax"
        }
      }
    },
    "QueryTemporalRangeMax": {
      "type": "object",
      "properties": {
        "Value": {
          "type": "integer",
          "description": "The maximum duration in nanoseconds between the start and end of the query."
        },
        "TableArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the table which is queried with the largest time range."
        }
      }
    },
    "Row": {
      "type": "object",
      "properties": {
        "Data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Datum"
          },
          "description": "List of data points in a single row of the result set."
        }
      },
      "required": [
        "Data"
      ]
    },
    "TimeSeriesDataPoint": {
      "type": "object",
      "properties": {
        "Time": {
          "type": "string",
          "description": "The timestamp when the measure value was collected."
        },
        "Value": {
          "$ref": "#/$defs/Datum"
        }
      },
      "required": [
        "Time",
        "Value"
      ]
    },
    "Type": {
      "type": "object",
      "properties": {
        "ScalarType": {
          "type": "string",
          "enum": [
            "VARCHAR",
            "BOOLEAN",
            "BIGINT",
            "DOUBLE",
            "TIMESTAMP",
            "DATE",
            "TIME",
            "INTERVAL_DAY_TO_SECOND",
            "INTERVAL_YEAR_TO_MONTH",
            "UNKNOWN",
            "INTEGER"
          ],
          "description": "Indicates if the column is of type string, integer, Boolean, double, timestamp, date, time. For more information, see Supported data types."
        },
        "ArrayColumnInfo": {
          "$ref": "#/$defs/ColumnInfo"
        },
        "TimeSeriesMeasureValueColumnInfo": {
          "$ref": "#/$defs/ColumnInfo"
        },
        "RowColumnInfo": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ColumnInfo"
          },
          "description": "Indicates if the column is a row."
        }
      }
    }
  }
}