Exemplo n.º 1
0
void DataTypeTuple::deserializeBinary(IColumn & column, ReadBuffer & istr) const
{
    deserializeSafe(elems, column, istr, [&]
    {
        for (const auto & i : ext::range(0, ext::size(elems)))
            elems[i]->deserializeBinary(extractElementColumn(column, i), istr);
    });
}
Exemplo n.º 2
0
void DataTypeTuple::serializeTextCSV(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
{
    for (const auto i : ext::range(0, ext::size(elems)))
    {
        if (i != 0)
            writeChar(',', ostr);
        elems[i]->serializeTextCSV(extractElementColumn(column, i), row_num, ostr);
    }
}
Exemplo n.º 3
0
void DataTypeTuple::serializeTextXML(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
{
    writeCString("<tuple>", ostr);
    for (const auto i : ext::range(0, ext::size(elems)))
    {
        writeCString("<elem>", ostr);
        elems[i]->serializeTextXML(extractElementColumn(column, i), row_num, ostr);
        writeCString("</elem>", ostr);
    }
    writeCString("</tuple>", ostr);
}
Exemplo n.º 4
0
void DataTypeTuple::serializeTextJSON(const IColumn & column, size_t row_num, WriteBuffer & ostr, bool force_quoting_64bit_integers) const
{
    writeChar('[', ostr);
    for (const auto i : ext::range(0, ext::size(elems)))
    {
        if (i != 0)
            writeChar(',', ostr);
        elems[i]->serializeTextJSON(extractElementColumn(column, i), row_num, ostr, force_quoting_64bit_integers);
    }
    writeChar(']', ostr);
}
Exemplo n.º 5
0
static void deserializeSafe(const DataTypes & elems, IColumn & column, ReadBuffer & istr, F && impl)
{
    /// We use the assumption that tuples of zero size do not exist.
    size_t old_size = extractElementColumn(column, 0).size();

    try
    {
        impl();
    }
    catch (...)
    {
        for (const auto & i : ext::range(0, ext::size(elems)))
        {
            auto & element_column = extractElementColumn(column, i);
            if (element_column.size() > old_size)
                element_column.popBack(1);
        }

        throw;
    }
}
Exemplo n.º 6
0
static void deserializeSafe(const DataTypes & elems, IColumn & column, ReadBuffer & istr, F && impl)
{
	/// Используем допущение, что кортежей нулевого размера не бывает.
	size_t old_size = extractElementColumn(column, 0).size();

	try
	{
		impl();
	}
	catch (...)
	{
		for (const auto & i : ext::range(0, ext::size(elems)))
		{
			auto & element_column = extractElementColumn(column, i);
			if (element_column.size() > old_size)
				element_column.popBack(1);
		}

		throw;
	}
}
Exemplo n.º 7
0
void DataTypeTuple::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const char delimiter) const
{
    deserializeSafe(elems, column, istr, [&]
    {
        const size_t size = elems.size();
        for (const auto i : ext::range(0, size))
        {
            if (i != 0)
            {
                skipWhitespaceIfAny(istr);
                assertChar(delimiter, istr);
                skipWhitespaceIfAny(istr);
            }
            elems[i]->deserializeTextCSV(extractElementColumn(column, i), istr, delimiter);
        }
    });
}
Exemplo n.º 8
0
void DataTypeTuple::deserializeTextJSON(IColumn & column, ReadBuffer & istr) const
{
    const size_t size = elems.size();
    assertChar('[', istr);

    deserializeSafe(elems, column, istr, [&]
    {
        for (const auto i : ext::range(0, size))
        {
            skipWhitespaceIfAny(istr);
            if (i != 0)
                assertChar(',', istr);
            elems[i]->deserializeTextJSON(extractElementColumn(column, i), istr);
        }
    });

    skipWhitespaceIfAny(istr);
    assertChar(']', istr);
}
Exemplo n.º 9
0
void DataTypeTuple::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
{
    for (const auto & idx_elem : ext::enumerate(elems))
        idx_elem.second->serializeBinary(extractElementColumn(column, idx_elem.first), row_num, ostr);
}