File tree Expand file tree Collapse file tree 6 files changed +30
-0
lines changed
Expand file tree Collapse file tree 6 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ export function NewSQL() {
7575 text : i18n ( 'action.add-index' ) ,
7676 action : actions . addTableIndex ,
7777 } ,
78+ {
79+ text : i18n ( 'action.add-vector-index' ) ,
80+ action : actions . addVectorIndex ,
81+ } ,
7882 {
7983 text : i18n ( 'action.drop-index' ) ,
8084 action : actions . dropTableIndex ,
Original file line number Diff line number Diff line change 1010 "action.delete-rows" : " Delete rows" ,
1111 "action.drop-table" : " Drop table" ,
1212 "action.add-index" : " Add index" ,
13+ "action.add-vector-index" : " Add vector index" ,
1314 "action.drop-index" : " Drop index" ,
1415 "action.drop-external-table" : " Drop external table" ,
1516 "menu.tables" : " Tables" ,
Original file line number Diff line number Diff line change 4444 "actions.manageColumns" : " Manage columns..." ,
4545 "actions.manageAutoPartitioning" : " Manage auto partitioning..." ,
4646 "actions.addTableIndex" : " Add index..." ,
47+ "actions.addVectorIndex" : " Add vector index..." ,
4748 "actions.createCdcStream" : " Create changefeed..." ,
4849 "actions.showCreateTable" : " Show Create SQL..." ,
4950 "actions.alterTopic" : " Alter topic..." ,
Original file line number Diff line number Diff line change 11import {
22 addTableIndex ,
3+ addVectorIndex ,
34 alterAsyncReplicationTemplate ,
45 alterStreamingQuerySettingsTemplate ,
56 alterStreamingQueryText ,
@@ -72,6 +73,7 @@ export const bindActions = (changeUserInput: (input: string) => void) => {
7273 revokePrivilege : inputQuery ( revokePrivilegeTemplate ) ,
7374 dropUser : inputQuery ( dropUserTemplate ) ,
7475 dropGroup : inputQuery ( dropGroupTemplate ) ,
76+ addVectorIndex : inputQuery ( addVectorIndex ) ,
7577 addTableIndex : inputQuery ( addTableIndex ) ,
7678 dropTableIndex : inputQuery ( dropTableIndex ) ,
7779 showCreateTable : inputQuery ( showCreateTableTemplate ) ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import i18n from '../i18n';
2222import type { TemplateFn } from './schemaQueryTemplates' ;
2323import {
2424 addTableIndex ,
25+ addVectorIndex ,
2526 alterAsyncReplicationTemplate ,
2627 alterStreamingQuerySettingsTemplate ,
2728 alterStreamingQueryText ,
@@ -152,6 +153,7 @@ const bindActions = (
152153 alterStreamingQueryText : inputQuery ( alterStreamingQueryText ) ,
153154 dropStreamingQuery : inputQuery ( dropStreamingQueryTemplate ) ,
154155 dropIndex : inputQuery ( dropTableIndex ) ,
156+ addVectorIndex : inputQuery ( addVectorIndex ) ,
155157 addTableIndex : inputQuery ( addTableIndex ) ,
156158 createCdcStream : inputQuery ( createCdcStreamTemplate ) ,
157159 copyPath : ( ) => {
@@ -299,6 +301,7 @@ export const getActions =
299301 isLoading : additionalEffects . isSchemaDataLoading ,
300302 } ) ,
301303 { text : i18n ( 'actions.addTableIndex' ) , action : actions . addTableIndex } ,
304+ { text : i18n ( 'actions.addVectorIndex' ) , action : actions . addVectorIndex } ,
302305 { text : i18n ( 'actions.createCdcStream' ) , action : actions . createCdcStream } ,
303306 ] ,
304307 [ showCreateTableItem ] ,
Original file line number Diff line number Diff line change @@ -383,6 +383,25 @@ export const addTableIndex = (params?: SchemaQueryParams) => {
383383 return `ALTER TABLE ${ path } ADD INDEX \${2:index_name} GLOBAL ON (\${3:<column_name>});` ;
384384} ;
385385
386+ export const addVectorIndex = ( params ?: SchemaQueryParams ) => {
387+ const path = params ?. relativePath
388+ ? `\`${ normalizeParameter ( params . relativePath ) } \``
389+ : '${1:<my_table>}' ;
390+
391+ return `-- docs: https://ydb.tech/docs/en/dev/vector-indexes?version=main#types
392+ ALTER TABLE ${ path }
393+ ADD INDEX \${2:my_vector_index}
394+ GLOBAL USING vector_kmeans_tree
395+ ON (\${3:embedding})
396+ WITH (
397+ distance=cosine,
398+ vector_type="uint8",
399+ vector_dimension=\${4:512},
400+ levels=\${5:2},
401+ clusters=\${6:128}
402+ );` ;
403+ } ;
404+
386405export const dropTableIndex = ( params ?: SchemaQueryParams ) => {
387406 const indexName = params ?. relativePath . split ( '/' ) . pop ( ) ;
388407 const path = params ?. relativePath . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
You can’t perform that action at this time.
0 commit comments