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

CTEs not completely extracted from successive UNION expressions #1501

Tiepies opened this Issue Jun 22, 2018 · 1 comment


2 participants

Tiepies commented Jun 22, 2018

When creating a query that contains more than one UNION expression, CTEs do not get fully extracted to the start of the generated SQL query, resulting in a syntax error:

t = con.table('functional_alltypes')
expr1 = (t.group_by(['tinyint_col', 'string_col']).aggregate(t.double_col.sum().name('metric')))
expr2 = expr1.view()
join1 = (expr1.join(expr2, expr1.string_col == expr2.string_col)[[expr1]])
join2 = join1.view()
join3 = join1.view()
expr = join1.union(join2).union(join3)
impala.error.HiveServer2Error: AnalysisException: Syntax error in line 12:
WITH t0 AS (
Encountered: WITH

CAUSED BY: Exception: Syntax error

@cpcloud cpcloud added this to the 0.14 milestone Jun 23, 2018

@cpcloud cpcloud self-assigned this Jun 23, 2018

@cpcloud cpcloud added this to To do in Impala via automation Jun 23, 2018


This comment has been minimized.


cpcloud commented Jun 23, 2018

Thanks for the report. Marked as a bug for 0.14.0.

@cpcloud cpcloud closed this in f49fb26 Jul 4, 2018

Impala automation moved this from To do to Done Jul 4, 2018

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