node-s3tables 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ interface IcebergMetadata {
|
|
|
87
87
|
'default-spec-id': number;
|
|
88
88
|
'partition-specs': IcebergPartitionSpec[];
|
|
89
89
|
'last-partition-id': number;
|
|
90
|
-
'current-snapshot-id'
|
|
90
|
+
'current-snapshot-id': bigint | number;
|
|
91
91
|
location: string;
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -171,6 +171,7 @@ interface AddDataFilesParams {
|
|
|
171
171
|
tableBucketARN: string;
|
|
172
172
|
namespace: string;
|
|
173
173
|
name: string;
|
|
174
|
+
snapshotId?: bigint;
|
|
174
175
|
lists: AddFileList[];
|
|
175
176
|
retryCount?: number;
|
|
176
177
|
}
|
package/dist/index.js
CHANGED
|
@@ -745,16 +745,16 @@ function _encodeValue(raw, transform, out_type) {
|
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
const NaNValue = NaN;
|
|
748
|
-
function makeBounds(
|
|
748
|
+
function makeBounds(partitions, spec, schema) {
|
|
749
749
|
return spec.fields.map((f) => {
|
|
750
750
|
const schemaField = schema.fields.find((sf) => sf.id === f['source-id']);
|
|
751
751
|
if (!schemaField) {
|
|
752
752
|
throw new Error(`Schema field not found for source-id ${f['source-id']}`);
|
|
753
753
|
}
|
|
754
|
-
if (!(f.name in
|
|
755
|
-
throw new Error(`
|
|
754
|
+
if (!(f.name in partitions)) {
|
|
755
|
+
throw new Error(`partitions missing ${f.name}`);
|
|
756
756
|
}
|
|
757
|
-
const raw =
|
|
757
|
+
const raw = partitions[f.name];
|
|
758
758
|
if (typeof raw === 'number' && isNaN(raw)) {
|
|
759
759
|
return NaNValue;
|
|
760
760
|
}
|
|
@@ -1177,12 +1177,11 @@ async function addDataFiles(params) {
|
|
|
1177
1177
|
if (!region) {
|
|
1178
1178
|
throw new Error('bad tableBucketARN');
|
|
1179
1179
|
}
|
|
1180
|
-
const snapshot_id = _randomBigInt64();
|
|
1180
|
+
const snapshot_id = params.snapshotId ?? _randomBigInt64();
|
|
1181
1181
|
const metadata = await getMetadata(params);
|
|
1182
1182
|
const bucket = metadata.location.split('/').slice(-1)[0];
|
|
1183
|
-
const parent_snapshot_id = BigInt(metadata['current-snapshot-id']
|
|
1184
|
-
const snapshot = metadata.snapshots.find((s) => s['snapshot-id'] === parent_snapshot_id) ??
|
|
1185
|
-
null;
|
|
1183
|
+
const parent_snapshot_id = BigInt(metadata['current-snapshot-id']);
|
|
1184
|
+
const snapshot = metadata.snapshots.find((s) => BigInt(s['snapshot-id']) === parent_snapshot_id) ?? null;
|
|
1186
1185
|
if (!bucket) {
|
|
1187
1186
|
throw new Error('bad manifest location');
|
|
1188
1187
|
}
|
|
@@ -1313,7 +1312,7 @@ async function addDataFiles(params) {
|
|
|
1313
1312
|
}
|
|
1314
1313
|
// we do a merge in the append only simultanious case
|
|
1315
1314
|
const conflict_metadata = await getMetadata(params);
|
|
1316
|
-
const conflict_snapshot_id = BigInt(conflict_metadata['current-snapshot-id']
|
|
1315
|
+
const conflict_snapshot_id = BigInt(conflict_metadata['current-snapshot-id']);
|
|
1317
1316
|
if (conflict_snapshot_id <= 0n) {
|
|
1318
1317
|
throw new Error('conflict');
|
|
1319
1318
|
}
|