From 06dc3dd9744c0c08184f7e233ff9f6e2a326b3bf Mon Sep 17 00:00:00 2001 From: Ildar Musin Date: Thu, 8 Jul 2021 17:59:20 +0200 Subject: [PATCH] Use lower case to match column names --- src/reader.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 8ac9366..7f5a8ce 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -199,14 +199,20 @@ void ParquetReader::create_column_mapping(TupleDesc tupleDesc, const std::setname(); auto arrow_type = schema_field.field->type(); - auto arrow_colname = schema_field.field->name(); + char arrow_colname[255]; + + if (field_name.length() > NAMEDATALEN) + throw Error("parquet column name '%s' is too long (max: %d)", + field_name.c_str(), NAMEDATALEN - 1); + tolowercase(schema_field.field->name().c_str(), arrow_colname); /* * Compare postgres attribute name to the column name in arrow * schema. */ - if (strcmp(pg_colname, arrow_colname.c_str()) == 0) + if (strcmp(pg_colname, arrow_colname) == 0) { TypeInfo typinfo(arrow_type); bool error(false);