Skip to content

Commit 298a67d

Browse files
committed
Add more formats
1 parent ba83399 commit 298a67d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseFormat.java

+22
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
public enum ClickHouseFormat {
88
// start with the most common ones
99
RowBinary(true, true, true, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#rowbinary
10+
RowBinaryWithNames(true, true, true, true, true, RowBinary), // https://clickhouse.com/docs/en/interfaces/formats/#rowbinarywithnames
1011
RowBinaryWithNamesAndTypes(true, true, true, true, true, RowBinary), // https://clickhouse.com/docs/en/interfaces/formats/#rowbinarywithnamesandtypes
1112
TabSeparated(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#tabseparated
1213
TabSeparatedRaw(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#tabseparatedraw
14+
TabSeparatedRawWithNames(true, true, false, true, true, TabSeparated), // https://clickhouse.com/docs/en/interfaces/formats/#tabseparatedrawwithnames
15+
TabSeparatedRawWithNamesAndTypes(true, true, false, true, true, TabSeparated), // https://clickhouse.com/docs/en/interfaces/formats/#tabseparatedrawwithnamesandtypes
1316
TabSeparatedWithNames(true, true, false, true, true, TabSeparated), // https://clickhouse.com/docs/en/interfaces/formats/#tabseparatedwithnames
1417
TabSeparatedWithNamesAndTypes(true, true, false, true, true, TabSeparated), // https://clickhouse.com/docs/en/interfaces/formats/#tabseparatedwithnamesandtypes
1518
// and the rest
@@ -23,22 +26,30 @@ public enum ClickHouseFormat {
2326
CustomSeparated(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#customseparated
2427
CustomSeparatedIgnoreSpaces(true, true, false, false, true),
2528
JSONCompactEachRow(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompacteachrow
29+
JSONCompactEachRowWithNames(true, true, false, true, true), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompacteachrowwithnames
2630
JSONCompactEachRowWithNamesAndTypes(true, true, false, true, true), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompacteachrowwithnamesandtypes
2731
JSON(false, true, false, false, false, JSONCompactEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#json
32+
JSONAsObject(true, false, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#jsonasobject
2833
JSONAsString(true, false, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#jsonasstring
2934
JSONCompact(false, true, false, false, false, JSONCompactEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompact
3035
JSONCompactStringsEachRow(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompactstringeachrow
36+
JSONCompactStringsEachRowWithNames(true, true, false, true, true, JSONCompactStringsEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompactstringeachrowwithnames
3137
JSONCompactStringsEachRowWithNamesAndTypes(true, true, false, true, true, JSONCompactStringsEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompactstringeachrowwithnamesandtypes
3238
JSONCompactStrings(false, true, false, false, false, JSONCompactStringsEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsoncompactstrings
3339
JSONEachRow(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#jsoneachrow
3440
JSONEachRowWithProgress(false, true, false, false, true, JSONEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsoneachrowwithprogress
41+
JSONLines(true, true, false, false, true), // alias of JSONEachRow
42+
NDJSON(true, true, true, true, true), // alias of JSONEachRow
3543
JSONStringsEachRow(true, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#jsonstringseachrow
3644
JSONStringsEachRowWithProgress(false, true, false, false, true, JSONStringsEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsonstringseachrowwithprogress
3745
JSONStringEachRow(false, false, false, false, true, JSONStringsEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsoneachrow
3846
JSONStrings(false, true, false, false, false, JSONStringsEachRow), // https://clickhouse.com/docs/en/interfaces/formats/#jsonstring
3947
LineAsString(true, false, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#lineasstring
48+
LineAsStringWithNames(false, true, false, false, true, LineAsString), // https://clickhouse.com/docs/en/interfaces/formats/#lineasstringwithnames
49+
LineAsStringWithNamesAndTypes(false, true, false, false, true, LineAsString), // https://clickhouse.com/docs/en/interfaces/formats/#lineasstringwithnamesandtypes
4050
Markdown(false, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#lineasstring
4151
MsgPack(true, true, true, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#msgpack
52+
MySQLDump(true, false, false, false, true),
4253
MySQLWire(false, true, true, false, false),
4354
Native(true, true, true, true, false), // https://clickhouse.com/docs/en/interfaces/formats/#native
4455
Null(false, true, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#null
@@ -53,13 +64,17 @@ public enum ClickHouseFormat {
5364
PrettyNoEscapes(false, true, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#prettynoescapes
5465
PrettySpace(false, true, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#prettyspace
5566
PrettySpaceNoEscapes(false, true, false, false, false),
67+
Prometheus(false, true, false, false, true), // https://clickhouse.com/docs/en/interfaces/formats/#prometheus
5668
Protobuf(true, true, true, true, false), // https://clickhouse.com/docs/en/interfaces/formats/#protobuf
69+
ProtobufList(true, true, true, true, false), // https://clickhouse.com/docs/en/interfaces/formats/#protobuflist
5770
ProtobufSingle(true, true, true, true, false), // https://clickhouse.com/docs/en/interfaces/formats/#protobufsingle
5871
RawBLOB(true, true, true, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#rawblob
5972
Regexp(true, false, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#regexp
6073
TSKV(true, true, false, false, false), // https://clickhouse.com/docs/en/interfaces/formats/#tskv
6174
TSV(true, true, false, false, true), // alias of TabSeparated
6275
TSVRaw(true, true, false, false, true), // alias of TabSeparatedRaw
76+
TSVRawWithNames(true, true, false, true, true, TSV), // alias of TabSeparatedRawWithNames
77+
TSVRawWithNamesAndTypes(true, true, false, true, true, TSV), // alias of TabSeparatedRawWithNamesAndTypes
6378
TSVWithNames(true, true, false, true, true, TSV), // alias of TabSeparatedWithNames
6479
TSVWithNamesAndTypes(true, true, false, true, true, TSV), // alias of TabSeparatedWithNamesAndTypes
6580
Template(true, true, false, true, true), // https://clickhouse.com/docs/en/interfaces/formats/#template
@@ -109,6 +124,13 @@ public static ClickHouseFormat fromFileName(String file) {
109124
case "parquet":
110125
format = Parquet;
111126
break;
127+
case "pb":
128+
case "proto":
129+
format = Protobuf;
130+
break;
131+
case "sql":
132+
format = MySQLDump;
133+
break;
112134
case "tsv":
113135
format = TSV;
114136
break;

0 commit comments

Comments
 (0)