Skip to content

Commit f7e105a

Browse files
HCK-9137: vector type (#128)
* fix: subtypes conversion * fix: handled polyglot transformations
1 parent 52ad568 commit f7e105a

File tree

7 files changed

+136
-7
lines changed

7 files changed

+136
-7
lines changed

forward_engineering/configs/descriptors.js

+3
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,7 @@ module.exports = {
231231
domain: {
232232
mode: 'domain',
233233
},
234+
vector: {
235+
mode: 'vector',
236+
},
234237
};

forward_engineering/ddlProvider/ddlHelpers/columnDefinitionHelper.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const canHaveTypeModifier = type => ['geography', 'geometry'].includes(type);
6161
const isVector = type => ['vector', 'halfvec', 'sparsevec'].includes(type);
6262

6363
const decorateType = (type, columnDefinition) => {
64-
const { length, precision, scale, typeModifier, srid, timezone, timePrecision, dimension, array_type } =
64+
const { length, precision, scale, typeModifier, srid, timezone, timePrecision, dimension, subtype, array_type } =
6565
columnDefinition;
6666

6767
if (canHaveLength(type) && _.isNumber(length)) {
@@ -75,7 +75,7 @@ const decorateType = (type, columnDefinition) => {
7575
} else if (canHaveTimePrecision(type) && (_.isNumber(timePrecision) || timezone)) {
7676
type = addWithTimezone(addPrecision(type, timePrecision), timezone);
7777
} else if (isVector(type)) {
78-
type = dimension ? decorateVector(type, dimension) : type;
78+
type = dimension ? decorateVector(subtype, dimension) : subtype;
7979
}
8080

8181
return addArrayDecorator(type, array_type);

forward_engineering/ddlProvider/ddlProvider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ module.exports = (baseProvider, options, app) => {
593593

594594
return {
595595
name: columnDefinition.name,
596-
type: jsonSchema.mode || columnDefinition.type,
596+
type: columnDefinition.type,
597597
primaryKey: keyHelper.isInlinePrimaryKey(jsonSchema),
598598
primaryKeyOptions,
599599
unique: keyHelper.isInlineUnique(jsonSchema),

polyglot/adapter.json

+36
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,42 @@
125125
"mode": "point"
126126
}
127127
},
128+
{
129+
"from": {
130+
"type": "vector",
131+
"subtype": "vector<int8>"
132+
},
133+
"to": {
134+
"subtype": "vector"
135+
}
136+
},
137+
{
138+
"from": {
139+
"type": "vector",
140+
"subtype": "vector<float>"
141+
},
142+
"to": {
143+
"subtype": "vector"
144+
}
145+
},
146+
{
147+
"from": {
148+
"type": "vector",
149+
"subtype": "vector<float32>"
150+
},
151+
"to": {
152+
"subtype": "vector"
153+
}
154+
},
155+
{
156+
"from": {
157+
"type": "vector",
158+
"subtype": "vector<float64>"
159+
},
160+
"to": {
161+
"subtype": "vector"
162+
}
163+
},
128164
{
129165
"from": {
130166
"type": "numeric"

polyglot/convertAdapter.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Copyright © 2016-2022 by IntegrIT S.A. dba Hackolade. All rights reserved.
3+
*
4+
* The copyright to the computer software herein is the property of IntegrIT S.A.
5+
* The software may be used and/or copied only with the written permission of
6+
* IntegrIT S.A. or in accordance with the terms and conditions stipulated in
7+
* the agreement/contract under which the software has been supplied.
8+
*
9+
* {
10+
* "add": {
11+
* "entity": [<names of new property>],
12+
* "container": [<names of new property>],
13+
* "model": [<names of new property>],
14+
* "view": [<names of new property>],
15+
* "field": {
16+
* "<type>": [<names of new property>]
17+
* }
18+
* },
19+
* "delete": {
20+
* "entity": [<names of new property>],
21+
* "container": [<names of new property>],
22+
* "model": [<names of new property>],
23+
* "view": [<names of new property>],
24+
* "field": {
25+
* "<type>": [<names of new property>]
26+
* }
27+
* },
28+
* "modify": {
29+
* "entity": [
30+
* {
31+
* "from": { <properties that identify record> },
32+
* "to": { <properties that need to be changed> }
33+
* }
34+
* ],
35+
* "container": [],
36+
* "model": [],
37+
* "view": [],
38+
* "field": []
39+
* },
40+
* }
41+
*/
42+
{
43+
"modify": {
44+
"field": [
45+
{
46+
"from": {
47+
"type": "vector"
48+
},
49+
"to": {
50+
"to": "vector",
51+
"subtype": ""
52+
}
53+
}
54+
]
55+
}
56+
}

properties_pane/field_level/fieldLevelConfig.json

+37-3
Original file line numberDiff line numberDiff line change
@@ -5610,9 +5610,9 @@ making sure that you maintain a proper JSON format.
56105610
"type",
56115611
{
56125612
"propertyName": "Subtype",
5613-
"propertyKeyword": "mode",
5613+
"propertyKeyword": "subtype",
56145614
"propertyType": "select",
5615-
"options": ["", "halfvec", "sparsevec"],
5615+
"options": ["vector", "halfvec", "sparsevec"],
56165616
"cleanDependency": true
56175617
},
56185618
{
@@ -5624,7 +5624,41 @@ making sure that you maintain a proper JSON format.
56245624
"typeDecorator": true,
56255625
"minValue": 0,
56265626
"step": 1,
5627-
"maxValue": 16000
5627+
"maxValue": 2000,
5628+
"dependency": {
5629+
"key": "subtype",
5630+
"value": "vector"
5631+
}
5632+
},
5633+
{
5634+
"propertyName": "Dimension",
5635+
"propertyKeyword": "dimension",
5636+
"propertyType": "numeric",
5637+
"valueType": "integer",
5638+
"allowNegative": false,
5639+
"typeDecorator": true,
5640+
"minValue": 0,
5641+
"step": 1,
5642+
"maxValue": 4000,
5643+
"dependency": {
5644+
"key": "subtype",
5645+
"value": "halfvec"
5646+
}
5647+
},
5648+
{
5649+
"propertyName": "Dimension",
5650+
"propertyKeyword": "dimension",
5651+
"propertyType": "numeric",
5652+
"valueType": "integer",
5653+
"allowNegative": false,
5654+
"typeDecorator": true,
5655+
"minValue": 0,
5656+
"step": 1,
5657+
"maxValue": 1000,
5658+
"dependency": {
5659+
"key": "subtype",
5660+
"value": "sparsevec"
5661+
}
56285662
},
56295663
{
56305664
"propertyName": "Not null",

types/vector.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"dimension": 1
1818
},
1919
"subtypes": {
20-
"": {
20+
"vector": {
2121
"childValueType": "numeric",
2222
"childValueMode": "real"
2323
},

0 commit comments

Comments
 (0)