Added CSV (de)serialization

This commit is contained in:
Alexander Tokmakov 2019-04-17 23:15:57 +03:00 committed by Alexander Tokmakov
parent c92a0f3ac5
commit ab9ce18fc7
3 changed files with 11 additions and 0 deletions

View File

@ -94,6 +94,8 @@ ParsedTemplateFormat::ColumnFormat ParsedTemplateFormat::stringToFormat(const St
return ColumnFormat::Escaped;
else if (col_format == "Quoted")
return ColumnFormat::Quoted;
else if (col_format == "CSV")
return ColumnFormat::Csv;
else if (col_format == "JSON")
return ColumnFormat::Json;
else if (col_format == "XML")
@ -119,6 +121,8 @@ String ParsedTemplateFormat::formatToString(ParsedTemplateFormat::ColumnFormat f
return "Escaped";
case ColumnFormat::Quoted:
return "Quoted";
case ColumnFormat::Csv:
return "CSV";
case ColumnFormat::Json:
return "Json";
case ColumnFormat::Xml:
@ -226,6 +230,9 @@ void TemplateBlockOutputStream::serializeField(const IColumn & column, const IDa
case ColumnFormat::Quoted:
type.serializeAsTextQuoted(column, row_num, ostr, settings);
break;
case ColumnFormat::Csv:
type.serializeAsTextCSV(column, row_num, ostr, settings);
break;
case ColumnFormat::Json:
type.serializeAsTextJSON(column, row_num, ostr, settings);
break;

View File

@ -17,6 +17,7 @@ struct ParsedTemplateFormat
Default,
Escaped,
Quoted,
Csv,
Json,
Xml,
Raw

View File

@ -101,6 +101,9 @@ void TemplateRowInputStream::deserializeField(const IDataType & type, IColumn &
case ColumnFormat::Quoted:
type.deserializeAsTextQuoted(column, buf, settings);
break;
case ColumnFormat::Csv:
type.deserializeAsTextCSV(column, buf, settings);
break;
case ColumnFormat::Json:
type.deserializeAsTextJSON(column, buf, settings);
break;