Skip to content

health-events.yaml Fix json_extract_scalar issues in lines 37-40#1486

Closed
cedricweider wants to merge 1 commit into
aws-solutions-library-samples:mainfrom
cedricweider:main
Closed

health-events.yaml Fix json_extract_scalar issues in lines 37-40#1486
cedricweider wants to merge 1 commit into
aws-solutions-library-samples:mainfrom
cedricweider:main

Conversation

@cedricweider

Copy link
Copy Markdown
Contributor

Issue #1485 :
I was attempting to update the Health Events Dashboard from v2.1.0 to v3.0.0 and got the following error several times, even while trying with cid-cmd update --force.
This issue is present in v4.4.11 (v4.4.12 could not yet be tested as we have another issue deploying it - see issue #1484 )

Athena query status failed : line 37:10: Unexpected parameters (array(varchar), varchar(4)) for function json_extract_scalar. Expected: json_extract_scalar(varchar(x), jsonpath), json_extract_scalar(json, jsonpath)

Looking at the health_events_detail_data table, it appears that the "personas" column is already of type array(varchar) and not json text, so the json_extract_scalar doesn't seem to be needed.
Replacing code in the lines 37-40 with the equivalent TRY(("personas")[X]) "persona_0X" expressions fixed the issue for me.

Description of changes:
I modified the lines 37 to 40 Athena view query definition in dashboards/health-events/health-events.yaml by removing the json_extract_scalar expression.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Best regards,
Cédric Weider

@esc1144

esc1144 commented May 27, 2026

Copy link
Copy Markdown
Contributor

Superseding with a wrapper to accommodate possibility that glue makes the field a string. Kind of a Schrödinger's cat issue.

TRY(json_extract_scalar(json_format(CAST("personas" AS JSON)), '$[0]')) AS "persona_01"

@cedricweider

Copy link
Copy Markdown
Contributor Author

@esc1144 issue solved with your changes in PR #1487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants