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

Semicolon bug in generate SQL - but works in HUE/CLI #146

Closed
geoHeil opened this issue Mar 2, 2023 · 3 comments
Closed

Semicolon bug in generate SQL - but works in HUE/CLI #146

geoHeil opened this issue Mar 2, 2023 · 3 comments
Assignees

Comments

@geoHeil
Copy link

geoHeil commented Mar 2, 2023

For both dbt-impala versions 1.3.1 and 1.4.0) I run into the following issue:

 Unable to establish connection to Impala server: Error while compiling statement: FAILED: ParseException line 20:2 extraneous input ';' expecting EOF near '<EOF>'

For a model of:

{{ config(materialized='table') }}
SELECT 1 AS foo, 2 as bar

and generated code of:


  
    

  create  table
    <<target_schema>>.example__dbt_tmp
    
    
    
    
    
    
     
    
    
  as 
    
SELECT 1 AS foo, 2 as bar
  ;
  

Keep in mind this code executes just fine in the Impala Hue UI.

What is going on/wrong here and how can this be fixed?

Logs:
Tracker adapter: Usage tracking flag False. To turn on/off use usage_tracking flag in profiles.yml
Tracker adapter: Skipping Event {'event_type': 'start_query', 'sql': '/* {"app": "dbt", "dbt_version": "1.3.2", "profile_name": "dummy_project", "target_name": "dev", "node_id": "model.dummy_project.example"} */\n\n  \n    \n\n  create  table\n    <<target_schema>>.example__dbt_tmp\n    \n    \n    \n    \n    \n    \n     \n    \n    \n  as \n    \nSELECT 1 AS foo, 2 as bar\n  ;\n  ', 'profile_name': 'dummy_project', 'app': 'dbt', 'dbt_version': '1.3.2', 'target_name': 'dev', 'model_name': 'model.dummy_project.example'}
On model.dummy_project.example: /* {"app": "dbt", "dbt_version": "1.3.2", "profile_name": "dummy_project", "target_name": "dev", "node_id": "model.dummy_project.example"} */

  
    

  create  table
    <<target_schema>>.example__dbt_tmp
    
    
    
    
    
    
     
    
    
  as 
    
SELECT 1 AS foo, 2 as bar
  ;
  
Opening a new connection, currently in state closed
Impala adapter: Using user agent: dbt/cloudera-impala-v1.3.1
Tracker adapter: Usage tracking flag False. To turn on/off use usage_tracking flag in profiles.yml
Tracker adapter: Skipping Event {'event_type': 'open', 'auth': 'ldap', 'connection_state': <ConnectionState.OPEN: 'open'>, 'elapsed_time': '0.02'}
Tracker adapter: Usage tracking flag False. To turn on/off use usage_tracking flag in profiles.yml
Tracker adapter: Skipping Event {'event_type': 'end_query', 'sql': '/* {"app": "dbt", "dbt_version": "1.3.2", "profile_name": "dummy_project", "target_name": "dev", "node_id": "model.dummy_project.example"} */\n\n  \n    \n\n  create  table\n    <<target_schema>>.example__dbt_tmp\n    \n    \n    \n    \n    \n    \n     \n    \n    \n  as \n    \nSELECT 1 AS foo, 2 as bar\n  ;\n  ', 'elapsed_time': '0.84', 'status': "Error while compiling statement: FAILED: ParseException line 20:2 extraneous input ';' expecting EOF near '<EOF>'", 'profile_name': 'dummy_project'}
Impala adapter: Server connection error: Error while compiling statement: FAILED: ParseException line 20:2 extraneous input ';' expecting EOF near '<EOF>'
finished collecting timing info
On model.dummy_project.example: ROLLBACK

@geoHeil
Copy link
Author

geoHeil commented Mar 2, 2023

https://github.com/cloudera/dbt-impala/blob/master/dbt/include/impala/macros/adapters.sql#L168

deleting this ;

results in:

# instead of previously:
ParseException line 20:2 extraneous input ';'

# result after commenting out ; for create table
ParseException line 3:42 extraneous input ';'

I have further removed all semicolons (create view, drop view if exists).

Then the dbt run is successfull

@niteshy
Copy link
Collaborator

niteshy commented Jun 7, 2023

I have fixed this issue as a part of this PR

@niteshy
Copy link
Collaborator

niteshy commented Jun 15, 2023

Closed by #173

@niteshy niteshy closed this as completed Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants