Open antonkovalenko opened 7 months ago
one handler for database, tables and scheme autocomplete /viewer/json/autocomplete
schema.
Params:
database: STRING?,
table: STRING[],
prefix STRING?,
limit NUMBER
Returns:
success: BOOLEAN
result?: {
entites: {name: STRING, type: STRING, tableName: STRING}[] *(when fields are displayed initial sort order must be preserved)*
},
error: STRING[]
After testing on live cluster I have a few questions:
1) Handler works different if use post
and get
methods. For example:
GET /viewer/json/autocomplete?database=%2Flocal&prefix=local%2F
- response Error: ["Inner errors while collected information"]
POST /viewer/json/autocomplete
with params {database: '/local', prefix: 'local/'}
crashes cluster.
2) If request without params, I expect list of databases with default limit, but receive empty result.
3) If request with only prefix, handler doesn't response with databases list: GET /viewer/json/autocomplete?prefix=local
response:
{
"Success": true,
"Result": {}
}
4) If request with params {database: '/local'}
, receive list with one directory '.sys_health'. Where is .sys
?
request: GET /viewer/json/autocomplete?database=%2Flocal
response:
{
"Success": true,
"Result": {
"Total": 1,
"Entities": [
{
"Name": ".sys_health",
"Type": "directory",
"Parent": "/local"
}
]
}
}
5) GET method not working with slashes. GET /viewer/json/autocomplete?database=%2Flocal&prefix=local%2F
- response Error: ["Inner errors while collected information"]
6) It would be great to have tests with handler's behavior.
For example typical user story.
This is my cluster's structure.
a) request with empty params. Receive list with database local/
b) params: {database: 'local/'}
. Receive list with two dirs - .sys_health
and .sys
.
c) params: {database: 'local/', prefix: 'local/.sys_hea'}
. Receive list one dir - .sys_health
.
d) params: {database: 'local/', prefix: 'local/.sys_health/'}
. Receive list one table test
.
Agreed with @StekPerepolnen to add enum for Entity type in TQueryAutocomplete
.
@Raubzeug https://github.com/ydb-platform/ydb/pull/3784 I have made the following changes based on comments:
Error receiving Navigate response:
For requests to the autocomplete endpoint, it is expected that:
/
, and there should be no /
at the end; I will remove these strict restrictions.In case of problems, the error will indicate bad constructed path.
@StekPerepolnen there's still a few questions:
1) Limit seems not to work. I pass 1000, but receive 10 (100% that total amount is more then 10)
2) Search should be case insensitive.
3) Fuzzy-search works a little bit strange. As for me if the substring is a strict part of the string (especially if string starts from the substring), such results should come first.
4) .sys
folder is not in results, check this please.
5) It will be handy to have a boolean flag if an entity has children.
Handler interfaces:
1) Database list (optional handler, required by YQ).
params:
returns:
Questions:
2) Schema object list - must return directories, tables, views, topics, etc
params:
returns:
3) Table schema.
Returns:
Questions:
4) List of global functions, UDF, table functions
Questions: