[feature] Raw as a synonym for TSVRaw

This commit is contained in:
unashi 2024-05-06 15:12:16 +08:00
parent 5139ef7b91
commit d6690f8384
5 changed files with 18 additions and 3 deletions

View File

@ -206,7 +206,7 @@ SELECT * FROM nestedt FORMAT TSV
Differs from `TabSeparated` format in that the rows are written without escaping.
When parsing with this format, tabs or linefeeds are not allowed in each field.
This format is also available under the name `TSVRaw`.
This format is also available under the name `TSVRaw`, `Raw`.
## TabSeparatedWithNames {#tabseparatedwithnames}
@ -241,14 +241,14 @@ This format is also available under the name `TSVWithNamesAndTypes`.
Differs from `TabSeparatedWithNames` format in that the rows are written without escaping.
When parsing with this format, tabs or linefeeds are not allowed in each field.
This format is also available under the name `TSVRawWithNames`.
This format is also available under the name `TSVRawWithNames`, `RawWithNames`.
## TabSeparatedRawWithNamesAndTypes {#tabseparatedrawwithnamesandtypes}
Differs from `TabSeparatedWithNamesAndTypes` format in that the rows are written without escaping.
When parsing with this format, tabs or linefeeds are not allowed in each field.
This format is also available under the name `TSVRawWithNamesAndNames`.
This format is also available under the name `TSVRawWithNamesAndNames`, `RawWithNamesAndNames`.
## Template {#format-template}

View File

@ -402,6 +402,8 @@ void registerInputFormatTabSeparated(FormatFactory & factory)
registerWithNamesAndTypes(is_raw ? "TabSeparatedRaw" : "TabSeparated", register_func);
registerWithNamesAndTypes(is_raw ? "TSVRaw" : "TSV", register_func);
if (is_raw)
registerWithNamesAndTypes("Raw", register_func);
}
}
@ -433,6 +435,8 @@ void registerTSVSchemaReader(FormatFactory & factory)
registerWithNamesAndTypes(is_raw ? "TabSeparatedRaw" : "TabSeparated", register_func);
registerWithNamesAndTypes(is_raw ? "TSVRaw" : "TSV", register_func);
if (is_raw)
registerWithNamesAndTypes("Raw", register_func);
}
}
@ -506,8 +510,12 @@ void registerFileSegmentationEngineTabSeparated(FormatFactory & factory)
registerWithNamesAndTypes(is_raw ? "TSVRaw" : "TSV", register_func);
registerWithNamesAndTypes(is_raw ? "TabSeparatedRaw" : "TabSeparated", register_func);
if (is_raw)
registerWithNamesAndTypes("Raw", register_func);
markFormatWithNamesAndTypesSupportsSamplingColumns(is_raw ? "TSVRaw" : "TSV", factory);
markFormatWithNamesAndTypesSupportsSamplingColumns(is_raw ? "TabSeparatedRaw" : "TabSeparated", factory);
if (is_raw)
markFormatWithNamesAndTypesSupportsSamplingColumns("Raw", factory);
}
// We can use the same segmentation engine for TSKV.

View File

@ -95,7 +95,10 @@ void registerOutputFormatTabSeparated(FormatFactory & factory)
registerWithNamesAndTypes(is_raw ? "TSVRaw" : "TSV", register_func);
registerWithNamesAndTypes(is_raw ? "TabSeparatedRaw" : "TabSeparated", register_func);
if (is_raw)
{
registerWithNamesAndTypes("LineAsString", register_func);
registerWithNamesAndTypes("Raw", register_func);
}
}
}

View File

@ -28,3 +28,6 @@ UInt8 String String
1 hello world
2 hello world
3 hello world
1 hello world
2 hello world
3 hello world

View File

@ -9,3 +9,4 @@ SELECT arrayJoin([1, 2, 3]) AS arr, 'hello' AS s1, 'world' AS s2 FORMAT TSVWithN
SELECT arrayJoin([1, 2, 3]) AS arr, 'hello' AS s1, 'world' AS s2 FORMAT TabSeparatedRaw;
SELECT arrayJoin([1, 2, 3]) AS arr, 'hello' AS s1, 'world' AS s2 FORMAT TSVRaw;
SELECT arrayJoin([1, 2, 3]) AS arr, 'hello' AS s1, 'world' AS s2 FORMAT Raw;