ibis icon indicating copy to clipboard operation
ibis copied to clipboard

bug: When I alias a dataframe and subsequently use SQL that references its columns, the aliasing process might not allow direct referencing of the original column names.

Open stereoF opened this issue 1 year ago • 0 comments

What happened?

I have an Ibis dataframe named df with a column named account_id:

df.columns

['user_id', 'account_id', 'algo_user_addsteps_rate_30d', 'algo_user_pay_num', ..., 'province_shift_7d', 'city_shift_7d']

When I alias this dataframe as df and try to use it in a SQL query:

df1 = df.alias('df').sql('select *, halfMD5(account_id) as id_md5 from df')

I encounter the following error:

Code: 47. DB::Exception: Missing columns: 'account_id' while processing the query: 'WITH df AS (SELECT t6.user_id, t6.account_id, t6.algo_user_addsteps_rate_30d, t6.algo_user_pay_num, ......'t9.latest_totalrecharge_times_shift_7d' 't9.city_shift_7d'. (UNKNOWN_IDENTIFIER) (version 22.8.5.29)

Based on the error message, I must manually adjust the query as follows to execute it correctly:

df1 = df.alias('df').sql('select *, halfMD5(t6.account_id) as id_md5 from df')

What version of ibis are you using?

9.0.0

What backend(s) are you using, if any?

clickhouse

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

stereoF avatar May 08 '24 02:05 stereoF