I have a query with multiple CTEs and it works in Athena. But when I use the same query in quicksight dataset custom SQL, the new column “extracted_value3” from the final CTE "Finalcte4 " is not visible.
WITH cte1 AS (
SELECT
column1,
split(column2,',') as array_column
FROM
my_table
),
cte2 AS (
SELECT
column1,
REGEXP_SUBSTR(value, 'pattern1') AS extracted_value1
FROM
cte1
GROUP BY
column1
),
cte3 AS (
SELECT
column1,
split(extracted_value1, ':') AS extracted_value2
FROM
cte2
),
Finalcte4 AS (
SELECT
column1,
split(extracted_value2, '\') AS extracted_value3
FROM
cte3
),
SELECT
column1,
extracted_value3
FROM
Finalcte4
The output in custom SQL only has column1 but no extracted_value3.
In Athena,
Column1
extracted_value3
value1
extracted_val1
value2
extracted_val2
In Custom SQL,
Column1
value1
value2
I wonder if the Athena query and Custom SQL query is different? Can anyone also help me to make the Finalcte4 extracted_value3 column visible in the custom SQL? Thank you!
1/ Validate the CTE SQL example you have provided
2/ REGEXP_SUBSTR is not supported in Amazon Athena.
2/ Screenshots of the results from Athena using REGEXP_SUBSTR , similar to my example
SELECT REGEXP_SUBSTR (‘AmazonQuickSight Gen BI’, ‘(\S*)(\s)’)
Hi @emyatsuna,
Since we haven’t heard back, I’ll close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.