LOAD 'chdb_hook'; /****************************************************************************/ -- Strings. CREATE TABLE strings ( t TEXT NOT NULL, ba BYTEA NOT NULL, n NAME NULL ); INSERT INTO strings VALUES ('', '', '') , (' ', ' ', NULL) , ('hi', '\xdeadbeef', 'yo') , ('πŸ˜ƒ 🐨 🎱', '\x83c2815f9018eb2d4c26dac9d69c4c93ddc7a284', 'big fat name') , ('"BΓΈwie"', '\x9a60f295bcb186a729d04e76377b7f122b2a1dd9', '"ALL CAPS"') ; -- Execute round-trip to all supported formats. JSON, JSONCompact and -- JSONColumnsWithMetadata always validate UTF-8, whatever -- output_format_json_validate_utf8 says, so the bytea columns come back with -- replacement characters. Protobuf reads a Nullable field holding the empty -- string back as NULL, so the empty name does not survive: -- https://github.com/chdb-io/chdb-core/issues/152 CREATE TABLE strings2 (LIKE strings INCLUDING ALL); \set from_table strings \set to_table strings2 \set output_file strings.tmp \i test/utils/round-trip-formats.sql \set ECHO errors t: TabSeparated t: TabSeparatedRaw t: TabSeparatedWithNames t: TabSeparatedWithNamesAndTypes t: TabSeparatedRawWithNames t: TabSeparatedRawWithNamesAndTypes t: CSV t: CSVWithNames t: CSVWithNamesAndTypes t: CustomSeparated t: CustomSeparatedWithNames t: CustomSeparatedWithNamesAndTypes t: Values f: JSON t: JSONColumns f: JSONColumnsWithMetadata f: JSONCompact t: JSONCompactColumns t: JSONEachRow t: JSONStringsEachRow t: JSONCompactEachRow t: JSONCompactStringsEachRow t: JSONCompactEachRowWithNames t: JSONCompactEachRowWithNamesAndTypes t: JSONCompactStringsEachRowWithNames t: JSONCompactStringsEachRowWithNamesAndTypes t: JSONObjectEachRow t: TSKV t: Native t: RowBinary t: RowBinaryWithNames t: RowBinaryWithNamesAndTypes t: Parquet t: Arrow t: ArrowStream t: ORC t: Avro f: Protobuf f: ProtobufList t: MsgPack t: BSONEachRow /****************************************************************************/ -- String Arrays. CREATE TABLE string_arrays ( t TEXT[] NOT NULL, ba BYTEA[] NOT NULL, n NAME[] NOT NULL ); INSERT INTO string_arrays VALUES ('{}', '{}', '{}') , ('{hi}', '{\xdeadbeef}', '{yo}') , ('{hi, NULL}', '{NULL, \xdeadbeef}', '{NULL}') , ('{πŸ˜ƒ 🐨 🎱,"\"GO\""}', '{\xdeadbeef, \x83c2815f9018eb2d4c26dac9d69c4c93ddc7a284}', '{big fat name,NULL}') ; -- Execute round-trip to all supported formats. Protobuf has no null in a -- repeated field, so the arrays carrying one come back short. CREATE TABLE string_arrays2 (LIKE string_arrays INCLUDING ALL); \set from_table string_arrays \set to_table string_arrays2 \i test/utils/round-trip-formats.sql \set ECHO errors t: TabSeparated t: TabSeparatedRaw t: TabSeparatedWithNames t: TabSeparatedWithNamesAndTypes t: TabSeparatedRawWithNames t: TabSeparatedRawWithNamesAndTypes t: CSV t: CSVWithNames t: CSVWithNamesAndTypes t: CustomSeparated t: CustomSeparatedWithNames t: CustomSeparatedWithNamesAndTypes t: Values t: JSON t: JSONColumns t: JSONColumnsWithMetadata t: JSONCompact t: JSONCompactColumns t: JSONEachRow t: JSONStringsEachRow t: JSONCompactEachRow t: JSONCompactStringsEachRow t: JSONCompactEachRowWithNames t: JSONCompactEachRowWithNamesAndTypes t: JSONCompactStringsEachRowWithNames t: JSONCompactStringsEachRowWithNamesAndTypes t: JSONObjectEachRow t: TSKV t: Native t: RowBinary t: RowBinaryWithNames t: RowBinaryWithNamesAndTypes t: Parquet t: Arrow t: ArrowStream t: ORC t: Avro f: Protobuf f: ProtobufList t: MsgPack t: BSONEachRow \set ECHO errors