MallikarjunaReddyN opened a new issue, #38339:
URL: https://github.com/apache/superset/issues/38339

   ### Bug description
   
   The search functionality in the Table chart stops working after a column 
label is edited or renamed. Although the updated label is reflected in the UI, 
the search mechanism does not recognize the new column name, suggesting a 
possible mismatch between the displayed label and the underlying data field 
reference.
   
   **Repo steps:**
   
   - Create Table chart
   - Enable server pagination & Search box
   - Edit the label for column in Dimension section.
   - Choose the edited/renamed label/column in Search by dropdown
   - Enter the value in search box
   
   
   ### Screenshots/recordings
   
   The bug is demonstrated below.
   
   **Before Editing the Label/Column:**
   
   
https://github.com/user-attachments/assets/b95af2e1-280a-4c8a-b61f-91c8658ed7cc
   
   **After Editing the Label/Column:**
   
   
https://github.com/user-attachments/assets/eef4e488-fb21-4c77-9106-2c33f6b8cef1
   
   ### Superset version
   
   6.0.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   18 or greater
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   **Endpoint details:**
   http://localhost:8099/api/v1/chart/data?form_data=%7B%22slice_id%22%3A122%7D
   **Payload:**
   
{"datasource":{"id":26,"type":"table"},"force":false,"queries":[{"filters":[{"col":"Id","op":"ILIKE","val":"C001%"}],"extras":{"time_grain_sqla":"P1D","having":"","where":""},"applied_time_extras":{},"columns":[{"label":"Id","sqlExpression":"CustomerID","expressionType":"SQL"},"FirstName","LastName","Email","Phone"],"metrics":[],"orderby":[],"annotation_layers":[],"row_limit":10,"row_offset":0,"series_limit":0,"group_others_when_limit_reached":false,"order_desc":true,"url_params":{"slice_id":"122"},"custom_params":{},"custom_form_data":{},"post_processing":[],"time_offsets":[]},{"filters":[{"col":"Id","op":"ILIKE","val":"C001%"}],"extras":{"time_grain_sqla":"P1D","having":"","where":""},"applied_time_extras":{},"columns":[{"label":"Id","sqlExpression":"CustomerID","expressionType":"SQL"},"FirstName","LastName","Email","Phone"],"metrics":[],"orderby":[],"annotation_layers":[],"row_limit":10000,"row_offset":0,"series_limit":0,"group_others_when_limit_reached":false,"order_desc":true
 
,"url_params":{"slice_id":"122"},"custom_params":{},"custom_form_data":{},"post_processing":[],"time_offsets":[],"is_rowcount":true}],"form_data":{"datasource":"26__table","viz_type":"table","slice_id":122,"url_params":{"slice_id":"122"},"query_mode":"aggregate","groupby":[{"label":"Id","sqlExpression":"CustomerID","expressionType":"SQL"},"FirstName","LastName","Email","Phone"],"time_grain_sqla":"P1D","temporal_columns_lookup":{},"all_columns":[],"percent_metrics":[],"adhoc_filters":[],"order_by_cols":[],"server_pagination":true,"server_page_length":10,"row_limit":10000,"percent_metric_calculation":"row_limit","table_timestamp_format":"smart_date","include_search":true,"allow_render_html":true,"show_cell_bars":true,"color_pn":true,"comparison_color_scheme":"Green","conditional_formatting":[],"comparison_type":"values","extra_form_data":{},"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}
   **Response:**
   {
       "result": [
           {
               "cache_key": "aa3216429da4e551f391fcfc226a3371",
               "cached_dttm": null,
               "cache_timeout": 300,
               "applied_template_filters": [],
               "annotation_data": {},
               "error": null,
               "is_cached": null,
               "query": "SELECT \"CustomerID\" AS \"Id\", \"FirstName\" AS 
\"FirstName\", \"LastName\" AS \"LastName\", \"Email\" AS \"Email\", \"Phone\" 
AS \"Phone\" \nFROM public.employees GROUP BY \"CustomerID\", \"FirstName\", 
\"LastName\", \"Email\", \"Phone\" \n LIMIT 10;\n\n",
               "status": "success",
               "stacktrace": null,
               "rowcount": 10,
               "sql_rowcount": 10,
               "from_dttm": null,
               "to_dttm": null,
               "label_map": {
                   "Id": [
                       "CustomerID"
                   ],
                   "FirstName": [
                       "FirstName"
                   ],
                   "LastName": [
                       "LastName"
                   ],
                   "Email": [
                       "Email"
                   ],
                   "Phone": [
                       "Phone"
                   ]
               },
               "colnames": [
                   "Id",
                   "FirstName",
                   "LastName",
                   "Email",
                   "Phone"
               ],
               "indexnames": [
                   0,
                   1,
                   2,
                   3,
                   4,
                   5,
                   6,
                   7,
                   8,
                   9
               ],
               "coltypes": [
                   1,
                   1,
                   1,
                   1,
                   0
               ],
               "data": [
                   {
                       "Id": "C025",
                       "FirstName": "Rajesh",
                       "LastName": "Khanna",
                       "Email": "[email protected]",
                       "Phone": 9578901236
                   },
                   {
                       "Id": "C020",
                       "FirstName": "Swati",
                       "LastName": "Mishra",
                       "Email": "[email protected]",
                       "Phone": 9623456781
                   },
                   {
                       "Id": "C040",
                       "FirstName": "Komal",
                       "LastName": "Sethi",
                       "Email": "[email protected]",
                       "Phone": 9423456781
                   },
                   {
                       "Id": "C018",
                       "FirstName": "Ritu",
                       "LastName": "Saxena",
                       "Email": "[email protected]",
                       "Phone": 9645678903
                   },
                   {
                       "Id": "C034",
                       "FirstName": "Varsha",
                       "LastName": "Deshpande",
                       "Email": "[email protected]",
                       "Phone": 9489012347
                   },
                   {
                       "Id": "C029",
                       "FirstName": "Prakash",
                       "LastName": "Shetty",
                       "Email": "[email protected]",
                       "Phone": 9534567892
                   },
                   {
                       "Id": "C033",
                       "FirstName": "Sachin",
                       "LastName": "Naik",
                       "Email": "[email protected]",
                       "Phone": 9490123458
                   },
                   {
                       "Id": "C015",
                       "FirstName": "Deepak",
                       "LastName": "Choudhary",
                       "Email": "[email protected]",
                       "Phone": 9678901236
                   },
                   {
                       "Id": "C030",
                       "FirstName": "Aarti",
                       "LastName": "Dubey",
                       "Email": "[email protected]",
                       "Phone": 9523456781
                   },
                   {
                       "Id": "C035",
                       "FirstName": "Gaurav",
                       "LastName": "Mittal",
                       "Email": "[email protected]",
                       "Phone": 9478901236
                   }
               ],
               "result_format": "json",
               "applied_filters": [],
               "rejected_filters": [
                   {
                       "reason": "not_in_datasource",
                       "column": "Id"
                   }
               ]
           },
           {
               "cache_key": "260346f2006d8e444d182c642138129f",
               "cached_dttm": null,
               "cache_timeout": 300,
               "applied_template_filters": [],
               "annotation_data": {},
               "error": null,
               "is_cached": null,
               "query": "SELECT COUNT(*) AS rowcount \nFROM (SELECT 
\"CustomerID\" AS \"Id\", \"FirstName\" AS \"FirstName\", \"LastName\" AS 
\"LastName\", \"Email\" AS \"Email\", \"Phone\" AS \"Phone\" \nFROM 
public.employees GROUP BY \"CustomerID\", \"FirstName\", \"LastName\", 
\"Email\", \"Phone\" \n LIMIT 10000) AS rowcount_qry;\n\n",
               "status": "success",
               "stacktrace": null,
               "rowcount": 1,
               "sql_rowcount": 1,
               "from_dttm": null,
               "to_dttm": null,
               "label_map": {
                   "rowcount": [
                       "rowcount"
                   ],
                   "Id": [
                       "CustomerID"
                   ],
                   "FirstName": [
                       "FirstName"
                   ],
                   "LastName": [
                       "LastName"
                   ],
                   "Email": [
                       "Email"
                   ],
                   "Phone": [
                       "Phone"
                   ]
               },
               "colnames": [
                   "rowcount"
               ],
               "indexnames": [
                   0
               ],
               "coltypes": [
                   0
               ],
               "data": [
                   {
                       "rowcount": 45
                   }
               ],
               "result_format": "json",
               "applied_filters": [],
               "rejected_filters": [
                   {
                       "reason": "not_in_datasource",
                       "column": "Id"
                   }
               ]
           }
       ]
   }
   
   
   **Debug information:**
   col_obj = columns_by_name.get(cast(str, flt_col)) - No column with name 
"Id", so col_obj is becoming null. Filters are not appending with **SELECT** 
query due to **col_obj "None"**. Here is query generated at backend:
   
   **'SELECT "CustomerID" AS "Id", "FirstName" AS "FirstName", "LastName" AS 
"LastName", "Email" AS "Email", "Phone" AS "Phone" \nFROM public.employees 
GROUP BY "CustomerID", "FirstName", "LastName", "Email", "Phone" \n LIMIT 
10;\n\n'**
   
   <img width="1292" height="738" alt="Image" 
src="https://github.com/user-attachments/assets/ac1fd804-9fdf-4f57-ae28-e178e19d6410";
 />
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to