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

Wail Alkowaileet commented on ASTERIXDB-2218:
---------------------------------------------

For the closed-type, both the primary index and the secondary index will have 
the same *demoted* value (64). I'm not sure if that's a correct behavior or a 
type mismatch exception should be thrown.
However for the open-type, the primary index will have double value (64.79) and 
the secondary index will get the demoted value. 

Maybe we should only allow promote but no demote for Insert/upsert/update?

> Enforcement of a secondary index does not work.
> -----------------------------------------------
>
>                 Key: ASTERIXDB-2218
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2218
>             Project: Apache AsterixDB
>          Issue Type: Bug
>            Reporter: Taewoo Kim
>
> The enforced index does not check the field type when inserting a record. The 
> following code work on the current master.
> {code}
> create type tempType if not exists as open {
>     id: int64
> };
> create dataset tempDataset(tempType) primary key id;
> create index tempIndex on tempDataset(val:int64?) enforced;
> insert into tempDataset({"id":1,"val":64.79});
> {code}
> For a closed-type field, it works as well.
> {code}
> create type tempClosedType if not exists as closed {
>     id: int64,
>     val: int64
> };
> create dataset tempClosedDataset(tempClosedType) primary key id;
> create index tempClosedIndex on tempClosedDataset(val);
> insert into tempClosedDataset({"id":1,"val":64.79});
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to