public void ParseChunk(IResultChunk chunk)
        {
            SFReusableChunk rc = (SFReusableChunk)chunk;

            // parse results row by row
            using (StreamReader sr = new StreamReader(stream))
                using (JsonTextReader jr = new JsonTextReader(sr))
                {
                    while (jr.Read())
                    {
                        switch (jr.TokenType)
                        {
                        case JsonToken.StartArray:
                        case JsonToken.None:
                        case JsonToken.EndArray:
                            break;

                        case JsonToken.Null:
                            rc.AddCell(null);
                            break;

                        case JsonToken.String:
                            rc.AddCell((string)jr.Value);
                            break;

                        default:
                            throw new SnowflakeDbException(SFError.INTERNAL_ERROR, $"Unexpected token type: {jr.TokenType}");
                        }
                    }
                }
        }
        public void ParseChunk(IResultChunk chunk)
        {
            SFReusableChunk rc = (SFReusableChunk)chunk;

            bool inString = false;
            int  c;
            var  input = new FastStreamWrapper(stream);
            var  ms    = new FastMemoryStream();

            while ((c = input.ReadByte()) >= 0)
            {
                if (!inString)
                {
                    // n means null
                    // " quote means begin string
                    // all else are ignored
                    if (c == '"')
                    {
                        inString = true;
                    }
                    else if (c == 'n')
                    {
                        rc.AddCell(null, 0);
                    }
                    // ignore anything else
                }
                else
                {
                    // Inside a string, look for end string
                    // Anything else is saved in the buffer
                    if (c == '"')
                    {
                        rc.AddCell(ms.GetBuffer(), ms.Length);
                        ms.Clear();
                        inString = false;
                    }
                    else if (c == '\\')
                    {
                        // Process next character
                        c = input.ReadByte();
                        switch (c)
                        {
                        case 'n':
                            c = '\n';
                            break;

                        case 'r':
                            c = '\r';
                            break;

                        case 'b':
                            c = '\b';
                            break;

                        case 't':
                            c = '\t';
                            break;

                        case -1:
                            throw new SnowflakeDbException(SFError.INTERNAL_ERROR, $"Unexpected end of stream in escape sequence");
                        }
                        ms.WriteByte((byte)c);
                    }
                    else
                    {
                        ms.WriteByte((byte)c);
                    }
                }
            }
            if (inString)
            {
                throw new SnowflakeDbException(SFError.INTERNAL_ERROR, $"Unexpected end of stream in string");
            }
        }