|
if agg_col.split('.')[1] not in agg_col_to_alias: |
|
agg_col_to_alias[agg_col.split('.')[1]] = f'agg_col__{i}' |
|
udf_query = udf_query.add_select(f'{agg_col} AS agg_col__{i}') |
|
agg_list.append((agg_type, agg_col_to_alias[agg_col.split('.')[1]])) |
The program utilizes a column name as a key since the dataframe retrieved from the database use this column name instead of the format {table}.{column}. Consequently, when two dataframes are concatenated, duplicate column names may appear in the merged dataframe if the same column names exist across both tables.