Github user jaanai0 commented on the issue:
https://github.com/apache/phoenix/pull/355
Thanks for your point out. @dbwong This grammar references ORACLE dialect(
https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_3001.htm#i2103956),
only one column can be modified at a time.
The modify grammar will not change old data, which just change schema
information. we can get correctly query result on the server side as long as
the values of filtering conditions are tampered with on the client side.
For Varchar type, now we can not trim query results if the length of
fields is decreased, so the example that @dbwong gave will be ok, for blew
queries that haven't result, I also add a new test case in the code which
similar with this scenario.
> SELECT * from table WHERE b=='13'; -- does this return 2 rows? or does it
return 0?
SELECT * from tableIdx WHERE b=='13'; -- this will return 0 rows
For Char type, we will forbid to decrease the length of fields. The query
results will be trimmed on the client side that can not match actual data. For
example:
_CREATE TABLE tableName (a VARCHAR(5), b VARCHAR(5), CONSTRAINT PK
PRIMARY KEY (a));
CREATE INDEX tableIdx ON tableName (b);
UPSERT INTO tableName Values('b','13555');
ALTER TABLE tableName modify b VARCHAR(2);
UPSERT INTO tableName Values('d','13');
SELECT /*+ NO_INDEX*/ b from tableName WHERE b='13';
SELECT /*+ NO_INDEX*/ b from " + tableName + " WHERE b='13555';
SELECT \"0:B\" from tableIdx WHERE \"0:B\"='13555';
SELECT \"0:B\" from tableIdx WHERE \"0:B\"='13';_
Output:
13
13(this is a incorrect result)
13555
13
@twdsilva @dbwong I have updated the patch again.
---