From 74ea92461874f65cbb0012f4935c36cf03d35953 Mon Sep 17 00:00:00 2001 From: Sal Date: Wed, 13 Mar 2024 20:49:53 -0400 Subject: [PATCH] fix get sql create table script for byte array types --- src/ParquetViewer/Helpers/CustomScriptBasedSchemaAdapter.cs | 6 ++++-- src/ParquetViewer/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ParquetViewer/Helpers/CustomScriptBasedSchemaAdapter.cs b/src/ParquetViewer/Helpers/CustomScriptBasedSchemaAdapter.cs index e1b5005..8661337 100644 --- a/src/ParquetViewer/Helpers/CustomScriptBasedSchemaAdapter.cs +++ b/src/ParquetViewer/Helpers/CustomScriptBasedSchemaAdapter.cs @@ -15,7 +15,7 @@ public class CustomScriptBasedSchemaAdapter static CustomScriptBasedSchemaAdapter() { - Hashtable hashtable = new Hashtable + Hashtable hashtable = new { { typeof(ulong), "BIGINT {1}NULL" }, { typeof(long), "BIGINT {1}NULL" }, @@ -38,6 +38,7 @@ static CustomScriptBasedSchemaAdapter() { typeof(ListValue), "sql_variant {1}NULL /*LIST*/" }, { typeof(MapValue), "sql_variant {1}NULL /*MAP*/" }, { typeof(StructValue), "sql_variant {1}NULL /*STRUCT*/" }, + { typeof(ByteArrayValue), "VARBINARY({0}) {1}NULL" }, }; TypeMap = hashtable; } @@ -102,7 +103,8 @@ protected string GetTypeFor(DataColumn column) { throw new NotSupportedException(string.Format("No type mapping is provided for {0}", column.DataType.Name)); } - return string.Format(item, column.DataType == typeof(string) ? "MAX" : column.MaxLength.ToString(), column.AllowDBNull ? string.Empty : "NOT "); + bool useMaxKeyword = column.DataType == typeof(string) || column.DataType == typeof(ByteArrayValue); + return string.Format(item, useMaxKeyword ? "MAX" : column.MaxLength.ToString(), column.AllowDBNull ? string.Empty : "NOT "); } private string MakeList(DataColumn[] columns) diff --git a/src/ParquetViewer/Properties/AssemblyInfo.cs b/src/ParquetViewer/Properties/AssemblyInfo.cs index dc2deea..98df7e0 100644 --- a/src/ParquetViewer/Properties/AssemblyInfo.cs +++ b/src/ParquetViewer/Properties/AssemblyInfo.cs @@ -36,4 +36,4 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.10.1.0")] +[assembly: AssemblyVersion("2.10.1.1")]