> if we insert different no of data in array complex datatype. then query filter on increment or last index gives error from presto
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: CARBONDATA-4178
> URL:
https://issues.apache.org/jira/browse/CARBONDATA-4178> Project: CarbonData
> Issue Type: Bug
> Components: presto-integration
> Affects Versions: 2.1.1
> Environment: Spark 2.4.5. Presto 316
> Reporter: Chetan Bhat
> Priority: Minor
>
> Steps -
> From Spark session the table creation and insert operations are executed as shown below
>
> drop table if exists complextable;
> create table complextable (id string, country array<string>, name string) stored as carbondata;
> insert into complextable select 1, array('china', 'us'), 'b' union all select 2, array ('pak', 'india', 'china'), 'v';
> From presto cli the below queries are executed.
> select * from complextable ;
> select * from complextable where country[3]='china';
>
> Issue - if we insert different no of data in array complex datatype. then query filter on increment or last index gives error from presto
> presto:ranjan> select * from complextable ;
> id | country | name
> ----++---------------------------
> 1 | [china, us] | b
> 2 | [pak, india, china] | v
> (2 rows)
> Query 20210507_072934_00002_d2cjp, FINISHED, 1 node
> Splits: 18 total, 18 done (100.00%)
> 0:07 [2 rows, 95B] [0 rows/s, 12B/s]
> presto:ranjan> select * from complextable where country[1]='pak';
> id | country | name
> ----++---------------------------
> 2 | [pak, india, china] | v
> (1 row)
> Query 20210507_072948_00003_d2cjp, FINISHED, 1 node
> Splits: 18 total, 18 done (100.00%)
> 0:06 [2 rows, 0B] [0 rows/s, 0B/s]
> presto:ranjan> select * from complextable where country[3]='china';
> id | country | name
> ----++---------------------------
> 2 | [pak, india, china] | v
> (1 row)
> Query 20210507_073007_00004_d2cjp, FAILED, 1 node
> Splits: 18 total, 1 done (5.56%)
> 0:05 [1 rows, 0B] [0 rows/s, 0B/s]
> Query 20210507_073007_00004_d2cjp failed: Array subscript out of bounds
>
> Expected - Error should not be thrown for the query executed in hetu cli and it show correct resultset as in spark session.
> 0: jdbc:hive2://10.20.254.208:23040/default> select * from complextable where country[2]='china';
> +------+-------------------------++-------
> |id|country|name|
> +------+-------------------------++-------
> |2|["pak","india","china"]|v|
> +------+-------------------------++-------
>