Skip to content

Commit 4898fbd

Browse files
committed
assign should compare column names, not fields
1 parent 946a271 commit 4898fbd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

js/src/schema.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export class Schema<T extends { [key: string]: DataType } = any> {
9292
const curDictionaryFields = this.dictionaryFields;
9393
const metadata = mergeMaps(mergeMaps(new Map(), this.metadata), other.metadata);
9494
const newFields = other.fields.filter((f2) => {
95-
const i = curFields.findIndex((f) => f.compareTo(f2));
96-
return ~i ? (curFields[i] = curFields[i].clone({
95+
const i = curFields.findIndex((f) => f.name === f2.name);
96+
return ~i ? (curFields[i] = f2.clone({
9797
metadata: mergeMaps(mergeMaps(new Map(), curFields[i].metadata), f2.metadata)
9898
})) && false : true;
9999
}) as Field[];
@@ -102,7 +102,7 @@ export class Schema<T extends { [key: string]: DataType } = any> {
102102
const newDictionaries = [...dictionaries].filter(([y]) => !curDictionaries.every(([x]) => x === y));
103103
const newDictionaryFields = [...dictionaryFields].map(([id, newDictFields]) => {
104104
return [id, [...(curDictionaryFields.get(id) || []), ...newDictFields.map((f) => {
105-
const i = newFields.findIndex((f2) => f2.compareTo(f));
105+
const i = newFields.findIndex((f2) => f.name === f2.name);
106106
const { dictionary, indices, isOrdered, dictionaryVector } = f.type;
107107
const type = new Dictionary(dictionary, indices, id, isOrdered, dictionaryVector);
108108
return newFields[i] = f.clone({ type });

js/src/table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export class Table<T extends { [key: string]: DataType } = any>
254254
const fields = this._schema.fields;
255255
const [indices, oldToNew] = other.schema.fields.reduce((memo, f2, newIdx) => {
256256
const [indices, oldToNew] = memo;
257-
const i = fields.findIndex((f) => f.compareTo(f2));
257+
const i = fields.findIndex((f) => f.name === f2.name);
258258
~i ? (oldToNew[i] = newIdx) : indices.push(newIdx);
259259
return memo;
260260
}, [[], []] as number[][]);

0 commit comments

Comments
 (0)