diff --git a/velox/vector/arrow/Bridge.cpp b/velox/vector/arrow/Bridge.cpp index b6148a20f89f..6522ab9f18fc 100644 --- a/velox/vector/arrow/Bridge.cpp +++ b/velox/vector/arrow/Bridge.cpp @@ -248,6 +248,8 @@ const char* exportArrowFormatStr( return "u"; // utf-8 string case TypeKind::VARBINARY: return "z"; // binary + case TypeKind::UNKNOWN: + return "n"; // NullType case TypeKind::TIMESTAMP: return "ttn"; // time64 [nanoseconds] @@ -259,8 +261,6 @@ const char* exportArrowFormatStr( return "+m"; // map case TypeKind::ROW: return "+s"; // struct - case TypeKind::UNKNOWN: - return "n"; default: VELOX_NYI("Unable to map type '{}' to ArrowSchema.", type->kind()); diff --git a/velox/vector/arrow/tests/ArrowBridgeSchemaTest.cpp b/velox/vector/arrow/tests/ArrowBridgeSchemaTest.cpp index d39f378c526b..a880d93f1a97 100644 --- a/velox/vector/arrow/tests/ArrowBridgeSchemaTest.cpp +++ b/velox/vector/arrow/tests/ArrowBridgeSchemaTest.cpp @@ -195,6 +195,8 @@ TEST_F(ArrowBridgeSchemaExportTest, scalar) { testScalarType(DECIMAL(10, 4), "d:10,4"); testScalarType(DECIMAL(20, 15), "d:20,15"); + + testScalarType(UNKNOWN(), "n"); } TEST_F(ArrowBridgeSchemaExportTest, nested) { @@ -238,25 +240,14 @@ TEST_F(ArrowBridgeSchemaExportTest, constant) { testConstant(DOUBLE(), "g"); testConstant(VARCHAR(), "u"); testConstant(DATE(), "tdD"); + testConstant(UNKNOWN(), "n"); testConstant(ARRAY(INTEGER()), "+l"); + testConstant(ARRAY(UNKNOWN()), "+l"); testConstant(MAP(BOOLEAN(), REAL()), "+m"); + testConstant(MAP(UNKNOWN(), REAL()), "+m"); testConstant(ROW({TIMESTAMP(), DOUBLE()}), "+s"); -} - -TEST_F(ArrowBridgeSchemaExportTest, unsupported) { - GTEST_SKIP() << "Skipping it, cause unknown type supported"; - // Try some combination of unsupported types to ensure there's no crash or - // memory leak in failure scenarios. - EXPECT_THROW(testScalarType(UNKNOWN(), ""), VeloxException); - - EXPECT_THROW(testScalarType(ARRAY(UNKNOWN()), ""), VeloxException); - EXPECT_THROW(testScalarType(MAP(UNKNOWN(), INTEGER()), ""), VeloxException); - EXPECT_THROW(testScalarType(MAP(BIGINT(), UNKNOWN()), ""), VeloxException); - - EXPECT_THROW(testScalarType(ROW({BIGINT(), UNKNOWN()}), ""), VeloxException); - EXPECT_THROW( - testScalarType(ROW({BIGINT(), REAL(), UNKNOWN()}), ""), VeloxException); + testConstant(ROW({UNKNOWN(), UNKNOWN()}), "+s"); } class ArrowBridgeSchemaImportTest : public ArrowBridgeSchemaExportTest {