---
policy: /ce/ca/aws/dynamodb/table-backup
logic: /ce/ca/aws/dynamodb/table-backup/prod.logic.yaml
executionTime: 2026-01-31T12:01:42.339694708Z
generationMs: 121
executionMs: 899
rows:
  - id: test1
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: CA10A1__AWS_Backup_Recovery_Points__r.has(COMPLIANT)
      actual: CA10A1__AWS_Backup_Recovery_Points__r.has(COMPLIANT)
    runtimeError: {}
  - id: test2
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 500
      actual: 500
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__tableStatus__c') != 'ACTIVE'
      actual: extract('CA10__tableStatus__c') != 'ACTIVE'
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10__pointInTimeRecoveryStatus__c') == 'ENABLED'
      actual: extract('CA10__pointInTimeRecoveryStatus__c') == 'ENABLED'
    runtimeError: {}
  - id: test5
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 399
      actual: 399
    conditionText:
      expected: CA10__AWS_DynamoDB_Backups__r.has(COMPLIANT)
      actual: CA10__AWS_DynamoDB_Backups__r.has(COMPLIANT)
    runtimeError: {}
  - id: test6
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 500
      actual: 500
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/aws/dynamodb/table-backup/policy.yaml
    md5Hash: 300B8353C9F2568DD7B26CF7ACC87751
    content: "---\nnames:\n  full: \"AWS DynamoDB Table does not have on-demand backups\
      \ in the past 90 days\"\n  contextual: \"Table does not have on-demand backups\
      \ in the past 90 days\"\ndescription: >\n  Ensure that DynamoDB tables not utilizing\
      \ Point-in-Time Recovery (PITR) have \n  a recent backup (on-demand or AWS Backup)\
      \ to prevent significant data loss.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n\
      \  - \"SECURITY\"\nframeworkMappings:\n  - \"/frameworks/cloudaware/resource-security/data-protection-and-recovery\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/cp/10\"\n  - \"/frameworks/nist-sp-800-53-r5/cp/06\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/cp/06/01\"\n  - \"/frameworks/nist-sp-800-53-r5/cp/06/02\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/cp/09\"\n  - \"/frameworks/nist-sp-800-53-r5/sc/05/02\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/si/12\"\n  - \"/frameworks/nist-sp-800-53-r5/si/13/05\"\
      \nsimilarPolicies:\n  cloudConformity:\n    - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/DynamoDB/backup-and-restore.html\n\
      \      name: DynamoDB Backup and Restore\n"
  - path: /ce/ca/aws/dynamodb/table-backup/prod.logic.yaml
    md5Hash: 3AE55AF58C9D767AE39105F5A96D4ED9
    content: "inputType: \"CA10__CaAwsDynamoDbTable__c\"\ntestData:\n  - file: \"\
      test-data.json\"\nimportExtracts:\n  - file: /types/CA10__CaAwsDynamoDbTable__c/object.extracts.yaml\n\
      conditions:\n  - status: \"INAPPLICABLE\"\n    currentStateMessage: \"The table\
      \ is not active.\"\n    check:\n      NOT_EQUAL:\n        left:\n          EXTRACT:\
      \ \"CA10__tableStatus__c\"\n        right:\n          TEXT: \"ACTIVE\"\n  -\
      \ status: \"INAPPLICABLE\"\n    currentStateMessage: \"Point-in-Time Recovery\
      \ is enabled for this DynamoDB table.\"\n    check:\n      IS_EQUAL:\n     \
      \   left:\n          EXTRACT: \"CA10__pointInTimeRecoveryStatus__c\"\n     \
      \   right:\n          TEXT: \"ENABLED\"\n  - status: \"COMPLIANT\"\n    currentStateMessage:\
      \ \"At least one backup exists and has been created within the last 90 days.\"\
      \n    check:\n      RELATED_LIST_HAS:\n        status: \"COMPLIANT\"\n     \
      \   relationshipName: \"CA10__AWS_DynamoDB_Backups__r\"\n  - status: \"COMPLIANT\"\
      \n    currentStateMessage: \"At least one Backup Recovery Point exists and has\
      \ been created within the last 90 days.\"\n    check:\n      RELATED_LIST_HAS:\n\
      \        status: \"COMPLIANT\"\n        relationshipName: \"CA10A1__AWS_Backup_Recovery_Points__r\"\
      \notherwise:\n  status: \"INCOMPLIANT\"\n  currentStateMessage: \"No on-demand\
      \ or AWS Backup recovery point was created in the last 90 days.\"\n  remediationMessage:\
      \ \"Create an on-demand backup for the table or assign the table to an AWS Backup\
      \ Plan.\"\nrelatedLists:\n  - relationshipName: \"CA10__AWS_DynamoDB_Backups__r\"\
      \n    importExtracts:\n      - file: /types/CA10__CaAwsDynamoDbBackup__c/object.extracts.yaml\n\
      \    conditions:\n      - status: \"INAPPLICABLE\"\n        currentStateMessage:\
      \ \"The DynamoDB Backup is not available.\"\n        check:\n          NOT_EQUAL:\n\
      \            left:\n              EXTRACT: \"CA10__status__c\"\n           \
      \ right:\n              TEXT: \"AVAILABLE\"\n      - status: \"INCOMPLIANT\"\
      \n        currentStateMessage: \"The DynamoDB Backup is available but was created\
      \ more than 90 days ago.\"\n        remediationMessage: \"Create a new DynamoDB\
      \ Backup and decommission the old one.\"\n        check:\n          IS_BEYOND_LAST_DAYS:\n\
      \            offsetDays: 90\n            arg:\n              EXTRACT: \"CA10__creationDateTime__c\"\
      \n    otherwise: \n      status: \"COMPLIANT\"\n      currentStateMessage: \"\
      The Backup exists and has been created within the last 90 days.\"\n  - relationshipName:\
      \ \"CA10A1__AWS_Backup_Recovery_Points__r\"\n    importExtracts:\n      - file:\
      \ /types/CA10A1__CaAwsBackupRecoveryPoint__c/object.extracts.yaml\n    conditions:\n\
      \      - status: \"INAPPLICABLE\"\n        currentStateMessage: \"The recovery\
      \ point is not completed or available.\"\n        check:\n          AND:\n \
      \           args:\n              - NOT_EQUAL:\n                  left:\n   \
      \                 EXTRACT: \"CA10A1__status__c\"\n                  right:\n\
      \                    TEXT: \"COMPLETED\"\n              - NOT_EQUAL:\n     \
      \             left:\n                    EXTRACT: \"CA10A1__status__c\"\n  \
      \                right:\n                    TEXT: \"AVAILABLE\"\n      - status:\
      \ \"INCOMPLIANT\"\n        currentStateMessage: \"The recovery point is available\
      \ but was created more than 90 days ago.\"\n        remediationMessage: \"Create\
      \ a backup plan to automate creation of on-demand backups.\"\n        check:\n\
      \          IS_BEYOND_LAST_DAYS:\n            offsetDays: 90\n            arg:\n\
      \              EXTRACT: \"CA10A1__creationDate__c\"\n    otherwise: \n     \
      \ status: \"COMPLIANT\"\n      currentStateMessage: \"The backup recovery point\
      \ exists.\""
  - path: /ce/ca/aws/dynamodb/table-backup/test-data.json
    md5Hash: CC626B4218D34DCE25AD27BF0E822DFE
    content: |
      [
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "499",
            "conditionText": "CA10A1__AWS_Backup_Recovery_Points__r.has(COMPLIANT)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2026-01-28T23:10:46Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__tableStatus__c": "ACTIVE",
          "CA10__pointInTimeRecoveryStatus__c": "DISABLED",
          "Id": "test1",
          "CA10__AWS_DynamoDB_Backups__r": [
            {
              "CA10__disappearanceTime__c": null,
              "CA10__status__c": "AVAILABLE",
              "CA10__creationDateTime__c": "2022-11-04T15:29:39Z",
              "CA10__table__c": "test1",
              "Id": "test1_1"
            }
          ],
          "CA10A1__AWS_Backup_Recovery_Points__r": [
            {
              "CA10A1__disappearanceTime__c": null,
              "CA10A1__status__c": "COMPLETED",
              "CA10A1__creationDate__c": "2026-01-20T23:10:46Z",
              "CA10A1__dynamoDbTable__c": "test1",
              "Id": "test1_2"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "500",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2026-01-28T23:10:46Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__tableStatus__c": "ACTIVE",
          "CA10__pointInTimeRecoveryStatus__c": "DISABLED",
          "Id": "test2",
          "CA10__AWS_DynamoDB_Backups__r": [],
          "CA10A1__AWS_Backup_Recovery_Points__r": []
        },
        {
          "expectedResult": {
            "status": "INAPPLICABLE",
            "conditionIndex": "199",
            "conditionText": "extract('CA10__tableStatus__c') != 'ACTIVE'",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2026-01-28T23:10:46Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__tableStatus__c": "DELETING",
          "CA10__pointInTimeRecoveryStatus__c": "DISABLED",
          "Id": "test3",
          "CA10__AWS_DynamoDB_Backups__r": [
            {
              "CA10__disappearanceTime__c": null,
              "CA10__status__c": "AVAILABLE",
              "CA10__creationDateTime__c": "2022-11-04T15:29:39Z",
              "CA10__table__c": "test3",
              "Id": "test3_1"
            }
          ],
          "CA10A1__AWS_Backup_Recovery_Points__r": [
            {
              "CA10A1__disappearanceTime__c": "2026-01-20T08:52:27Z",
              "CA10A1__status__c": "COMPLETED",
              "CA10A1__creationDate__c": "2025-12-21T05:00:00Z",
              "CA10A1__dynamoDbTable__c": "test3",
              "Id": "test3_2"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INAPPLICABLE",
            "conditionIndex": "299",
            "conditionText": "extract('CA10__pointInTimeRecoveryStatus__c') == 'ENABLED'",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2026-01-28T23:10:46Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__tableStatus__c": "ACTIVE",
          "CA10__pointInTimeRecoveryStatus__c": "ENABLED",
          "Id": "test4",
          "CA10__AWS_DynamoDB_Backups__r": [
            {
              "CA10__disappearanceTime__c": null,
              "CA10__status__c": "AVAILABLE",
              "CA10__creationDateTime__c": "2022-11-04T15:29:39Z",
              "CA10__table__c": "test4",
              "Id": "test4_1"
            }
          ],
          "CA10A1__AWS_Backup_Recovery_Points__r": [
            {
              "CA10A1__disappearanceTime__c": null,
              "CA10A1__status__c": "COMPLETED",
              "CA10A1__creationDate__c": "2025-12-21T05:00:00Z",
              "CA10A1__dynamoDbTable__c": "test4",
              "Id": "test4_2"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "399",
            "conditionText": "CA10__AWS_DynamoDB_Backups__r.has(COMPLIANT)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2026-01-28T23:10:46Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__tableStatus__c": "ACTIVE",
          "CA10__pointInTimeRecoveryStatus__c": "DISABLED",
          "Id": "test5",
          "CA10__AWS_DynamoDB_Backups__r": [
            {
              "CA10__disappearanceTime__c": null,
              "CA10__status__c": "AVAILABLE",
              "CA10__creationDateTime__c": "2026-01-20T23:10:46Z",
              "CA10__table__c": "test5",
              "Id": "test5_1"
            }
          ],
          "CA10A1__AWS_Backup_Recovery_Points__r": [
            {
              "CA10A1__disappearanceTime__c": null,
              "CA10A1__status__c": "COMPLETED",
              "CA10A1__creationDate__c": "2025-12-21T05:00:00Z",
              "CA10A1__dynamoDbTable__c": "test5",
              "Id": "test5_2"
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "500",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2026-01-28T23:10:46Z" },
          "CA10__disappearanceTime__c": null,
          "CA10__tableStatus__c": "ACTIVE",
          "CA10__pointInTimeRecoveryStatus__c": "DISABLED",
          "Id": "test6",
          "CA10__AWS_DynamoDB_Backups__r": [
            {
              "CA10__disappearanceTime__c": null,
              "CA10__status__c": "AVAILABLE",
              "CA10__creationDateTime__c": "2022-01-28T23:10:46Z",
              "CA10__table__c": "test6",
              "Id": "test6_1"
            }
          ],
          "CA10A1__AWS_Backup_Recovery_Points__r": [
            {
              "CA10A1__disappearanceTime__c": null,
              "CA10A1__status__c": "COMPLETED",
              "CA10A1__creationDate__c": "2022-01-28T23:10:46Z",
              "CA10A1__dynamoDbTable__c": "test6",
              "Id": "test6_2"
            }
          ]
        }
      ]
  - path: /types/CA10__CaAwsDynamoDbBackup__c/object.extracts.yaml
    md5Hash: 7A95CBE1796D4FCEB869F5CDD935E516
    content: |-
      ---
      extracts:
      # Not nullable.
        - name: "CA10__creationDateTime__c"
          value:
            FIELD:
              path: "CA10__creationDateTime__c"
              undeterminedIf:
                noAccessDelegate:
                  path: "CA10__creationDateTime__c"
                  currentStateMessage: "Dynamo DB Table Backup creation date cannot be empty."
      # Nullable.
        - name: "CA10__status__c"
          value:
            FIELD:
              path: "CA10__status__c"
  - path: /types/CA10A1__CaAwsBackupRecoveryPoint__c/object.extracts.yaml
    md5Hash: 03645351ED418265EF3EFF8207F505A7
    content: "---\nextracts:\n# Not Nullable. Can't have no access, retrieved via\
      \ backup:ListRecoveryPointsByBackupVault\n  - name: CA10A1__kmsMasterKeyId__c\n\
      \    value: \n      FIELD:\n        path: CA10A1__kmsMasterKeyId__c\n# Values:\
      \ COMPLETED | PARTIAL | DELETING | EXPIRED | AVAILABLE | STOPPED | CREATING\n\
      # Not Nullable. Can't have no access, retrieved via backup:ListRecoveryPointsByBackupVault\n\
      \  - name: CA10A1__status__c\n    value: \n      FIELD:\n        path: CA10A1__status__c\n\
      # Nullable. Can't have no access, retrieved via backup:ListRecoveryPointsByBackupVault\n\
      \  - name: CA10A1__calcLifecycleDeleteAt__c\n    value: \n      FIELD:\n   \
      \     path: CA10A1__calcLifecycleDeleteAt__c\n# Not nullable.\n  - name: \"\
      CA10A1__creationDate__c\"\n    value: \n      FIELD:\n        path: \"CA10A1__creationDate__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10A1__creationDate__c\"\n            currentStateMessage: \"Backup Recovery\
      \ Point creation date cannot be empty.\""
  - path: /types/CA10__CaAwsDynamoDbTable__c/object.extracts.yaml
    md5Hash: EC959FF9A6572890388AA7C1C47122EF
    content: "---\nextracts:\n# Nullable, null is equal to PROVISIONED\n  - name:\
      \ \"CA10__billingMode__c\"\n    value:\n      FIELD:\n        path: CA10__billingMode__c\n\
      \        # undeterminedIf:\n        #   noAccessDelegate:\n        #     path:\
      \ \"CA10__billingMode__c\"\n        #     currentStateMessage: \"Unable to determine\
      \ Table Billing Mode. Possible permission issue with dynamodb:DescribeTable.\"\
      \n# Values: ENABLED | DISABLED. Not nullable. \n  - name: \"CA10__pointInTimeRecoveryStatus__c\"\
      \n    value:\n      FIELD:\n        path: CA10__pointInTimeRecoveryStatus__c\n\
      \        # undeterminedIf:\n        #   noAccessDelegate:\n        #     path:\
      \ \"CA10__pointInTimeRecoveryStatus__c\"\n        #     currentStateMessage:\
      \ \"Unable to determine Point In Time Recovery Status. Possible permission issue\
      \ with dynamodb:DescribeTable.\"\n# Nullable.\n  - name: \"CA10__regionName2__c\"\
      \n    value:\n      FIELD:\n        path: \"CA10__regionName2__c\"\n# Values:\
      \ CREATING | UPDATING | DELETING | ACTIVE | INACCESSIBLE_ENCRYPTION_CREDENTIALS\
      \ | \n# ARCHIVING | ARCHIVED | REPLICATION_NOT_AUTHORIZED\n# Not nullable. Possible\
      \ permission issue with dynamodb:DescribeTable.\n  - name: \"CA10__tableStatus__c\"\
      \n    value:\n      FIELD:\n        path: \"CA10__tableStatus__c\"\n# Values:\
      \ ENABLED | null. Possible permission issue with dynamodb:DescribeTable.\n \
      \ - name: \"CA10__sseDescriptionStatus__c\"\n    value:\n      FIELD:\n    \
      \    path: \"CA10__sseDescriptionStatus__c\"\n# Not nullable. Number\n  - name:\
      \ \"CA10__itemCount__c\"\n    value:\n      FIELD:\n        path: \"CA10__itemCount__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__itemCount__c\"\n            currentStateMessage: \"Dynamo DB Table item\
      \ count cannot be empty. Possible permission issue with dynamodb:DescribeTable\"\
      \n# Not nullable.\n  - name: \"CA10__creationDateTime__c\"\n    value:\n   \
      \   FIELD:\n        path: \"CA10__creationDateTime__c\"\n        undeterminedIf:\n\
      \          noAccessDelegate:\n            path: \"CA10__creationDateTime__c\"\
      \n            currentStateMessage: \"Dynamo DB Table creation date cannot be\
      \ empty. Possible permission issue with dynamodb:DescribeTable\"\n"
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "test1",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "499",
      "conditionText" : "CA10A1__AWS_Backup_Recovery_Points__r.has(COMPLIANT)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "500",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__tableStatus__c') != 'ACTIVE'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10__pointInTimeRecoveryStatus__c') == 'ENABLED'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test5",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "399",
      "conditionText" : "CA10__AWS_DynamoDB_Backups__r.has(COMPLIANT)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test6",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "500",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsDynamoDbTable__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__tableStatus__c STRING,
      CA10__pointInTimeRecoveryStatus__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__tableStatus__c" : "ACTIVE",
    "CA10__pointInTimeRecoveryStatus__c" : "DISABLED",
    "Id" : "test1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__tableStatus__c" : "ACTIVE",
    "CA10__pointInTimeRecoveryStatus__c" : "DISABLED",
    "Id" : "test2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__tableStatus__c" : "DELETING",
    "CA10__pointInTimeRecoveryStatus__c" : "DISABLED",
    "Id" : "test3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__tableStatus__c" : "ACTIVE",
    "CA10__pointInTimeRecoveryStatus__c" : "ENABLED",
    "Id" : "test4"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__tableStatus__c" : "ACTIVE",
    "CA10__pointInTimeRecoveryStatus__c" : "DISABLED",
    "Id" : "test5"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__tableStatus__c" : "ACTIVE",
    "CA10__pointInTimeRecoveryStatus__c" : "DISABLED",
    "Id" : "test6"
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsDynamoDbBackup__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__status__c STRING,
      CA10__creationDateTime__c TIMESTAMP,
      CA10__table__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__status__c" : "AVAILABLE",
    "CA10__creationDateTime__c" : new Date("2022-11-04T15:29:39Z"),
    "CA10__table__c" : "test1",
    "Id" : "test1_1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__status__c" : "AVAILABLE",
    "CA10__creationDateTime__c" : new Date("2022-11-04T15:29:39Z"),
    "CA10__table__c" : "test3",
    "Id" : "test3_1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__status__c" : "AVAILABLE",
    "CA10__creationDateTime__c" : new Date("2022-11-04T15:29:39Z"),
    "CA10__table__c" : "test4",
    "Id" : "test4_1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__status__c" : "AVAILABLE",
    "CA10__creationDateTime__c" : new Date("2026-01-20T23:10:46Z"),
    "CA10__table__c" : "test5",
    "Id" : "test5_1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10__status__c" : "AVAILABLE",
    "CA10__creationDateTime__c" : new Date("2022-01-28T23:10:46Z"),
    "CA10__table__c" : "test6",
    "Id" : "test6_1"
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10A1__CaAwsBackupRecoveryPoint__c()
  RETURNS ARRAY<STRUCT<
      CA10A1__disappearanceTime__c TIMESTAMP,
      CA10A1__status__c STRING,
      CA10A1__creationDate__c TIMESTAMP,
      CA10A1__dynamoDbTable__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10A1__status__c" : "COMPLETED",
    "CA10A1__creationDate__c" : new Date("2026-01-20T23:10:46Z"),
    "CA10A1__dynamoDbTable__c" : "test1",
    "Id" : "test1_2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10A1__disappearanceTime__c" : new Date("2026-01-20T08:52:27Z"),
    "CA10A1__status__c" : "COMPLETED",
    "CA10A1__creationDate__c" : new Date("2025-12-21T05:00:00Z"),
    "CA10A1__dynamoDbTable__c" : "test3",
    "Id" : "test3_2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10A1__status__c" : "COMPLETED",
    "CA10A1__creationDate__c" : new Date("2025-12-21T05:00:00Z"),
    "CA10A1__dynamoDbTable__c" : "test4",
    "Id" : "test4_2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10A1__status__c" : "COMPLETED",
    "CA10A1__creationDate__c" : new Date("2025-12-21T05:00:00Z"),
    "CA10A1__dynamoDbTable__c" : "test5",
    "Id" : "test5_2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-28T23:10:46Z")
    },
    "CA10A1__status__c" : "COMPLETED",
    "CA10A1__creationDate__c" : new Date("2022-01-28T23:10:46Z"),
    "CA10A1__dynamoDbTable__c" : "test6",
    "Id" : "test6_2"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAwsDynamoDbTable__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__tableStatus__c STRING,
          CA10__pointInTimeRecoveryStatus__c STRING,
          Id STRING,
          CA10__AWS_DynamoDB_Backups__r ARRAY<STRUCT<
              CA10__disappearanceTime__c TIMESTAMP,
              CA10__status__c STRING,
              CA10__creationDateTime__c TIMESTAMP,
              CA10__table__c STRING,
              Id STRING,
              result STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
          >>,
          CA10A1__AWS_Backup_Recovery_Points__r ARRAY<STRUCT<
              CA10A1__disappearanceTime__c TIMESTAMP,
              CA10A1__status__c STRING,
              CA10A1__creationDate__c TIMESTAMP,
              CA10A1__dynamoDbTable__c STRING,
              Id STRING,
              result STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
          >>
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
  var TextLib = new function () {
      this.normalize = function(arg) {
          return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase();
      };
      this.isEmpty = function(arg) {
          return this.normalize(arg) == '';
      };
      this.isNotEmpty = function(arg) {
          return this.normalize(arg) != '';
      };
      this.equal = function(left, right) {
          return this.normalize(left) == this.normalize(right);
      };
      this.notEqual = function(left, right) {
          return this.normalize(left) != this.normalize(right);
      };
      this.startsWith = function(arg, substring) {
          return this.normalize(arg).startsWith(this.normalize(substring));
      };
      this.endsWith = function(arg, substring) {
          return this.normalize(arg).endsWith(this.normalize(substring));
      };
      this.contains = function(arg, substring) {
          return this.normalize(arg).includes(this.normalize(substring));
      };
      this.containsAll = function(arg, substrings) {
          if (substrings == null || substrings.length === 0) return false;
          let normalizedArg = this.normalize(arg);
          return substrings.every(sub => normalizedArg.includes(this.normalize(sub)));
      };
      this.containsAny = function(arg, substrings) {
          if (substrings == null || substrings.length === 0) return false;
          let normalizedArg = this.normalize(arg);
          return substrings.some(sub => normalizedArg.includes(this.normalize(sub)));
      };
  }();
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c);
      if (obj.CA10__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      function extract3() { if (!this.out) { this.out = obj.CA10__tableStatus__c; } return this.out; };
      references1.push('Table Status [obj.CA10__tableStatus__c]: ' + obj.CA10__tableStatus__c);
      if (TextLib.notEqual(extract3.call(extract3), 'ACTIVE')) {
          return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__tableStatus__c') != 'ACTIVE'", currentStateMessage: "The table is not active.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function extract6() { if (!this.out) { this.out = obj.CA10__pointInTimeRecoveryStatus__c; } return this.out; };
      references1.push('Point In Time Recovery Status [obj.CA10__pointInTimeRecoveryStatus__c]: ' + obj.CA10__pointInTimeRecoveryStatus__c);
      if (TextLib.equal(extract6.call(extract6), 'ENABLED')) {
          return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__pointInTimeRecoveryStatus__c') == 'ENABLED'", currentStateMessage: "Point-in-Time Recovery is enabled for this DynamoDB table.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      var count_CA10__AWS_DynamoDB_Backups__r_COMPLIANT8 = 0;
      if (obj.CA10__AWS_DynamoDB_Backups__r != null) {
          for (var i9 = 0; i9 < obj.CA10__AWS_DynamoDB_Backups__r.length; i9++) {
              if (typeof(obj.CA10__AWS_DynamoDB_Backups__r[i9].status) !== 'undefined') {
                  if (obj.CA10__AWS_DynamoDB_Backups__r[i9].status == 'COMPLIANT') {
                      count_CA10__AWS_DynamoDB_Backups__r_COMPLIANT8 += obj.CA10__AWS_DynamoDB_Backups__r[i9].count;
                  }
              } else  {
                  if (obj.CA10__AWS_DynamoDB_Backups__r[i9].result.status == 'COMPLIANT') {
                      count_CA10__AWS_DynamoDB_Backups__r_COMPLIANT8 += 1;
                  }
              }
          }
      }
      // condition[3], conditionIndex:[300..399]
      references1.push('Related list [CA10__AWS_DynamoDB_Backups__r] ' + (count_CA10__AWS_DynamoDB_Backups__r_COMPLIANT8 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status');
      if (count_CA10__AWS_DynamoDB_Backups__r_COMPLIANT8 > 0) {
          return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "CA10__AWS_DynamoDB_Backups__r.has(COMPLIANT)", currentStateMessage: "At least one backup exists and has been created within the last 90 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      var count_CA10A1__AWS_Backup_Recovery_Points__r_COMPLIANT10 = 0;
      if (obj.CA10A1__AWS_Backup_Recovery_Points__r != null) {
          for (var i11 = 0; i11 < obj.CA10A1__AWS_Backup_Recovery_Points__r.length; i11++) {
              if (typeof(obj.CA10A1__AWS_Backup_Recovery_Points__r[i11].status) !== 'undefined') {
                  if (obj.CA10A1__AWS_Backup_Recovery_Points__r[i11].status == 'COMPLIANT') {
                      count_CA10A1__AWS_Backup_Recovery_Points__r_COMPLIANT10 += obj.CA10A1__AWS_Backup_Recovery_Points__r[i11].count;
                  }
              } else  {
                  if (obj.CA10A1__AWS_Backup_Recovery_Points__r[i11].result.status == 'COMPLIANT') {
                      count_CA10A1__AWS_Backup_Recovery_Points__r_COMPLIANT10 += 1;
                  }
              }
          }
      }
      // condition[4], conditionIndex:[400..499]
      references1.push('Related list [CA10A1__AWS_Backup_Recovery_Points__r] ' + (count_CA10A1__AWS_Backup_Recovery_Points__r_COMPLIANT10 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status');
      if (count_CA10A1__AWS_Backup_Recovery_Points__r_COMPLIANT10 > 0) {
          return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "CA10A1__AWS_Backup_Recovery_Points__r.has(COMPLIANT)", currentStateMessage: "At least one Backup Recovery Point exists and has been created within the last 90 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      return {status: 'INCOMPLIANT', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "No on-demand or AWS Backup recovery point was created in the last 90 days.", currentStateReferences: references1.join('\n'), remediation: "Create an on-demand backup for the table or assign the table to an AWS Backup Plan.", runtimeError: null};
  """;

  CREATE TEMP FUNCTION process_CA10__AWS_DynamoDB_Backups__r(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__status__c STRING,
          CA10__creationDateTime__c TIMESTAMP,
          CA10__table__c STRING,
          Id STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
  var IsEmptyLib = new function () {
      this.simpleIsEmpty = function(arg) {
          return arg == null;
      };
      this.simpleIsNotEmpty = function(arg) {
          return arg != null;
      };
  }();
  var TextLib = new function () {
      this.normalize = function(arg) {
          return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase();
      };
      this.isEmpty = function(arg) {
          return this.normalize(arg) == '';
      };
      this.isNotEmpty = function(arg) {
          return this.normalize(arg) != '';
      };
      this.equal = function(left, right) {
          return this.normalize(left) == this.normalize(right);
      };
      this.notEqual = function(left, right) {
          return this.normalize(left) != this.normalize(right);
      };
      this.startsWith = function(arg, substring) {
          return this.normalize(arg).startsWith(this.normalize(substring));
      };
      this.endsWith = function(arg, substring) {
          return this.normalize(arg).endsWith(this.normalize(substring));
      };
      this.contains = function(arg, substring) {
          return this.normalize(arg).includes(this.normalize(substring));
      };
      this.containsAll = function(arg, substrings) {
          if (substrings == null || substrings.length === 0) return false;
          let normalizedArg = this.normalize(arg);
          return substrings.every(sub => normalizedArg.includes(this.normalize(sub)));
      };
      this.containsAny = function(arg, substrings) {
          if (substrings == null || substrings.length === 0) return false;
          let normalizedArg = this.normalize(arg);
          return substrings.some(sub => normalizedArg.includes(this.normalize(sub)));
      };
  }();
      var todayMinus90Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (-90 * 86400000);
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c);
      if (obj.CA10__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      function extract3() { if (!this.out) { this.out = obj.CA10__status__c; } return this.out; };
      references1.push('Status [obj.CA10__status__c]: ' + obj.CA10__status__c);
      if (TextLib.notEqual(extract3.call(extract3), 'AVAILABLE')) {
          return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__status__c') != 'AVAILABLE'", currentStateMessage: "The DynamoDB Backup is not available.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function fieldChecked7() {
          if (IsEmptyLib.simpleIsEmpty(obj.CA10__creationDateTime__c)) {
              throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__creationDateTime__c.delegatedTo(CA10__creationDateTime__c).isEmpty()", currentStateMessage: "Dynamo DB Table creation date cannot be empty. Possible permission issue with dynamodb:DescribeTable", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__creationDateTime__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      references1.push('Creation Date Time [obj.CA10__creationDateTime__c]: ' + obj.CA10__creationDateTime__c);
      try {
          if (extract6.call(extract6) != null && extract6.call(extract6).getTime() < todayMinus90Day) {
              return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__creationDateTime__c').beyondLastDays(90)", currentStateMessage: "The DynamoDB Backup is available but was created more than 90 days ago.", currentStateReferences: references1.join('\n'), remediation: "Create a new DynamoDB Backup and decommission the old one.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "The Backup exists and has been created within the last 90 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
  """;

  CREATE TEMP FUNCTION process_CA10A1__AWS_Backup_Recovery_Points__r(
      obj STRUCT<
          CA10A1__disappearanceTime__c TIMESTAMP,
          CA10A1__status__c STRING,
          CA10A1__creationDate__c TIMESTAMP,
          CA10A1__dynamoDbTable__c STRING,
          Id STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
  var IsEmptyLib = new function () {
      this.simpleIsEmpty = function(arg) {
          return arg == null;
      };
      this.simpleIsNotEmpty = function(arg) {
          return arg != null;
      };
  }();
  var TextLib = new function () {
      this.normalize = function(arg) {
          return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase();
      };
      this.isEmpty = function(arg) {
          return this.normalize(arg) == '';
      };
      this.isNotEmpty = function(arg) {
          return this.normalize(arg) != '';
      };
      this.equal = function(left, right) {
          return this.normalize(left) == this.normalize(right);
      };
      this.notEqual = function(left, right) {
          return this.normalize(left) != this.normalize(right);
      };
      this.startsWith = function(arg, substring) {
          return this.normalize(arg).startsWith(this.normalize(substring));
      };
      this.endsWith = function(arg, substring) {
          return this.normalize(arg).endsWith(this.normalize(substring));
      };
      this.contains = function(arg, substring) {
          return this.normalize(arg).includes(this.normalize(substring));
      };
      this.containsAll = function(arg, substrings) {
          if (substrings == null || substrings.length === 0) return false;
          let normalizedArg = this.normalize(arg);
          return substrings.every(sub => normalizedArg.includes(this.normalize(sub)));
      };
      this.containsAny = function(arg, substrings) {
          if (substrings == null || substrings.length === 0) return false;
          let normalizedArg = this.normalize(arg);
          return substrings.some(sub => normalizedArg.includes(this.normalize(sub)));
      };
  }();
      var todayMinus90Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (-90 * 86400000);
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From AWS [CA10A1__disappearanceTime__c]: ' + obj.CA10A1__disappearanceTime__c);
      if (obj.CA10A1__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A1__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      function extract3() { if (!this.out) { this.out = obj.CA10A1__status__c; } return this.out; };
      references1.push('Status [obj.CA10A1__status__c]: ' + obj.CA10A1__status__c);
      if (TextLib.notEqual(extract3.call(extract3), 'COMPLETED') && TextLib.notEqual(extract3.call(extract3), 'AVAILABLE')) {
          return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10A1__status__c') != 'COMPLETED' && extract('CA10A1__status__c') != 'AVAILABLE'", currentStateMessage: "The recovery point is not completed or available.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function fieldChecked8() {
          if (IsEmptyLib.simpleIsEmpty(obj.CA10A1__creationDate__c)) {
              throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10A1__creationDate__c.delegatedTo(CA10A1__creationDate__c).isEmpty()", currentStateMessage: "Backup Recovery Point creation date cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10A1__creationDate__c;
      }
      function extract7() { if (!this.out) { this.out = fieldChecked8(); } return this.out; };
      references1.push('Creation Date [obj.CA10A1__creationDate__c]: ' + obj.CA10A1__creationDate__c);
      try {
          if (extract7.call(extract7) != null && extract7.call(extract7).getTime() < todayMinus90Day) {
              return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10A1__creationDate__c').beyondLastDays(90)", currentStateMessage: "The recovery point is available but was created more than 90 days ago.", currentStateReferences: references1.join('\n'), remediation: "Create a backup plan to automate creation of on-demand backups.", runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "The backup recovery point exists.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
  """;


  SELECT
    expectedResult.Id as Id,
    IF (
      IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '')
      AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1)
      AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '')
      AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''),
      "MATCH",
      "FAIL"
    ) as match,
    expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus,
    expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex,
    expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText,
    expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError
  FROM UNNEST(mock_ExpectedResult()) expectedResult
  LEFT JOIN (
      SELECT
          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.CA10__tableStatus__c AS CA10__tableStatus__c,
          sObject.CA10__pointInTimeRecoveryStatus__c AS CA10__pointInTimeRecoveryStatus__c,
          sObject.Id AS Id,
          `CA10__AWS_DynamoDB_Backups__r`.arr AS CA10__AWS_DynamoDB_Backups__r,
          `CA10A1__AWS_Backup_Recovery_Points__r`.arr AS CA10A1__AWS_Backup_Recovery_Points__r,
          process_CA10__CaAwsDynamoDbTable__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__tableStatus__c AS CA10__tableStatus__c,
                  sObject.CA10__pointInTimeRecoveryStatus__c AS CA10__pointInTimeRecoveryStatus__c,
                  sObject.Id AS Id,
                  `CA10__AWS_DynamoDB_Backups__r`.arr AS CA10__AWS_DynamoDB_Backups__r,
                  `CA10A1__AWS_Backup_Recovery_Points__r`.arr AS CA10A1__AWS_Backup_Recovery_Points__r
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAwsDynamoDbTable__c()) AS sObject
      LEFT JOIN (
          SELECT
              sObject.CA10__table__c,
              ARRAY_AGG(
                  STRUCT(
                      sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                      sObject.CA10__status__c AS CA10__status__c,
                      sObject.CA10__creationDateTime__c AS CA10__creationDateTime__c,
                      sObject.CA10__table__c AS CA10__table__c,
                      sObject.Id AS Id,
                      process_CA10__AWS_DynamoDB_Backups__r(
                          STRUCT(
                              sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                              sObject.CA10__status__c AS CA10__status__c,
                              sObject.CA10__creationDateTime__c AS CA10__creationDateTime__c,
                              sObject.CA10__table__c AS CA10__table__c,
                              sObject.Id AS Id
                          ),
                          sObject.context.snapshotTime
                      ) as result
                  )
              ) AS arr
          FROM UNNEST(mock_CA10__CaAwsDynamoDbBackup__c()) AS sObject
          GROUP BY sObject.CA10__table__c
      ) AS `CA10__AWS_DynamoDB_Backups__r`
          ON sObject.Id = `CA10__AWS_DynamoDB_Backups__r`.CA10__table__c
      LEFT JOIN (
          SELECT
              sObject.CA10A1__dynamoDbTable__c,
              ARRAY_AGG(
                  STRUCT(
                      sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c,
                      sObject.CA10A1__status__c AS CA10A1__status__c,
                      sObject.CA10A1__creationDate__c AS CA10A1__creationDate__c,
                      sObject.CA10A1__dynamoDbTable__c AS CA10A1__dynamoDbTable__c,
                      sObject.Id AS Id,
                      process_CA10A1__AWS_Backup_Recovery_Points__r(
                          STRUCT(
                              sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c,
                              sObject.CA10A1__status__c AS CA10A1__status__c,
                              sObject.CA10A1__creationDate__c AS CA10A1__creationDate__c,
                              sObject.CA10A1__dynamoDbTable__c AS CA10A1__dynamoDbTable__c,
                              sObject.Id AS Id
                          ),
                          sObject.context.snapshotTime
                      ) as result
                  )
              ) AS arr
          FROM UNNEST(mock_CA10A1__CaAwsBackupRecoveryPoint__c()) AS sObject
          GROUP BY sObject.CA10A1__dynamoDbTable__c
      ) AS `CA10A1__AWS_Backup_Recovery_Points__r`
          ON sObject.Id = `CA10A1__AWS_Backup_Recovery_Points__r`.CA10A1__dynamoDbTable__c
  ) sObject ON sObject.Id = expectedResult.Id;
