Skip to content

Commit

Permalink
fix get sql create table script for byte array types
Browse files Browse the repository at this point in the history
  • Loading branch information
mukunku committed Mar 14, 2024
1 parent bd8cccf commit 74ea924
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/ParquetViewer/Helpers/CustomScriptBasedSchemaAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/ParquetViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit 74ea924

Please sign in to comment.