From d3128498b1c248d112affaa7a3aaeda85e38eb52 Mon Sep 17 00:00:00 2001 From: Colin Dellow Date: Sun, 8 Jul 2018 10:37:18 -0400 Subject: [PATCH] Escape column names in CREATE Fixes #33 Add test case with a hyphen and an embedded quotation mark --- parquet-generator/weird-column-names.parquet | Bin 0 -> 593 bytes parquet/parquet_table.cc | 11 ++++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 parquet-generator/weird-column-names.parquet diff --git a/parquet-generator/weird-column-names.parquet b/parquet-generator/weird-column-names.parquet new file mode 100644 index 0000000000000000000000000000000000000000..af44ee28553fe0cfc27045a173acc937ab9e9496 GIT binary patch literal 593 zcmWG=3^EjD5# 0) text += ", "; - text += col->name(); + text += "\""; + // Horrifically inefficient, but easy to understand. + std::string colName = col->name(); + for(char& c : colName) { + if(c == '"') + text += "\"\""; + else + text += c; + } + text += "\""; std::string type;