You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Ali Alsuliman (JIRA)" <ji...@apache.org> on 2018/11/08 23:45:00 UTC

[jira] [Commented] (ASTERIXDB-2477) CREATE INDEX doc is incomplete

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

Ali Alsuliman commented on ASTERIXDB-2477:
------------------------------------------

The production rule for Indexes is also not quite correct. The <NOT> in the <NOT> <ENFORCED> is not in the actual grammar file, and using <NOT> will give a syntax error.

The doc mentions about indexing of open fields without enforcement, but the wording is confusing and needs to be updated, I think.

On another note, there are few cases where I'm not sure about the expected behavior of the created indexes, but most are legit (but the error messages reported are just confusing, and I think Mike stumbled upon one of them). You could experiment with the below:

 

create type openType as open \{id:int, f1:string, f2:string?, f3:int, f4:double};
create type closedType as closed \{id:int, f1:string, f2:string?, f3:int, f4:double};

create dataset ds_open(openType) primary key id;
create dataset ds_closed(closedType) primary key id;

// f1(string) is in schema
create index idx1 on ds_open(f1); // OK
create index idx2 on ds_open(f1) ENFORCED; // OK
// typed
create index idx3 on ds_open(f1: string); // OK
create index idx4 on ds_open(f1: string?); // OK
create index idx5 on ds_open(f1: string) ENFORCED; // error
create index idx6 on ds_open(f1: string?) ENFORCED; // error

// nd not in schema
create index idx7 on ds_open(nd); // error
create index idx8 on ds_open(nd) ENFORCED; // error
// typed
create index idx9 on ds_open(nd: string); // OK
create index idx10 on ds_open(nd: string?); // OK
create index idx11 on ds_open(nd: int); // OK
create index idx12 on ds_open(nd: int?); // OK
create index idx13 on ds_open(nd: double) ENFORCED; // error
create index idx14 on ds_open(nd: double?) ENFORCED; // OK
create index idx15 on ds_open(nd: double); // OK
create index idx16 on ds_open(nd: datetime); // OK
create index idx17 on ds_open(nd: int?) ENFORCED; // error, now clashing with idx14

The question mark "?" in the syntax is confusing.

 

> CREATE INDEX doc is incomplete
> ------------------------------
>
>                 Key: ASTERIXDB-2477
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2477
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: DOC - Documentation
>    Affects Versions: 0.9.4
>            Reporter: Michael J. Carey
>            Assignee: Dmitry Lychagin
>            Priority: Major
>
> Our CREATE INDEX documentation says:
> An indexed field is not required to be part of the datatype associated with a dataset if the dataset's datatype is declared as open *and* if the field's type is provided along with its name and if the {{ENFORCED}} keyword is specified at the end of the index definition. {{ENFORCING}} an open field introduces a check that makes sure that the actual type of the indexed field (if the optional field exists in the object) always matches this specified (open) field type.
> This is no longer the case AFAIK - I believe we also allow indexing of open fields now without enforcement, right?  (I.e., this was just our initial story.)  This more general case and its behavior need to be elaborated on here.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)