This is an automated email from the ASF dual-hosted git repository.
curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new b29e4a96 fix(csharp/src/Client/SchemaConverter): add check for keys on
precision and scale (#1566)
b29e4a96 is described below
commit b29e4a96c02ccd8e40c63fcbd32b39e12906ea2a
Author: davidhcoe <[email protected]>
AuthorDate: Mon Feb 26 18:17:27 2024 -0500
fix(csharp/src/Client/SchemaConverter): add check for keys on precision and
scale (#1566)
fixes https://github.com/apache/arrow-adbc/issues/1565
Co-authored-by: David Coe <[email protected]>
---
csharp/src/Client/SchemaConverter.cs | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/csharp/src/Client/SchemaConverter.cs
b/csharp/src/Client/SchemaConverter.cs
index 38863417..cc71f499 100644
--- a/csharp/src/Client/SchemaConverter.cs
+++ b/csharp/src/Client/SchemaConverter.cs
@@ -70,8 +70,17 @@ namespace Apache.Arrow.Adbc.Client
f.HasMetadata
)
{
- row[SchemaTableColumn.NumericPrecision] =
Convert.ToInt32(f.Metadata["precision"]);
- row[SchemaTableColumn.NumericScale] =
Convert.ToInt32(f.Metadata["scale"]);
+ if (f.Metadata.TryGetValue("precision", out string
precisionKey))
+ {
+ if(!string.IsNullOrEmpty(precisionKey))
+ row[SchemaTableColumn.NumericPrecision] =
Convert.ToInt32(f.Metadata[precisionKey]);
+ }
+
+ if(f.Metadata.TryGetValue("scale", out string scaleKey))
+ {
+ if(!string.IsNullOrEmpty(scaleKey))
+ row[SchemaTableColumn.NumericScale] =
Convert.ToInt32(f.Metadata[scaleKey]);
+ }
}
else if (f.DataType is Decimal128Type decimal128Type)
{