[ 
https://issues.apache.org/jira/browse/PHOENIX-7031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767022#comment-17767022
 ] 

Viraj Jasani commented on PHOENIX-7031:
---------------------------------------

The concern here is that the timestamp is not updated for each row after 
dropping the column. I will provide example later.

Just to clarify, this behavior happens because when DeleteColumn or 
DeleteFamily is applied (as part of drop column or delete row respectively), 
empty column cell timestamp remains the same. Only when we update the row, we 
include empty column cell, which results in the timestamp update for the empty 
column cell.

> Secondary Index with PHOENIX_ROW_TIMESTAMP() Not Updating After Column Drop
> ---------------------------------------------------------------------------
>
>                 Key: PHOENIX-7031
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7031
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Saurabh Rai
>            Priority: Major
>
> *Issue Summary:* When creating a secondary index with 
> {{PHOENIX_ROW_TIMESTAMP()}} as one of the indexed columns and subsequently 
> dropping a column from the data table, the secondary index does not reflect 
> the updates as expected. This behavior is inconsistent with the expected 
> behavior where secondary indexes should stay synchronized with changes to the 
> data table structure.
> *Steps to Reproduce:*
>  # Create a DataTable and Define a Secondary Index:
>  # Create a DataTable with a primary key and additional columns.
>  ## {{CREATE TABLE datatable (id varchar(10) primary key, var1 varchar(10), 
> var2 varchar(10), var3 varchar(10));}}
>  # Define a secondary index on {{PHOENIX_ROW_TIMESTAMP()}} for the DataTable. 
> (This issue impacts both UNCOVERED and COVERED indexes)
>  ## CREATE UNCOVERED INDEX indextable on datatable (PHOENIX_ROW_TIMESTAMP());
>  # Insert Rows and Perform Column Drop:
>  ## Insert some rows into the DataTable.
>  # Alter the DataTable to drop a column, for example:
>  ## ALTER TABLE datatable DROP COLUMN var1;
> *Expected Results:* The secondary index {{indextable}} should stay 
> synchronized with changes to the DataTable structure, and updates to rows, 
> including dropped columns, should be accurately reflected in the index.
> *Actual Results:* The secondary index {{indextable}} does not update as 
> expected after a column is dropped from the DataTable. This behavior is 
> inconsistent with the expected behavior of secondary indexes in Apache 
> Phoenix.
>  
> *Additional Information:*
> Index table gets update when we set the column value to NULL through UPSERT 
> statement.
> Example - 
> {{UPSERT INTO datatable (ID, ColumnName) SELECT ID, NULL from datatable;}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to