Skip to content

Commit

Permalink
YDB: map into (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyisaev2 authored Nov 12, 2024
1 parent 6a6035c commit fe69b93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions app/server/datasource/rdbms/ydb/type_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ func makePrimitiveTypeFromString(typeName string) (*Ydb.Type, error) {
case typeTimestamp:
return common.MakePrimitiveType(Ydb.Type_TIMESTAMP), nil
case typeJSONDocument:
return common.MakePrimitiveType(Ydb.Type_JSON_DOCUMENT), nil
// This inconsistency is due to KIKIMR-22201
return common.MakePrimitiveType(Ydb.Type_JSON), nil
default:
return nil, fmt.Errorf("convert type '%s': %w", typeName, common.ErrDataTypeNotSupported)
}
Expand Down Expand Up @@ -258,9 +259,9 @@ func makeAcceptorAppender(
return makeAcceptorAppenderCheckOptional[float32, float32, *array.Float32Builder](optional, cc.Float32())
case typeDouble:
return makeAcceptorAppenderCheckOptional[float64, float64, *array.Float64Builder](optional, cc.Float64())
case typeString, typeJSONDocument:
case typeString:
return makeAcceptorAppenderCheckOptional[[]byte, []byte, *array.BinaryBuilder](optional, cc.Bytes())
case typeUtf8, typeJSON:
case typeUtf8, typeJSON, typeJSONDocument:
return makeAcceptorAppenderCheckOptional[string, string, *array.StringBuilder](optional, cc.String())
case typeDate:
switch ydbTypeID {
Expand Down
8 changes: 4 additions & 4 deletions tests/infra/datasource/ydb/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,16 @@ var tables = map[string]*test_utils.Table[int32, *array.Int32Builder]{
Schema: &test_utils.TableSchema{
Columns: map[string]*Ydb.Type{
"id": common.MakePrimitiveType(Ydb.Type_INT32),
"data": common.MakePrimitiveType(Ydb.Type_JSON_DOCUMENT),
"data": common.MakePrimitiveType(Ydb.Type_JSON),
},
},
Records: []*test_utils.Record[int32, *array.Int32Builder]{
{
Columns: map[string]any{
"id": []int32{1, 2},
"data": [][]byte{
[]byte("{\"key1\":\"value1\"}"),
[]byte("{\"key2\":\"value2\"}"),
"data": []string{
"{\"key1\":\"value1\"}",
"{\"key2\":\"value2\"}",
},
},
},
Expand Down
6 changes: 4 additions & 2 deletions tools/ydb/query_service_negative/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ const (

func main() {
// Define flags for login and password
var login string
var password string
var (
login string
password string
)

flag.StringVar(&login, "login", "", "Username for login")
flag.StringVar(&password, "password", "", "Password for login")
Expand Down

0 comments on commit fe69b93

Please sign in to comment.