Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fail to create materialized view with common table expression #760

Open
dai-chen opened this issue Oct 9, 2024 · 0 comments
Open
Labels
bug Something isn't working Core:MV

Comments

@dai-chen
Copy link
Collaborator

dai-chen commented Oct 9, 2024

What is the bug?

Currently, Materialized View queries do not support Common Table Expressions (CTEs) as source tables in the FROM clause. The issue stems from prevalidation logic, which fails to properly handle the table name extraction.

How can one reproduce the bug?

CREATE MATERIALIZED VIEW mv_test AS
WITH aggregated AS (
    SELECT
       ...
    FROM http_logs
    WHERE year = 1998 AND month = 5 AND day = 18
    GROUP BY TUMBLE(`@timestamp`, '1 Day')
)
SELECT
  ...
FROM aggregated AS agg1;

What is the expected behavior?

The materialized view should be created successfully without any errors.

Do you have any additional context?

Error encountered:

java.util.NoSuchElementException: None.get
    at scala.None$.get(Option.scala:529)
    at scala.None$.get(Option.scala:527)
    at org.opensearch.flint.spark.FlintSparkValidationHelper.$anonfun$isTableProviderSupported$1(FlintSparkValidationHelper.scala:49)
    at org.opensearch.flint.spark.FlintSparkValidationHelper.$anonfun$isTableProviderSupported$1$adapted(FlintSparkValidationHelper.scala:47)
    at scala.collection.IndexedSeqOptimized.prefixLengthImpl(IndexedSeqOptimized.scala:41)
    at scala.collection.IndexedSeqOptimized.exists(IndexedSeqOptimized.scala:49)
    at scala.collection.IndexedSeqOptimized.exists$(IndexedSeqOptimized.scala:49)

@dai-chen dai-chen added bug Something isn't working untriaged Core:MV and removed untriaged labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Core:MV
Projects
None yet
Development

No branches or pull requests

1 participant