Skip to content

Commit

Permalink
Fix #15 – add LowCardinality support
Browse files Browse the repository at this point in the history
  • Loading branch information
vgv committed May 21, 2024
1 parent 61e7461 commit 215bdc4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/kotlin/com/ecwid/clickhouse/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ internal fun parseType(type: String): Type {
parseArrayType(type)
} else if (type.startsWith("Map(")) {
parseMapType(type)
} else if (type.startsWith("LowCardinality(")) {
parseLowCardinalityType(type)
} else {
parsePlatformType(type)
}
Expand Down Expand Up @@ -113,6 +115,12 @@ private fun parsePlatformType(type: String): Type {
return Type.Platform(platformType, type)
}

private fun parseLowCardinalityType(type: String): Type {
val platformTypeName = type.removeSurrounding(prefix = "LowCardinality(", suffix = ")")
val platformType = findPlatformType(platformTypeName)
return Type.Platform(platformType, type)
}

private fun parseArrayType(type: String): Type {
val platformTypeName = type.removeSurrounding("Array(", ")")
val platformType = findPlatformType(platformTypeName)
Expand Down

0 comments on commit 215bdc4

Please sign in to comment.