Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return an error response if an error occurs in load #495

Closed
s-yata opened this issue Mar 3, 2016 · 1 comment
Closed

Return an error response if an error occurs in load #495

s-yata opened this issue Mar 3, 2016 · 1 comment
Assignees

Comments

@s-yata
Copy link
Contributor

s-yata commented Mar 3, 2016

Description

A load can be represented by more than one lines and each line is passed via grn_ctx_send.
In such a case, errors in earlier lines are logged but may not be included in a response as follows:

> table_create tbl TABLE_NO_KEY
[[0,1456992579.56416,0.00168776512145996],true]

> column_create tbl val COLUMN_SCALAR Int32
[[0,1456992579.56662,0.00175976753234863],true]

> load --table tbl '[["val","no_such_column"],["foo","var"]]'
[[-22,1456992579.56916,0.00114750862121582,"nonexistent column: <no_such_column>",[["bracket_close","db.c",12739],["load.grn",4,"load --table tbl '[[\"val\",\"no_such_column\"],[\"foo\",\"var\"]]'"]]],0]

> load --table tbl
> [
> ["val", "no_such_column"],
> ["foo", "var"]
> ]
[[0,1456992579.57066,0.000158071517944336],0]

The last load should return an error response.

@s-yata s-yata self-assigned this Mar 3, 2016
s-yata added a commit that referenced this issue Mar 3, 2016
s-yata added a commit that referenced this issue Mar 3, 2016
@s-yata s-yata added the doing label Mar 3, 2016
@s-yata
Copy link
Contributor Author

s-yata commented Mar 7, 2016

Now a multi-line load can return an error response as follows:

$ groonga -n /tmp/groonga/db
> table_create tbl TABLE_NO_KEY
[[0,1457321139.90177,0.00135469436645508],true]
> column_create tbl val COLUMN_SCALAR Int32
[[0,1457321139.90378,0.00059819221496582],true]
> load --table tbl '[["val","no_such_column"],["foo","var"]]'
[[-22,1457321139.90568,0.000501155853271484,"nonexistent column: <no_such_column>",
 [["bracket_close","db.c",12761]]],0]
> load --table tbl
> [
> ["val", "no_such_column"],
> ["foo", "var"]
> ]
[[-22,1457321139.90673,0.000919342041015625,"nonexistent column: <no_such_column>",
 [["bracket_close","db.c",12761]]],0]

However, the following example shows a strange behavior.
Only load --table tbl '[["val"],["hoge"],["foo","var"]]' returns an error response.

$ groonga -n /tmp/groonga/db
> table_create tbl TABLE_NO_KEY
[[0,1457321420.91614,0.00125432014465332],true]
> column_create tbl val COLUMN_SCALAR Int32
[[0,1457321420.92137,0.00413870811462402],true]
> load --table tbl '[["val"],["foo","var"],["hoge"]]'
[[0,1457321420.92585,0.000856161117553711],1]
> load --table tbl '[["val"],["hoge"],["foo","var"]]'
[[-22,1457321420.92692,0.000379323959350586,"unexpected #values: expected:1, actual:2",
 [["bracket_close","db.c",12842]]],1]
> load --table tbl
> [
> ["val"],
> ["hoge"],
> ["foo", "var"]
> ]
[[0,1457321420.92739,0.000867128372192383],1]

I'm not sure what is the expected response for each command.

@s-yata s-yata removed the doing label Mar 7, 2016
@s-yata s-yata closed this as completed Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant