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

[CUBVEC-14] CREATE TABLE: 2. Show 'VECTOR' column type when 'desc' #5724

Merged
merged 7 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/compat/dbtype_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,15 @@ extern "C"
DB_TYPE_DATETIMETZ = 38,
DB_TYPE_DATETIMELTZ = 39,
DB_TYPE_JSON = 40,
DB_TYPE_VECTOR = 41,

/* aliases */
DB_TYPE_LIST = DB_TYPE_SEQUENCE,
DB_TYPE_SMALLINT = DB_TYPE_SHORT, /* SQL SMALLINT */
DB_TYPE_VARCHAR = DB_TYPE_STRING, /* SQL CHAR(n) VARYING values */
DB_TYPE_UTIME = DB_TYPE_TIMESTAMP, /* SQL TIMESTAMP */

DB_TYPE_LAST = DB_TYPE_JSON
DB_TYPE_LAST = DB_TYPE_VECTOR
} DB_TYPE;

/* Domain information stored in DB_VALUE structures. */
Expand Down
27 changes: 27 additions & 0 deletions src/object/object_primitive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,31 @@ PR_TYPE tp_Sequence = {

PR_TYPE *tp_Type_sequence = &tp_Sequence;

PR_TYPE tp_Vector = {
"vector", DB_TYPE_VECTOR, 1, sizeof (SETOBJ *), 0, 4,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};

PR_TYPE *tp_Type_vector = &tp_Vector;

PR_TYPE tp_Midxkey = {
"midxkey", DB_TYPE_MIDXKEY, 1, 0, 0, 1,
NULL, /* initmem */
Expand Down Expand Up @@ -1790,6 +1815,7 @@ PR_TYPE *tp_Type_id_map[] = {
&tp_Datetimetz,
&tp_Datetimeltz,
&tp_Json,
&tp_Vector,
};

PR_TYPE tp_ResultSet = {
Expand Down Expand Up @@ -17115,3 +17141,4 @@ mr_cmpval_json (DB_VALUE * value1, DB_VALUE * value2, int do_coercion, int total
pr_clear_value (&scalar_value2);
return cmp_result;
}

1 change: 1 addition & 0 deletions src/object/object_primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ extern PR_TYPE tp_Datetimeltz;
extern PR_TYPE tp_Timetz;
extern PR_TYPE tp_Timeltz;
extern PR_TYPE tp_Json;
extern PR_TYPE tp_Vector;

extern PR_TYPE *tp_Type_null;
extern PR_TYPE *tp_Type_integer;
Expand Down
4 changes: 4 additions & 0 deletions src/object/object_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ void object_printer::describe_domain (/*const*/tp_domain &domain, class_descript
}
}
break;
case DB_TYPE_VECTOR:
strcpy (temp_buffer, temp_domain->type->name);
m_buf ("%s", ustr_upper (temp_buffer));
break;

case DB_TYPE_ENUMERATION:
has_collation = 1;
Expand Down
5 changes: 5 additions & 0 deletions src/parser/parse_dbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,7 @@ pt_type_enum_to_db_domain (const PT_TYPE_ENUM t)
case DB_TYPE_OBJECT:
case DB_TYPE_SET:
case DB_TYPE_MULTISET:
case DB_TYPE_VECTOR:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

JSON 다음에 추가

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DB_TYPE_SEQUENCE 다음에 추가하는 방식으로 통일하는 것을 제안드립니다.
많은 switch-case문에서 DB_TYPE_SEQUENCE를 특수 처리하는 패턴을 그대로 따르기 때문에, 리뷰 과정에서 코드의 의도를 파악하기가 더 용이할 것으로 생각됩니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L

NIT 의견이기 때문에 @vimkim님이 선택하시면 되겠습니다. 일부는 JSON 뒤에 일부는 MULTISET 뒤에 정렬되어 있어서 일관성 있게 정리되었으면 하는 바람으로 드린 의견입니다. 추후 VECTOR 타입 구현이 달라질 수도 있구요.

case DB_TYPE_SEQUENCE:
case DB_TYPE_MIDXKEY:
case DB_TYPE_ENUMERATION:
Expand Down Expand Up @@ -2380,6 +2381,10 @@ pt_type_enum_to_db (const PT_TYPE_ENUM t)
db_type = DB_TYPE_JSON;
break;

case PT_TYPE_VECTOR:
db_type = DB_TYPE_VECTOR;
break;

case PT_TYPE_OBJECT:
db_type = DB_TYPE_OBJECT;
break;
Expand Down
3 changes: 3 additions & 0 deletions src/query/query_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -25042,6 +25042,9 @@ qexec_schema_get_type_name_from_id (DB_TYPE id)
case DB_TYPE_SEQUENCE:
return "SEQUENCE";

case DB_TYPE_VECTOR:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

JSON 다음에 추가

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위와 동일

return "VECTOR";

case DB_TYPE_NCHAR:
return "NCHAR";

Expand Down