diff --git a/lib/src/webdb.cc b/lib/src/webdb.cc index 5b7259b1d..88aaa1bb8 100644 --- a/lib/src/webdb.cc +++ b/lib/src/webdb.cc @@ -107,7 +107,8 @@ arrow::Result> WebDB::Connection::MaterializeQuer // Configure the output writer ArrowSchema raw_schema; bool lossless_conversion = webdb_.config_->arrow_lossless_conversion; - ClientProperties options("UTC", ArrowOffsetSize::REGULAR, false, false, lossless_conversion, connection_.context); + ClientProperties options("UTC", ArrowOffsetSize::REGULAR, false, false, lossless_conversion, + ArrowFormatVersion::V1_0, connection_.context); unordered_map> extension_type_cast; options.arrow_offset_size = ArrowOffsetSize::REGULAR; ArrowConverter::ToArrowSchema(&raw_schema, result->types, result->names, options); @@ -144,7 +145,8 @@ arrow::Result> WebDB::Connection::StreamQueryResu // Import the schema ArrowSchema raw_schema; bool lossless_conversion = webdb_.config_->arrow_lossless_conversion; - ClientProperties options("UTC", ArrowOffsetSize::REGULAR, false, false, lossless_conversion, connection_.context); + ClientProperties options("UTC", ArrowOffsetSize::REGULAR, false, false, lossless_conversion, + ArrowFormatVersion::V1_0, connection_.context); options.arrow_offset_size = ArrowOffsetSize::REGULAR; ArrowConverter::ToArrowSchema(&raw_schema, current_query_result_->types, current_query_result_->names, options); ARROW_ASSIGN_OR_RAISE(current_schema_, arrow::ImportSchema(&raw_schema)); @@ -328,7 +330,7 @@ DuckDBWasmResultsWrapper WebDB::Connection::FetchQueryResults() { ArrowArray array; bool lossless_conversion = webdb_.config_->arrow_lossless_conversion; ClientProperties arrow_options("UTC", ArrowOffsetSize::REGULAR, false, false, lossless_conversion, - connection_.context); + ArrowFormatVersion::V1_0, connection_.context); unordered_map> extension_type_cast; arrow_options.arrow_offset_size = ArrowOffsetSize::REGULAR; ArrowConverter::ToArrowArray(*chunk, &array, arrow_options, extension_type_cast); diff --git a/patches/duckdb/revert_arrow_decimal_types.patch b/patches/duckdb/revert_arrow_decimal_types.patch deleted file mode 100644 index 072bb79a9..000000000 --- a/patches/duckdb/revert_arrow_decimal_types.patch +++ /dev/null @@ -1,538 +0,0 @@ -diff --git a/src/common/arrow/arrow_appender.cpp b/src/common/arrow/arrow_appender.cpp -index fd3ae221e3..ee49bdd85c 100644 ---- a/src/common/arrow/arrow_appender.cpp -+++ b/src/common/arrow/arrow_appender.cpp -@@ -215,13 +215,13 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic - case LogicalTypeId::DECIMAL: - switch (type.InternalType()) { - case PhysicalType::INT16: -- InitializeAppenderForType>(append_data); -+ InitializeAppenderForType>(append_data); - break; - case PhysicalType::INT32: -- InitializeAppenderForType>(append_data); -+ InitializeAppenderForType>(append_data); - break; - case PhysicalType::INT64: -- InitializeAppenderForType>(append_data); -+ InitializeAppenderForType>(append_data); - break; - case PhysicalType::INT128: - InitializeAppenderForType>(append_data); -diff --git a/src/common/arrow/arrow_converter.cpp b/src/common/arrow/arrow_converter.cpp -index 38cae380de..5369b3d423 100644 ---- a/src/common/arrow/arrow_converter.cpp -+++ b/src/common/arrow/arrow_converter.cpp -@@ -232,24 +232,9 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co - child.format = "tin"; - break; - case LogicalTypeId::DECIMAL: { -- uint8_t width, scale, bit_width; -- switch (type.InternalType()) { -- case PhysicalType::INT16: -- case PhysicalType::INT32: -- bit_width = 32; -- break; -- case PhysicalType::INT64: -- bit_width = 64; -- break; -- case PhysicalType::INT128: -- bit_width = 128; -- break; -- default: -- throw NotImplementedException("Unsupported internal type For DUCKDB Decimal -> Arrow "); -- } -- -+ uint8_t width, scale; - type.GetDecimalProperties(width, scale); -- string format = "d:" + to_string(width) + "," + to_string(scale) + "," + to_string(bit_width); -+ string format = "d:" + to_string(width) + "," + to_string(scale); - root_holder.owned_type_names.push_back(AddName(format)); - child.format = root_holder.owned_type_names.back().get(); - break; -diff --git a/src/common/enum_util.cpp b/src/common/enum_util.cpp -index 7661e898bf..bbd9150453 100644 ---- a/src/common/enum_util.cpp -+++ b/src/common/enum_util.cpp -@@ -100,7 +100,6 @@ - #include "duckdb/function/partition_stats.hpp" - #include "duckdb/function/scalar/compressed_materialization_utils.hpp" - #include "duckdb/function/scalar/strftime_format.hpp" --#include "duckdb/function/table/arrow/arrow_type_info.hpp" - #include "duckdb/function/table/arrow/enum/arrow_datetime_type.hpp" - #include "duckdb/function/table/arrow/enum/arrow_type_info_type.hpp" - #include "duckdb/function/table/arrow/enum/arrow_variable_size_type.hpp" -@@ -519,20 +518,19 @@ const StringUtil::EnumStringLiteral *GetArrowTypeInfoTypeValues() { - { static_cast(ArrowTypeInfoType::STRUCT), "STRUCT" }, - { static_cast(ArrowTypeInfoType::DATE_TIME), "DATE_TIME" }, - { static_cast(ArrowTypeInfoType::STRING), "STRING" }, -- { static_cast(ArrowTypeInfoType::ARRAY), "ARRAY" }, -- { static_cast(ArrowTypeInfoType::DECIMAL), "DECIMAL" } -+ { static_cast(ArrowTypeInfoType::ARRAY), "ARRAY" } - }; - return values; - } - - template<> - const char* EnumUtil::ToChars(ArrowTypeInfoType value) { -- return StringUtil::EnumToString(GetArrowTypeInfoTypeValues(), 6, "ArrowTypeInfoType", static_cast(value)); -+ return StringUtil::EnumToString(GetArrowTypeInfoTypeValues(), 5, "ArrowTypeInfoType", static_cast(value)); - } - - template<> - ArrowTypeInfoType EnumUtil::FromString(const char *value) { -- return static_cast(StringUtil::StringToEnum(GetArrowTypeInfoTypeValues(), 6, "ArrowTypeInfoType", value)); -+ return static_cast(StringUtil::StringToEnum(GetArrowTypeInfoTypeValues(), 5, "ArrowTypeInfoType", value)); - } - - const StringUtil::EnumStringLiteral *GetArrowVariableSizeTypeValues() { -@@ -1145,26 +1143,6 @@ DebugVectorVerification EnumUtil::FromString(const char - return static_cast(StringUtil::StringToEnum(GetDebugVectorVerificationValues(), 6, "DebugVectorVerification", value)); - } - --const StringUtil::EnumStringLiteral *GetDecimalBitWidthValues() { -- static constexpr StringUtil::EnumStringLiteral values[] { -- { static_cast(DecimalBitWidth::DECIMAL_32), "DECIMAL_32" }, -- { static_cast(DecimalBitWidth::DECIMAL_64), "DECIMAL_64" }, -- { static_cast(DecimalBitWidth::DECIMAL_128), "DECIMAL_128" }, -- { static_cast(DecimalBitWidth::DECIMAL_256), "DECIMAL_256" } -- }; -- return values; --} -- --template<> --const char* EnumUtil::ToChars(DecimalBitWidth value) { -- return StringUtil::EnumToString(GetDecimalBitWidthValues(), 4, "DecimalBitWidth", static_cast(value)); --} -- --template<> --DecimalBitWidth EnumUtil::FromString(const char *value) { -- return static_cast(StringUtil::StringToEnum(GetDecimalBitWidthValues(), 4, "DecimalBitWidth", value)); --} -- - const StringUtil::EnumStringLiteral *GetDefaultOrderByNullTypeValues() { - static constexpr StringUtil::EnumStringLiteral values[] { - { static_cast(DefaultOrderByNullType::INVALID), "INVALID" }, -diff --git a/src/function/table/arrow.cpp b/src/function/table/arrow.cpp -index 8774ccff42..9d9fd22966 100644 ---- a/src/function/table/arrow.cpp -+++ b/src/function/table/arrow.cpp -@@ -241,8 +241,6 @@ bool ArrowTableFunction::ArrowPushdownType(const LogicalType &type) { - case PhysicalType::INT16: - case PhysicalType::INT32: - case PhysicalType::INT64: -- return false; -- case PhysicalType::INT128: - return true; - default: - return false; -diff --git a/src/function/table/arrow/arrow_duck_schema.cpp b/src/function/table/arrow/arrow_duck_schema.cpp -index e518f62f40..964f9d4a5e 100644 ---- a/src/function/table/arrow/arrow_duck_schema.cpp -+++ b/src/function/table/arrow/arrow_duck_schema.cpp -@@ -105,22 +105,7 @@ unique_ptr ArrowType::GetTypeFromFormat(string &format) { - if (width > 38 || bitwidth > 128) { - throw NotImplementedException("Unsupported Internal Arrow Type for Decimal %s", format); - } -- switch (bitwidth) { -- case 32: -- return make_uniq(LogicalType::DECIMAL(NumericCast(width), NumericCast(scale)), -- make_uniq(DecimalBitWidth::DECIMAL_32)); -- case 64: -- return make_uniq(LogicalType::DECIMAL(NumericCast(width), NumericCast(scale)), -- make_uniq(DecimalBitWidth::DECIMAL_64)); -- case 128: -- return make_uniq(LogicalType::DECIMAL(NumericCast(width), NumericCast(scale)), -- make_uniq(DecimalBitWidth::DECIMAL_128)); -- case 256: -- return make_uniq(LogicalType::DECIMAL(NumericCast(width), NumericCast(scale)), -- make_uniq(DecimalBitWidth::DECIMAL_256)); -- default: -- throw NotImplementedException("Unsupported bit-width value of %d for Arrow Decimal type", bitwidth); -- } -+ return make_uniq(LogicalType::DECIMAL(NumericCast(width), NumericCast(scale))); - } else if (format == "u") { - return make_uniq(LogicalType::VARCHAR, make_uniq(ArrowVariableSizeType::NORMAL)); - } else if (format == "U") { -diff --git a/src/function/table/arrow/arrow_type_info.cpp b/src/function/table/arrow/arrow_type_info.cpp -index 8552ac297d..ed9c454494 100644 ---- a/src/function/table/arrow/arrow_type_info.cpp -+++ b/src/function/table/arrow/arrow_type_info.cpp -@@ -52,21 +52,6 @@ ArrowDateTimeType ArrowDateTimeInfo::GetDateTimeType() const { - return size_type; - } - --//===--------------------------------------------------------------------===// --// ArrowDecimalInfo --//===--------------------------------------------------------------------===// -- --ArrowDecimalInfo::ArrowDecimalInfo(DecimalBitWidth bit_width) -- : ArrowTypeInfo(ArrowTypeInfoType::DECIMAL), bit_width(bit_width) { --} -- --ArrowDecimalInfo::~ArrowDecimalInfo() { --} -- --DecimalBitWidth ArrowDecimalInfo::GetBitWidth() const { -- return bit_width; --} -- - //===--------------------------------------------------------------------===// - // ArrowStringInfo - //===--------------------------------------------------------------------===// -diff --git a/src/function/table/arrow_conversion.cpp b/src/function/table/arrow_conversion.cpp -index 73a19ca8a1..3ba7d2b059 100644 ---- a/src/function/table/arrow_conversion.cpp -+++ b/src/function/table/arrow_conversion.cpp -@@ -1,5 +1,3 @@ --#include "duckdb/common/operator/cast_operators.hpp" -- - #include "duckdb/common/exception/conversion_exception.hpp" - #include "duckdb/common/limits.hpp" - #include "duckdb/common/operator/multiply.hpp" -@@ -765,83 +763,6 @@ static void ColumnArrowToDuckDBRunEndEncoded(Vector &vector, const ArrowArray &a - throw NotImplementedException("Type '%s' not implemented for RunEndEncoding", TypeIdToString(physical_type)); - } - } --template --void ConvertDecimal(SRC src_ptr, Vector &vector, ArrowArray &array, idx_t size, int64_t nested_offset, -- uint64_t parent_offset, ArrowScanLocalState &scan_state, ValidityMask &val_mask, -- DecimalBitWidth arrow_bit_width) { -- -- switch (vector.GetType().InternalType()) { -- case PhysicalType::INT16: { -- auto tgt_ptr = FlatVector::GetData(vector); -- for (idx_t row = 0; row < size; row++) { -- if (val_mask.RowIsValid(row)) { -- auto result = TryCast::Operation(src_ptr[row], tgt_ptr[row]); -- D_ASSERT(result); -- (void)result; -- } -- } -- break; -- } -- case PhysicalType::INT32: { -- if (arrow_bit_width == DecimalBitWidth::DECIMAL_32) { -- FlatVector::SetData(vector, ArrowBufferData(array, 1) + -- GetTypeIdSize(vector.GetType().InternalType()) * -- GetEffectiveOffset(array, NumericCast(parent_offset), -- scan_state, nested_offset)); -- } else { -- auto tgt_ptr = FlatVector::GetData(vector); -- for (idx_t row = 0; row < size; row++) { -- if (val_mask.RowIsValid(row)) { -- auto result = TryCast::Operation(src_ptr[row], tgt_ptr[row]); -- D_ASSERT(result); -- (void)result; -- } -- } -- } -- break; -- } -- case PhysicalType::INT64: { -- if (arrow_bit_width == DecimalBitWidth::DECIMAL_64) { -- FlatVector::SetData(vector, ArrowBufferData(array, 1) + -- GetTypeIdSize(vector.GetType().InternalType()) * -- GetEffectiveOffset(array, NumericCast(parent_offset), -- scan_state, nested_offset)); -- } else { -- auto tgt_ptr = FlatVector::GetData(vector); -- for (idx_t row = 0; row < size; row++) { -- if (val_mask.RowIsValid(row)) { -- auto result = TryCast::Operation(src_ptr[row], tgt_ptr[row]); -- D_ASSERT(result); -- (void)result; -- } -- } -- } -- break; -- } -- case PhysicalType::INT128: { -- if (arrow_bit_width == DecimalBitWidth::DECIMAL_128) { -- FlatVector::SetData(vector, ArrowBufferData(array, 1) + -- GetTypeIdSize(vector.GetType().InternalType()) * -- GetEffectiveOffset(array, NumericCast(parent_offset), -- scan_state, nested_offset)); -- } else { -- auto tgt_ptr = FlatVector::GetData(vector); -- for (idx_t row = 0; row < size; row++) { -- if (val_mask.RowIsValid(row)) { -- auto result = TryCast::Operation(src_ptr[row], tgt_ptr[row]); -- D_ASSERT(result); -- (void)result; -- } -- } -- } -- -- break; -- } -- default: -- throw NotImplementedException("Unsupported physical type for Decimal: %s", -- TypeIdToString(vector.GetType().InternalType())); -- } --} - - static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowArrayScanState &array_state, idx_t size, - const ArrowType &arrow_type, int64_t nested_offset, ValidityMask *parent_mask, -@@ -1077,32 +998,53 @@ static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowArraySca - } - case LogicalTypeId::DECIMAL: { - auto val_mask = FlatVector::Validity(vector); -- auto &datetime_info = arrow_type.GetTypeInfo(); -- auto bit_width = datetime_info.GetBitWidth(); -- -- switch (bit_width) { -- case DecimalBitWidth::DECIMAL_32: { -- auto src_ptr = ArrowBufferData(array, 1) + -- GetEffectiveOffset(array, NumericCast(parent_offset), scan_state, nested_offset); -- ConvertDecimal(src_ptr, vector, array, size, nested_offset, parent_offset, scan_state, val_mask, bit_width); -+ //! We have to convert from INT128 -+ auto src_ptr = ArrowBufferData(array, 1) + -+ GetEffectiveOffset(array, NumericCast(parent_offset), scan_state, nested_offset); -+ switch (vector.GetType().InternalType()) { -+ case PhysicalType::INT16: { -+ auto tgt_ptr = FlatVector::GetData(vector); -+ for (idx_t row = 0; row < size; row++) { -+ if (val_mask.RowIsValid(row)) { -+ auto result = Hugeint::TryCast(src_ptr[row], tgt_ptr[row]); -+ D_ASSERT(result); -+ (void)result; -+ } -+ } - break; - } -- -- case DecimalBitWidth::DECIMAL_64: { -- auto src_ptr = ArrowBufferData(array, 1) + -- GetEffectiveOffset(array, NumericCast(parent_offset), scan_state, nested_offset); -- ConvertDecimal(src_ptr, vector, array, size, nested_offset, parent_offset, scan_state, val_mask, bit_width); -+ case PhysicalType::INT32: { -+ auto tgt_ptr = FlatVector::GetData(vector); -+ for (idx_t row = 0; row < size; row++) { -+ if (val_mask.RowIsValid(row)) { -+ auto result = Hugeint::TryCast(src_ptr[row], tgt_ptr[row]); -+ D_ASSERT(result); -+ (void)result; -+ } -+ } - break; - } -- -- case DecimalBitWidth::DECIMAL_128: { -- auto src_ptr = ArrowBufferData(array, 1) + -- GetEffectiveOffset(array, NumericCast(parent_offset), scan_state, nested_offset); -- ConvertDecimal(src_ptr, vector, array, size, nested_offset, parent_offset, scan_state, val_mask, bit_width); -+ case PhysicalType::INT64: { -+ auto tgt_ptr = FlatVector::GetData(vector); -+ for (idx_t row = 0; row < size; row++) { -+ if (val_mask.RowIsValid(row)) { -+ auto result = Hugeint::TryCast(src_ptr[row], tgt_ptr[row]); -+ D_ASSERT(result); -+ (void)result; -+ } -+ } -+ break; -+ } -+ case PhysicalType::INT128: { -+ FlatVector::SetData(vector, ArrowBufferData(array, 1) + -+ GetTypeIdSize(vector.GetType().InternalType()) * -+ GetEffectiveOffset(array, NumericCast(parent_offset), -+ scan_state, nested_offset)); - break; - } - default: -- throw NotImplementedException("Unsupported precision for Arrow Decimal Type."); -+ throw NotImplementedException("Unsupported physical type for Decimal: %s", -+ TypeIdToString(vector.GetType().InternalType())); - } - break; - } -diff --git a/src/include/duckdb/common/enum_util.hpp b/src/include/duckdb/common/enum_util.hpp -index 39a652962e..935102ef66 100644 ---- a/src/include/duckdb/common/enum_util.hpp -+++ b/src/include/duckdb/common/enum_util.hpp -@@ -126,8 +126,6 @@ enum class DebugInitialize : uint8_t; - - enum class DebugVectorVerification : uint8_t; - --enum class DecimalBitWidth : uint8_t; -- - enum class DefaultOrderByNullType : uint8_t; - - enum class DependencyEntryType : uint8_t; -@@ -546,9 +544,6 @@ const char* EnumUtil::ToChars(DebugInitialize value); - template<> - const char* EnumUtil::ToChars(DebugVectorVerification value); - --template<> --const char* EnumUtil::ToChars(DecimalBitWidth value); -- - template<> - const char* EnumUtil::ToChars(DefaultOrderByNullType value); - -@@ -1105,9 +1100,6 @@ DebugInitialize EnumUtil::FromString(const char *value); - template<> - DebugVectorVerification EnumUtil::FromString(const char *value); - --template<> --DecimalBitWidth EnumUtil::FromString(const char *value); -- - template<> - DefaultOrderByNullType EnumUtil::FromString(const char *value); - -diff --git a/src/include/duckdb/function/table/arrow/arrow_type_info.hpp b/src/include/duckdb/function/table/arrow/arrow_type_info.hpp -index d2e419646c..15e1aa3fce 100644 ---- a/src/include/duckdb/function/table/arrow/arrow_type_info.hpp -+++ b/src/include/duckdb/function/table/arrow/arrow_type_info.hpp -@@ -84,23 +84,6 @@ private: - ArrowDateTimeType size_type; - }; - --enum class DecimalBitWidth : uint8_t { DECIMAL_32, DECIMAL_64, DECIMAL_128, DECIMAL_256 }; -- --struct ArrowDecimalInfo final : public ArrowTypeInfo { --public: -- static constexpr const ArrowTypeInfoType TYPE = ArrowTypeInfoType::DECIMAL; -- --public: -- explicit ArrowDecimalInfo(DecimalBitWidth bit_width); -- ~ArrowDecimalInfo() override; -- --public: -- DecimalBitWidth GetBitWidth() const; -- --private: -- DecimalBitWidth bit_width; --}; -- - struct ArrowStringInfo : public ArrowTypeInfo { - public: - static constexpr const ArrowTypeInfoType TYPE = ArrowTypeInfoType::STRING; -diff --git a/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp b/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp -index 8a345b8c83..52b826c33a 100644 ---- a/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp -+++ b/src/include/duckdb/function/table/arrow/enum/arrow_type_info_type.hpp -@@ -4,6 +4,6 @@ - - namespace duckdb { - --enum class ArrowTypeInfoType : uint8_t { LIST, STRUCT, DATE_TIME, STRING, ARRAY, DECIMAL }; -+enum class ArrowTypeInfoType : uint8_t { LIST, STRUCT, DATE_TIME, STRING, ARRAY }; - - } // namespace duckdb -diff --git a/tools/pythonpkg/src/arrow/arrow_array_stream.cpp b/tools/pythonpkg/src/arrow/arrow_array_stream.cpp -index c8e8cc0911..cee4f0b102 100644 ---- a/tools/pythonpkg/src/arrow/arrow_array_stream.cpp -+++ b/tools/pythonpkg/src/arrow/arrow_array_stream.cpp -@@ -282,23 +282,7 @@ py::object GetScalar(Value &constant, const string &timezone_config, const Arrow - case LogicalTypeId::BLOB: - return dataset_scalar(py::bytes(constant.GetValueUnsafe())); - case LogicalTypeId::DECIMAL: { -- py::object decimal_type; -- auto &datetime_info = type.GetTypeInfo(); -- auto bit_width = datetime_info.GetBitWidth(); -- switch (bit_width) { -- case DecimalBitWidth::DECIMAL_32: -- decimal_type = py::module_::import("pyarrow").attr("decimal32"); -- break; -- case DecimalBitWidth::DECIMAL_64: -- decimal_type = py::module_::import("pyarrow").attr("decimal64"); -- break; -- case DecimalBitWidth::DECIMAL_128: -- decimal_type = py::module_::import("pyarrow").attr("decimal128"); -- break; -- default: -- throw NotImplementedException("Unsupported precision for Arrow Decimal Type."); -- } -- -+ py::object decimal_type = py::module_::import("pyarrow").attr("decimal128"); - uint8_t width; - uint8_t scale; - constant.type().GetDecimalProperties(width, scale); -diff --git a/tools/pythonpkg/tests/fast/arrow/test_arrow_decimal_32_64.py b/tools/pythonpkg/tests/fast/arrow/test_arrow_decimal_32_64.py -deleted file mode 100644 -index b216ad0875..0000000000 ---- a/tools/pythonpkg/tests/fast/arrow/test_arrow_decimal_32_64.py -+++ /dev/null -@@ -1,64 +0,0 @@ --import duckdb --import pytest --from decimal import Decimal -- --pa = pytest.importorskip("pyarrow") -- -- --class TestArrowDecimalTypes(object): -- def test_decimal_32(self, duckdb_cursor): -- duckdb_cursor = duckdb.connect() -- decimal_32 = pa.Table.from_pylist( -- [ -- {"data": Decimal("100.20")}, -- {"data": Decimal("110.21")}, -- {"data": Decimal("31.20")}, -- {"data": Decimal("500.20")}, -- ], -- pa.schema([("data", pa.decimal32(5, 2))]), -- ) -- # Test scan -- assert duckdb_cursor.execute("FROM decimal_32").fetchall() == [ -- (Decimal('100.20'),), -- (Decimal('110.21'),), -- (Decimal('31.20'),), -- (Decimal('500.20'),), -- ] -- # Test filter pushdown -- assert duckdb_cursor.execute("SELECT COUNT(*) FROM decimal_32 where data > 100 and data < 200 ").fetchall() == [ -- (2,) -- ] -- -- # Test write -- arrow_table = duckdb_cursor.execute("FROM decimal_32").arrow() -- -- assert arrow_table.equals(decimal_32) -- -- def test_decimal_64(self, duckdb_cursor): -- duckdb_cursor = duckdb.connect() -- decimal_64 = pa.Table.from_pylist( -- [ -- {"data": Decimal("1000.231")}, -- {"data": Decimal("1100.231")}, -- {"data": Decimal("999999999999.231")}, -- {"data": Decimal("500.20")}, -- ], -- pa.schema([("data", pa.decimal64(16, 3))]), -- ) -- -- # Test scan -- assert duckdb_cursor.execute("FROM decimal_64").fetchall() == [ -- (Decimal('1000.231'),), -- (Decimal('1100.231'),), -- (Decimal('999999999999.231'),), -- (Decimal('500.200'),), -- ] -- -- # Test Filter pushdown -- assert duckdb_cursor.execute( -- "SELECT COUNT(*) FROM decimal_64 WHERE data > 1000 and data < 1200" -- ).fetchall() == [(2,)] -- -- # Test write -- arrow_table = duckdb_cursor.execute("FROM decimal_64").arrow() -- assert arrow_table.equals(decimal_64) -diff --git a/tools/pythonpkg/tests/fast/arrow/test_arrow_run_end_encoding.py b/tools/pythonpkg/tests/fast/arrow/test_arrow_run_end_encoding.py -index 4fed04ac24..fa27167458 100644 ---- a/tools/pythonpkg/tests/fast/arrow/test_arrow_run_end_encoding.py -+++ b/tools/pythonpkg/tests/fast/arrow/test_arrow_run_end_encoding.py -@@ -91,9 +91,9 @@ class TestArrowREE(object): - ('TIMESTAMP', "'1992-03-22 01:02:03'", "'2022-11-07 08:43:04.123456'"), - ('TIMESTAMP_MS', "'1992-03-22 01:02:03'", "'2022-11-07 08:43:04.123456'"), - ('TIMESTAMP_NS', "'1992-03-22 01:02:03'", "'2022-11-07 08:43:04.123456'"), -- # ('DECIMAL(4,2)', "'12.23'", "'99.99'"), REE not supported for decimal32 -- # ('DECIMAL(7,6)', "'1.234234'", "'0.000001'"), REE not supported for decimal32 -- # ('DECIMAL(14,7)', "'134523.234234'", "'999999.000001'"), REE not supported for decimal64 -+ ('DECIMAL(4,2)', "'12.23'", "'99.99'"), -+ ('DECIMAL(7,6)', "'1.234234'", "'0.000001'"), -+ ('DECIMAL(14,7)', "'134523.234234'", "'999999.000001'"), - ('DECIMAL(28,1)', "'12345678910111234123456789.1'", "'999999999999999999999999999.9'"), - ('UUID', "'10acd298-15d7-417c-8b59-eabb5a2bacab'", "'eeccb8c5-9943-b2bb-bb5e-222f4e14b687'"), - ('BIT', "'01010101010000'", "'01010100010101010101010101111111111'"), diff --git a/submodules/duckdb b/submodules/duckdb index 71c5c07cd..2063dda3e 160000 --- a/submodules/duckdb +++ b/submodules/duckdb @@ -1 +1 @@ -Subproject commit 71c5c07cdd295e9409c0505885033ae9eb6b5ddd +Subproject commit 2063dda3e6bd955c364ce8e61939c6248a907be6