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

Invalid error message when functional index function returns scalar instead of array #4553

Closed
kshcherbatov opened this issue Oct 7, 2019 · 0 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@kshcherbatov
Copy link
Contributor

kshcherbatov commented Oct 7, 2019

e.g.

ufm_storage:create_index( 'PROF_HASH_1', {
            parts = { {1, 'string', is_nullable=true} },
            func = 'PROF_HASH_1_index_fun',
            if_not_exists = true, unique = false
        }
    )
func_body = [[ function(tup)
            local doc = tup[4]
            if (doc.attrs ~= nil) and (doc.attrs.strMap ~= nil)  then
                return doc.attrs.strMap.PROF_HASH_1
            end
            return nil
        end
    ]]

Error:

"type":"ClientError",
"message":"Key format doesn't mat ch one defined in functional index 'PROF_HASH_1' of space 'ufm_storage': supplied key type is invalid: expected boolean"

Fix:

                diag_set(ClientError, ER_FUNC_INDEX_FORMAT, it->index_def->name,
                         space ? space_name(space) : "",
                         tt_sprintf("supplied key type is invalid: expected %s",
-                                   field_type_strs[MP_ARRAY]));
+                                   field_type_strs[FIELD_TYPE_ARRAY]));
@kshcherbatov kshcherbatov added bug Something isn't working good first issue Good for newcomers labels Oct 7, 2019
kshcherbatov added a commit that referenced this issue Oct 8, 2019
Functional index extractor code used to raise an invalid
error message when the user-defined extractor function
returns a scalar instead of a table.

Closes #4553
@kshcherbatov kshcherbatov self-assigned this Oct 8, 2019
kshcherbatov added a commit that referenced this issue Oct 15, 2019
Functional index extractor code used to raise an invalid
error message when the user-defined extractor function
returns a scalar instead of a table.

Closes #4553
kyukhin pushed a commit that referenced this issue Oct 21, 2019
Functional index extractor code used to raise an invalid
error message when the user-defined extractor function
returns a scalar instead of a table.

Closes #4553

(cherry picked from commit 260a3b3)
@kyukhin kyukhin added this to the 2.2.2 milestone Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants