ClickHouse.Client icon indicating copy to clipboard operation
ClickHouse.Client copied to clipboard

Error querying 'Tuple' type

Open JavenJin opened this issue 3 years ago • 3 comments

I used Dbeaver to query my ClickHouse database and the following type of columns exist in a particular table.

dataType
 
Tuple(s String, i Int64)

When I query the table in my C# application I am prompted with the error.

System.ArgumentException: 'Unknown type: s String'

The code that went wrong is in the TypeConverter, as follows.

        internal static ClickHouseType ParseClickHouseType(SyntaxTreeNode node)
        {
            if (node.ChildNodes.Count == 0 && SimpleTypes.TryGetValue(node.Value, out var typeInfo))
            {
                return typeInfo;
            }

            if (ParameterizedTypes.ContainsKey(node.Value))
            {
                return ParameterizedTypes[node.Value].Parse(node, ParseClickHouseType);
            }

            throw new ArgumentException("Unknown type: " + node.ToString());
        }

Error when node.Value is equal to 's String'.

JavenJin avatar Apr 19 '22 03:04 JavenJin

@DarkWanderer

JavenJin avatar Apr 19 '22 04:04 JavenJin

@jinwenjie98 what was the raw output from clickhouse that was being parsed? (Probably also worth asking what version of clickhouse servers running too)

Testing it with multiple int types around the same output you've added above it seems to work as expected https://github.com/ChrisMcKee/ClickHouse.Client/blob/82190307b0bddc4d4d2ea37388a730266de880bc/ClickHouse.Client.Tests/ADO/DataReaderTests.cs#L145-L166

ChrisMcKee avatar May 08 '22 20:05 ChrisMcKee

Reproduces with latest ClickHouse in var schema = connection.GetSchema("Columns", new[] { "system" });

DarkWanderer avatar Aug 02 '22 20:08 DarkWanderer

Fixed in 6.3.0, please comment/reopen if reoccurs

DarkWanderer avatar Dec 21 '22 21:12 DarkWanderer