Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix function detection with a completed argument
The current function object detection is very naive. It just looks the Nth prior code. N is the number of arguments. It works well for simple function call such as 'function(arg1, arg2)' but doesn't work well for complex function call such as 'function(column == "value1" || column == "value2")'. The simple function call has 2 codes for arguments. It's the same number as the number of arguments. The comlex function call has 5 codes for arguments. It's not the same number as the number of arguments. This change computes the correct number of codes for arguments.
- Loading branch information
Showing
9 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test/function/suite/select/filter/invalid/function_call_with_argument.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
| [[0,0.0,0.0],true] | ||
| select Users --filter '"invalid function"("alice")' | ||
| [[[-22,0.0,0.0],"invalid function: <\"invalid function\">"],[]] | ||
| #|e| invalid function: <"invalid function"> |
3 changes: 3 additions & 0 deletions
3
test/function/suite/select/filter/invalid/function_call_with_argument.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
|
|
||
| select Users --filter '"invalid function"("alice")' |
5 changes: 5 additions & 0 deletions
5
test/function/suite/select/filter/invalid/function_call_with_complex_argument.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
| [[0,0.0,0.0],true] | ||
| select Users --filter '"invalid function"(_key == "alice" || _key == "bob")' | ||
| [[[-22,0.0,0.0],"invalid function: <\"invalid function\">"],[]] | ||
| #|e| invalid function: <"invalid function"> |
3 changes: 3 additions & 0 deletions
3
test/function/suite/select/filter/invalid/function_call_with_complex_argument.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
|
|
||
| select Users --filter '"invalid function"(_key == "alice" || _key == "bob")' |
5 changes: 5 additions & 0 deletions
5
test/function/suite/select/filter/invalid/function_call_with_complex_arguments.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
| [[0,0.0,0.0],true] | ||
| select Users --filter '"invalid function"(_key == "alice" || _key == "bob", _key == "chris" && _id == 1)' | ||
| [[[-22,0.0,0.0],"invalid function: <\"invalid function\">"],[]] | ||
| #|e| invalid function: <"invalid function"> |
3 changes: 3 additions & 0 deletions
3
test/function/suite/select/filter/invalid/function_call_with_complex_arguments.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
|
|
||
| select Users --filter '"invalid function"(_key == "alice" || _key == "bob", _key == "chris" && _id == 1)' |
5 changes: 5 additions & 0 deletions
5
test/function/suite/select/filter/invalid/function_call_without_argument.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
| [[0,0.0,0.0],true] | ||
| select Users --filter '"invalid function"()' | ||
| [[[-22,0.0,0.0],"invalid function: <\"invalid function\">"],[]] | ||
| #|e| invalid function: <"invalid function"> |
3 changes: 3 additions & 0 deletions
3
test/function/suite/select/filter/invalid/function_call_without_argument.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| table_create Users TABLE_HASH_KEY ShortText | ||
|
|
||
| select Users --filter '"invalid function"()' |