> Query with SI after add partition based on location on partition table gives incorrect results
> ----------------------------------------------------------------------------------------------
>
> Key: CARBONDATA-4149
> URL:
https://issues.apache.org/jira/browse/CARBONDATA-4149> Project: CarbonData
> Issue Type: Bug
> Reporter: SHREELEKHYA GAMPA
> Priority: Minor
> Fix For: 2.1.1
>
> Time Spent: 5h 20m
> Remaining Estimate: 0h
>
> Queries to execute:
> * drop table if exists partitionTable;
> * create table partitionTable (id int,name String) partitioned by(email string) stored as carbondata;
> * insert into partitionTable select 1,'blue','abc';
> * CREATE INDEX maintable_si112 on table partitionTable (name) as 'carbondata';
> * alter table partitionTable add partition (email='def') location '$sdkWritePath';
> * select *from partitionTable where name = 'red'; ---> returns empty result
> * select *from partitionTable where ni(name = 'red');
> * alter table partitionTable compact 'major';
> * select *from partitionTable where name = 'red';
> spark-sql> create table partitionTable (id int,name String) partitioned by(email string) STORED AS carbondata;
> Time taken: 1.962 seconds
> spark-sql> CREATE INDEX maintable_si112 on table partitionTable (name) as 'carbondata';
> Time taken: 2.759 seconds
> spark-sql> insert into partitionTable select 1,'huawei','abc';
> 0
> Time taken: 5.808 seconds, Fetched 1 row(s)
> spark-sql> alter table partitionTable add partition (email='def') location 'hdfs://hacluster/datastore';
> Time taken: 1.108 seconds
> spark-sql> insert into partitionTable select 1,'huawei','def';
> 1
> Time taken: 2.707 seconds, Fetched 1 row(s)
> spark-sql> select *from partitionTable where name='huawei';
> 1 huawei abc
> Time taken: 0.75 seconds, Fetched 1 row(s)
> spark-sql> select *from partitionTable where ni(name='huawei');
> 1 huawei def
> 1 huawei abc
> Time taken: 0.507 seconds, Fetched 2 row(s)
> spark-sql>
>