---
policy: /ce/ca/aws/redshift/cluster-underutilized
logic: /ce/ca/aws/redshift/cluster-underutilized/prod.logic.yaml
executionTime: 2025-10-01T12:45:57.553704375Z
generationMs: 56
executionMs: 741
rows:
  - id: '001'
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__status__c') != 'available'
      actual: extract('CA10__status__c') != 'available'
    runtimeError: {}
  - id: '002'
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: not(extract('CA10__createTime__c').beyondLastDays(30))
      actual: not(extract('CA10__createTime__c').beyondLastDays(30))
    runtimeError: {}
  - id: '003'
    match: true
    status:
      expected: UNDETERMINED
      actual: UNDETERMINED
    conditionIndex:
      expected: 399
      actual: 399
    conditionText:
      expected: extract('CA10__cpuUtilizationAvg30d__c').isEmpty() || extract('CA10__diskReadIopsAvg30d__c').isEmpty()
        || extract('CA10__diskWriteIopsAvg30d__c').isEmpty()
      actual: extract('CA10__cpuUtilizationAvg30d__c').isEmpty() || extract('CA10__diskReadIopsAvg30d__c').isEmpty()
        || extract('CA10__diskWriteIopsAvg30d__c').isEmpty()
    runtimeError: {}
  - id: '004'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: extract('CA10__cpuUtilizationAvg30d__c') < number(20.0) && extract('CA10__diskReadIopsAvg30d__c')
        < number(50.0) && extract('CA10__diskWriteIopsAvg30d__c') < number(50.0)
      actual: extract('CA10__cpuUtilizationAvg30d__c') < number(20.0) && extract('CA10__diskReadIopsAvg30d__c')
        < number(50.0) && extract('CA10__diskWriteIopsAvg30d__c') < number(50.0)
    runtimeError: {}
  - id: '005'
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 500
      actual: 500
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/aws/redshift/cluster-underutilized/policy.yaml
    md5Hash: 89DB0905DC1FCCAB9792567A50D22425
    content: "---\nnames:\n  full: AWS Redshift Cluster is underutilized\n  contextual:\
      \ Cluster is underutilized\ndescription: \"Clusters are considered underutilized\
      \ if their average\\\n  \\ CPU utilization is consistently below 20% and their\
      \ disk I/O is below 50 IOPS\\\n  \\ over a 30-day period. Such instances might\
      \ be oversized for their workload.\"\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n\
      \  - \"COST\"\n  - \"PERFORMANCE\"\nframeworkMappings:\n  - \"/frameworks/cloudaware/cost-efficiency-and-optimization/resource-right-sizing\"\
      \n  - \"/frameworks/cloudaware/resource-performance/workload-efficiency\"\n\
      \    "
  - path: /ce/ca/aws/redshift/cluster-underutilized/prod.logic.yaml
    md5Hash: F1025F344F9E1CB87A970F31D6BEA0C9
    content: |-
      ---
      inputType: "CA10__CaAwsRedshiftCluster__c"
      importExtracts:
        - file: "/types/CA10__CaAwsRedshiftCluster__c/object.extracts.yaml"
      testData:
        - file: 'test-data.json'
      conditions:
        - status: "INAPPLICABLE"
          currentStateMessage: "The cluster is not available."
          check:
            NOT_EQUAL:
              left:
                EXTRACT: "CA10__status__c"
              right:
                TEXT: "available"
        - status: "INAPPLICABLE"
          currentStateMessage: "The cluster has been created less than 30 days ago."
          check:
            NOT:
              arg:
                IS_BEYOND_LAST_DAYS:
                  offsetDays: 30
                  arg:
                    EXTRACT: "CA10__createTime__c"
        - status: UNDETERMINED
          currentStateMessage: "There is not enough data in the CMDB to identify if the cluster is underutilized."
          check:
            OR:
              args:
                - IS_EMPTY:
                    arg:
                      EXTRACT: "CA10__cpuUtilizationAvg30d__c"
                - IS_EMPTY:
                    arg:
                      EXTRACT: "CA10__diskReadIopsAvg30d__c"
                - IS_EMPTY:
                    arg:
                      EXTRACT: "CA10__diskWriteIopsAvg30d__c"
        - status: "INCOMPLIANT"
          currentStateMessage: "The cluster is underutilized with Average CPU Utilization < 20%, Average \
            \ Disk I/O < 50 IOPS."
          remediationMessage: "Consider rightsizing the cluster."
          check:
            AND:
              args:
                - LESS_THAN:
                    left:
                      EXTRACT: "CA10__cpuUtilizationAvg30d__c"
                    right:
                      NUMBER: 20.0
                - LESS_THAN:
                    left:
                      EXTRACT: "CA10__diskReadIopsAvg30d__c"
                    right:
                      NUMBER: 50.0
                - LESS_THAN:
                    left:
                      EXTRACT: "CA10__diskWriteIopsAvg30d__c"
                    right:
                      NUMBER: 50.0
      otherwise:
        status: "COMPLIANT"
        currentStateMessage: 'The cluster is not underutilized.'
  - path: /ce/ca/aws/redshift/cluster-underutilized/test-data.json
    md5Hash: 595C8EFCDD78D5E2A9AC74CFFECCA83F
    content: |
      [
        {
          "expectedResult": {
            "status": "INAPPLICABLE",
            "conditionIndex": "199",
            "conditionText": "extract('CA10__status__c') != 'available'",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-01T16:12:36Z" },
          "Id": "001",
          "CA10__disappearanceTime__c": null,
          "CA10__status__c": "paused",
          "CA10__createTime__c": "2020-10-22T09:44:18Z",
          "CA10__cpuUtilizationAvg30d__c": null,
          "CA10__diskReadIopsAvg30d__c": null,
          "CA10__diskWriteIopsAvg30d__c": null
        },
        {
          "expectedResult": {
            "status": "INAPPLICABLE",
            "conditionIndex": "299",
            "conditionText": "not(extract('CA10__createTime__c').beyondLastDays(30))",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-01T16:12:36Z" },
          "Id": "002",
          "CA10__disappearanceTime__c": null,
          "CA10__status__c": "available",
          "CA10__createTime__c": "2025-08-31T16:12:36Z",
          "CA10__cpuUtilizationAvg30d__c": null,
          "CA10__diskReadIopsAvg30d__c": null,
          "CA10__diskWriteIopsAvg30d__c": null
        },
        {
          "expectedResult": {
            "status": "UNDETERMINED",
            "conditionIndex": "399",
            "conditionText": "extract('CA10__cpuUtilizationAvg30d__c').isEmpty() || extract('CA10__diskReadIopsAvg30d__c').isEmpty() || extract('CA10__diskWriteIopsAvg30d__c').isEmpty()",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-01T16:12:36Z" },
          "Id": "003",
          "CA10__disappearanceTime__c": null,
          "CA10__status__c": "available",
          "CA10__createTime__c": "2020-10-22T09:44:18Z",
          "CA10__cpuUtilizationAvg30d__c": null,
          "CA10__diskReadIopsAvg30d__c": null,
          "CA10__diskWriteIopsAvg30d__c": null
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "499",
            "conditionText": "extract('CA10__cpuUtilizationAvg30d__c') < number(20.0) && extract('CA10__diskReadIopsAvg30d__c') < number(50.0) && extract('CA10__diskWriteIopsAvg30d__c') < number(50.0)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-01T16:12:36Z" },
          "Id": "004",
          "CA10__disappearanceTime__c": null,
          "CA10__status__c": "available",
          "CA10__createTime__c": "2020-10-22T09:44:18Z",
          "CA10__cpuUtilizationAvg30d__c": 10,
          "CA10__diskReadIopsAvg30d__c": 10,
          "CA10__diskWriteIopsAvg30d__c": 10
        },
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "500",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2025-09-01T16:12:36Z" },
          "Id": "005",
          "CA10__disappearanceTime__c": null,
          "CA10__status__c": "available",
          "CA10__createTime__c": "2020-10-22T09:44:18Z",
          "CA10__cpuUtilizationAvg30d__c": 50,
          "CA10__diskReadIopsAvg30d__c": 10,
          "CA10__diskWriteIopsAvg30d__c": 10
        }
      ]
  - path: /types/CA10__CaAwsRedshiftCluster__c/object.extracts.yaml
    md5Hash: 0B799D033E0DBD261DF12B8BA7E202C8
    content: |
      ---
      extracts:
      # Nullable. Values: available, modifying, creating ...
        - name: "CA10__status__c"
          value:
            FIELD:
              path: "CA10__status__c"
      # Nullable.
        - name: "CA10__createTime__c"
          value:
            FIELD:
              path: "CA10__createTime__c"
      # Nullable.
        - name: "CA10__cpuUtilizationAvg30d__c"
          value:
            FIELD:
              path: "CA10__cpuUtilizationAvg30d__c"
      # Nullable.
        - name: "CA10__diskReadIopsAvg30d__c"
          value:
            FIELD:
              path: "CA10__diskReadIopsAvg30d__c"
      # Nullable.
        - name: "CA10__diskWriteIopsAvg30d__c"
          value:
            FIELD:
              path: "CA10__diskWriteIopsAvg30d__c"
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" : "001",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__status__c') != 'available'",
      "runtimeError" : null
    }
  }, {
    "Id" : "002",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "299",
      "conditionText" : "not(extract('CA10__createTime__c').beyondLastDays(30))",
      "runtimeError" : null
    }
  }, {
    "Id" : "003",
    "expectedResult" : {
      "status" : "UNDETERMINED",
      "conditionIndex" : "399",
      "conditionText" : "extract('CA10__cpuUtilizationAvg30d__c').isEmpty() || extract('CA10__diskReadIopsAvg30d__c').isEmpty() || extract('CA10__diskWriteIopsAvg30d__c').isEmpty()",
      "runtimeError" : null
    }
  }, {
    "Id" : "004",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "499",
      "conditionText" : "extract('CA10__cpuUtilizationAvg30d__c') < number(20.0) && extract('CA10__diskReadIopsAvg30d__c') < number(50.0) && extract('CA10__diskWriteIopsAvg30d__c') < number(50.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "005",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "500",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsRedshiftCluster__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__status__c STRING,
      CA10__createTime__c TIMESTAMP,
      CA10__cpuUtilizationAvg30d__c FLOAT64,
      CA10__diskReadIopsAvg30d__c FLOAT64,
      CA10__diskWriteIopsAvg30d__c FLOAT64,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-09-01T16:12:36Z")
    },
    "Id" : "001",
    "CA10__status__c" : "paused",
    "CA10__createTime__c" : new Date("2020-10-22T09:44:18Z"),
    "CA10__cpuUtilizationAvg30d__c" : null,
    "CA10__diskReadIopsAvg30d__c" : null,
    "CA10__diskWriteIopsAvg30d__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-01T16:12:36Z")
    },
    "Id" : "002",
    "CA10__status__c" : "available",
    "CA10__createTime__c" : new Date("2025-08-31T16:12:36Z"),
    "CA10__cpuUtilizationAvg30d__c" : null,
    "CA10__diskReadIopsAvg30d__c" : null,
    "CA10__diskWriteIopsAvg30d__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-01T16:12:36Z")
    },
    "Id" : "003",
    "CA10__status__c" : "available",
    "CA10__createTime__c" : new Date("2020-10-22T09:44:18Z"),
    "CA10__cpuUtilizationAvg30d__c" : null,
    "CA10__diskReadIopsAvg30d__c" : null,
    "CA10__diskWriteIopsAvg30d__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-01T16:12:36Z")
    },
    "Id" : "004",
    "CA10__status__c" : "available",
    "CA10__createTime__c" : new Date("2020-10-22T09:44:18Z"),
    "CA10__cpuUtilizationAvg30d__c" : 10,
    "CA10__diskReadIopsAvg30d__c" : 10,
    "CA10__diskWriteIopsAvg30d__c" : 10
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-01T16:12:36Z")
    },
    "Id" : "005",
    "CA10__status__c" : "available",
    "CA10__createTime__c" : new Date("2020-10-22T09:44:18Z"),
    "CA10__cpuUtilizationAvg30d__c" : 50,
    "CA10__diskReadIopsAvg30d__c" : 10,
    "CA10__diskWriteIopsAvg30d__c" : 10
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAwsRedshiftCluster__c(
      obj STRUCT<
          Id STRING,
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__status__c STRING,
          CA10__createTime__c TIMESTAMP,
          CA10__cpuUtilizationAvg30d__c FLOAT64,
          CA10__diskReadIopsAvg30d__c FLOAT64,
          CA10__diskWriteIopsAvg30d__c FLOAT64
      >,
      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 todayMinus30Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (-30 * 86400000);
      var IsEmptyLib = new function () {
          this.simpleIsEmpty = function(arg) {
              return arg == null;
          };
          this.simpleIsNotEmpty = function(arg) {
              return arg != null;
          };
      }();
      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 cluster is not available.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function extract6() { if (!this.out) { this.out = obj.CA10__createTime__c; } return this.out; };
      references1.push('Create Time [obj.CA10__createTime__c]: ' + obj.CA10__createTime__c);
      if (!(extract6.call(extract6) != null && extract6.call(extract6).getTime() < todayMinus30Day)) {
          return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "not(extract('CA10__createTime__c').beyondLastDays(30))", currentStateMessage: "The cluster has been created less than 30 days ago.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[3], conditionIndex:[300..399]
      function extract10() { if (!this.out) { this.out = obj.CA10__cpuUtilizationAvg30d__c; } return this.out; };
      function extract13() { if (!this.out) { this.out = obj.CA10__diskReadIopsAvg30d__c; } return this.out; };
      function extract16() { if (!this.out) { this.out = obj.CA10__diskWriteIopsAvg30d__c; } return this.out; };
      references1.push('CloudWatch: CPU, 30-Day [obj.CA10__cpuUtilizationAvg30d__c]: ' + obj.CA10__cpuUtilizationAvg30d__c);
      references1.push('CloudWatch: Disk Read IOPS, 30-Day [obj.CA10__diskReadIopsAvg30d__c]: ' + obj.CA10__diskReadIopsAvg30d__c);
      references1.push('CloudWatch: Disk Write IOPS, 30-Day [obj.CA10__diskWriteIopsAvg30d__c]: ' + obj.CA10__diskWriteIopsAvg30d__c);
      if (IsEmptyLib.simpleIsEmpty(extract10.call(extract10)) || IsEmptyLib.simpleIsEmpty(extract13.call(extract13)) || IsEmptyLib.simpleIsEmpty(extract16.call(extract16))) {
          return {status: 'UNDETERMINED', conditionIndex: 399, conditionText: "extract('CA10__cpuUtilizationAvg30d__c').isEmpty() || extract('CA10__diskReadIopsAvg30d__c').isEmpty() || extract('CA10__diskWriteIopsAvg30d__c').isEmpty()", currentStateMessage: "There is not enough data in the CMDB to identify if the cluster is underutilized.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[4], conditionIndex:[400..499]
      function extract20() { if (!this.out) { this.out = obj.CA10__cpuUtilizationAvg30d__c; } return this.out; };
      function extract24() { if (!this.out) { this.out = obj.CA10__diskReadIopsAvg30d__c; } return this.out; };
      function extract28() { if (!this.out) { this.out = obj.CA10__diskWriteIopsAvg30d__c; } return this.out; };
      if ((extract20.call(extract20) != null && 20.0 != null && extract20.call(extract20) < 20.0) && (extract24.call(extract24) != null && 50.0 != null && extract24.call(extract24) < 50.0) && (extract28.call(extract28) != null && 50.0 != null && extract28.call(extract28) < 50.0)) {
          return {status: 'INCOMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__cpuUtilizationAvg30d__c') < number(20.0) && extract('CA10__diskReadIopsAvg30d__c') < number(50.0) && extract('CA10__diskWriteIopsAvg30d__c') < number(50.0)", currentStateMessage: "The cluster is underutilized with Average CPU Utilization < 20%, Average  Disk I/O < 50 IOPS.", currentStateReferences: references1.join('\n'), remediation: "Consider rightsizing the cluster.", runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "The cluster is not underutilized.", 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.Id AS Id,
          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.CA10__status__c AS CA10__status__c,
          sObject.CA10__createTime__c AS CA10__createTime__c,
          sObject.CA10__cpuUtilizationAvg30d__c AS CA10__cpuUtilizationAvg30d__c,
          sObject.CA10__diskReadIopsAvg30d__c AS CA10__diskReadIopsAvg30d__c,
          sObject.CA10__diskWriteIopsAvg30d__c AS CA10__diskWriteIopsAvg30d__c,
          process_CA10__CaAwsRedshiftCluster__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__status__c AS CA10__status__c,
                  sObject.CA10__createTime__c AS CA10__createTime__c,
                  sObject.CA10__cpuUtilizationAvg30d__c AS CA10__cpuUtilizationAvg30d__c,
                  sObject.CA10__diskReadIopsAvg30d__c AS CA10__diskReadIopsAvg30d__c,
                  sObject.CA10__diskWriteIopsAvg30d__c AS CA10__diskWriteIopsAvg30d__c
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAwsRedshiftCluster__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
