Skip to content

Commit

Permalink
Fix issue #509
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Otykier committed Jun 29, 2020
1 parent 48cff89 commit 818d7e0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion TabularEditor/UIServices/TableMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TabularEditor.TOMWrapper;
using TabularEditor.UI.Dialogs;

Expand Down Expand Up @@ -116,6 +117,7 @@ public static List<MetadataChange> CheckPartitionsIdentical(Table table)
{
return null;
}
var ignoredColumns = new HashSet<string>();
var sourceSchema = new Dictionary<string, DataTypeMapping>(StringComparer.InvariantCultureIgnoreCase);
foreach (DataRow row in schemaTable.Rows)
{
Expand All @@ -125,8 +127,20 @@ public static List<MetadataChange> CheckPartitionsIdentical(Table table)
row["DataTypeName"].ToString() :
(row["DataType"] as Type).Name;
var mappedType = DataTypeMap(dataType);
if (sourceSchema.ContainsKey(colName))
{
ignoredColumns.Add(colName);
}
else
sourceSchema.Add(colName, new DataTypeMapping(dataType, mappedType));
}

sourceSchema.Add(colName, new DataTypeMapping(dataType, mappedType));
if(ignoredColumns.Count > 0)
{
var plural = ignoredColumns.Count > 1 ? "s" : "";
var columns = string.Join("", ignoredColumns.Select(c => "\r\n\t" + c).ToArray());
var partitionInfo = partition.Table.Partitions.Count > 1 ? $", partition \"{partition.Name}\"" : "";
MessageBox.Show($"The query on table '{partition.Table.Name}'{partitionInfo} specified the following column{plural} more than once:\r\n{columns}", "Repeated columns", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

return sourceSchema;
Expand Down

0 comments on commit 818d7e0

Please sign in to comment.