Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 1fedebe

Browse files
authored
Fix UInt* inferred type mapping (#609)
There's been a bug in case sensitivity - `UInt8` from ClickHouse has defaulted to `text` field in our case. I'm letting unsigned integers being just integers in ES response for now. We could also make these `unsigned_long`s... The inconsistency here is that we currently translate integers from CH to longs in ES. **So perhaps we should translate unsigned integers from CH to unsigned longs in ES (and completely ditch the `integer` type)?** I'm open to your suggestions here.
1 parent 2eefe0e commit 1fedebe

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

quesma/clickhouse/type_adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func (c SchemaTypeAdapter) Convert(s string) (schema.Type, bool) {
2626
return schema.TypeKeyword, true
2727
case "Int", "Int8", "Int16", "Int32", "Int64":
2828
return schema.TypeLong, true
29-
case "Uint8", "Uint16", "Uint32", "Uint64", "Uint128", "Uint256":
30-
return schema.TypeUnsignedLong, true
29+
case "UInt8", "UInt16", "UInt32", "UInt64", "UInt128", "UInt256":
30+
return schema.TypeInteger, true
3131
case "Bool":
3232
return schema.TypeBoolean, true
3333
case "Float32", "Float64":

quesma/quesma/functionality/field_capabilities/field_caps.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ func asElasticType(t schema.Type) string {
142142
return elasticsearch_field_types.FieldTypeObject
143143
case schema.TypePoint.Name:
144144
return elasticsearch_field_types.FieldTypeGeoPoint
145+
case schema.TypeInteger.Name:
146+
return elasticsearch_field_types.FieldTypeInteger
145147
default:
146148
return elasticsearch_field_types.FieldTypeText
147149
}

quesma/schema/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var (
88
// TODO add more and review existing
99
TypeText = Type{Name: "text", Properties: []TypeProperty{Searchable, FullText}}
1010
TypeKeyword = Type{Name: "keyword", Properties: []TypeProperty{Searchable, Aggregatable}}
11+
TypeInteger = Type{Name: "integer", Properties: []TypeProperty{Searchable, Aggregatable}}
1112
TypeLong = Type{Name: "long", Properties: []TypeProperty{Searchable, Aggregatable}}
1213
TypeUnsignedLong = Type{Name: "unsigned_long", Properties: []TypeProperty{Searchable, Aggregatable}}
1314
TypeTimestamp = Type{Name: "timestamp", Properties: []TypeProperty{Searchable, Aggregatable}}

0 commit comments

Comments
 (0)