From 687a02833929cf58d1c5c0092df825ce68712721 Mon Sep 17 00:00:00 2001 From: Pedro Eugenio Rocha Pedreira Date: Tue, 22 Oct 2024 20:17:36 -0700 Subject: [PATCH] fix: HiveColumnHandle serialization of special columns (#11172) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/11172 Fix missing serialization string name for kRowIndex Reviewed By: xiaoxmeng, hongtaoy Differential Revision: D63876868 fbshipit-source-id: 1cc9fb5e8cd2ff69b3c30851960ca16e40807a3e --- velox/connectors/hive/TableHandle.cpp | 3 +- .../hive/tests/HiveConnectorSerDeTest.cpp | 37 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/velox/connectors/hive/TableHandle.cpp b/velox/connectors/hive/TableHandle.cpp index 85af047d6e92..a96b5e2e59b6 100644 --- a/velox/connectors/hive/TableHandle.cpp +++ b/velox/connectors/hive/TableHandle.cpp @@ -25,7 +25,8 @@ columnTypeNames() { {HiveColumnHandle::ColumnType::kPartitionKey, "PartitionKey"}, {HiveColumnHandle::ColumnType::kRegular, "Regular"}, {HiveColumnHandle::ColumnType::kSynthesized, "Synthesized"}, - {HiveColumnHandle::ColumnType::kRowIndex, "RowIndex"}}; + {HiveColumnHandle::ColumnType::kRowIndex, "RowIndex"}, + }; } template diff --git a/velox/connectors/hive/tests/HiveConnectorSerDeTest.cpp b/velox/connectors/hive/tests/HiveConnectorSerDeTest.cpp index f44bf9348fe4..ab65b9099556 100644 --- a/velox/connectors/hive/tests/HiveConnectorSerDeTest.cpp +++ b/velox/connectors/hive/tests/HiveConnectorSerDeTest.cpp @@ -129,15 +129,34 @@ TEST_F(HiveConnectorSerDeTest, hiveTableHandle) { } TEST_F(HiveConnectorSerDeTest, hiveColumnHandle) { - auto columnType = ROW( - {{"c0c0", BIGINT()}, - {"c0c1", - ARRAY(MAP( - VARCHAR(), ROW({{"c0c1c0", BIGINT()}, {"c0c1c1", BIGINT()}})))}}); - auto columnHandle = exec::test::HiveConnectorTestBase::makeColumnHandle( - "columnHandle", columnType, {"c0.c0c1[3][\"foo\"].c0c1c0"}); - - testSerde(*columnHandle); + auto columnType = ROW({ + {"c0c0", BIGINT()}, + {"c0c1", + ARRAY( + MAP(VARCHAR(), + ROW({ + {"c0c1c0", BIGINT()}, + {"c0c1c1", BIGINT()}, + })))}, + }); + + auto columnHandleTypes = { + HiveColumnHandle::ColumnType::kPartitionKey, + HiveColumnHandle::ColumnType::kRegular, + HiveColumnHandle::ColumnType::kSynthesized, + HiveColumnHandle::ColumnType::kRowIndex, + }; + + for (auto columnHandleType : columnHandleTypes) { + auto columnHandle = exec::test::HiveConnectorTestBase::makeColumnHandle( + "columnHandle", + columnType, + columnType, + {"c0.c0c1[3][\"foo\"].c0c1c0"}, + columnHandleType); + + testSerde(*columnHandle); + } } TEST_F(HiveConnectorSerDeTest, locationHandle) {