klahnakoski / mo-sql-parsing

Let's make a SQL parser so we can provide a familiar interface to non-sql datastores!
Mozilla Public License 2.0
261 stars 58 forks source link

Support Structural Data Types as Cast Target #60

Closed sbrandtb closed 2 years ago

sbrandtb commented 2 years ago

Engine: PrestoDB/Athena Structural Types

fails = 'SELECT CAST(x AS ROW(y VARCHAR))'
succeeds = """
    SELECT CAST(
        x AS /* parser-replace: VARCHAR */ROW(y VARCHAR)
        /* end:parser-replace */
    )
"""

More information:

Thanks again!

klahnakoski commented 2 years ago

fixed here https://github.com/klahnakoski/mo-sql-parsing/commit/362f056a9e7e84d05e07b13f50997b9ec4fda674#diff-194d32a239132f3ee212d5ca5824f691a87e0b70df1f7c074e3d887b2bdfa15aR60

sbrandtb commented 2 years ago

@klahnakoski Thanks again for the super fast response and fix! However, nested types do not seem to work yet: SELECT CAST(x AS ARRAY(ROW(y VARCHAR)))