DataJunction / dj

A metrics platform.
http://datajunction.io
MIT License
35 stars 15 forks source link

Fix bug with handling inline table queries #1177

Closed shangyian closed 1 month ago

shangyian commented 1 month ago

Summary

This PR fixes an issue with queries that use inline tables, where they aren't parsed properly into the query AST. An example of such a query:

SELECT
  tab.source 
FROM 
  VALUES ('a'), ('b'), ('c') AS tab(source)

While other inline table queries were working, those with only one column per row, like the example above, were failing. This is due to the way the parsed structure would return a nested list in the cases where there was more than one column per row, but an unnested list for the example above. This change handles the special case.

Test Plan

Deployment Plan

netlify[bot] commented 1 month ago

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
Latest commit 1892ef739003f0caf11d137ecb5a4c5087d20e09
Latest deploy log https://app.netlify.com/sites/thriving-cassata-78ae72/deploys/66f42e7074b58c00084753dc