@microsoft/rayfin-connector-fabric-semanticmodel 1.36.0-beta.0 → 1.36.1
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/arrow.js +44 -11
- package/package.json +2 -2
package/dist/arrow.js
CHANGED
|
@@ -56,9 +56,48 @@ function coerceBigInt(raw, columnName) {
|
|
|
56
56
|
}
|
|
57
57
|
return Number(v);
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Locate the chunk holding the logical `index` of a chunked vector, returning
|
|
61
|
+
* `undefined` when the index is out of range.
|
|
62
|
+
*/
|
|
63
|
+
function locateChunk(chunks, index) {
|
|
64
|
+
let local = index;
|
|
65
|
+
for (const data of chunks) {
|
|
66
|
+
if (local < data.length)
|
|
67
|
+
return { data, index: local };
|
|
68
|
+
local -= data.length;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Read the Union type id of a row, or `undefined` when the row is null or
|
|
74
|
+
* cannot be resolved.
|
|
75
|
+
*
|
|
76
|
+
* Power BI returns Variant columns (for example most measures, or
|
|
77
|
+
* `IF(cond, 5, "text")`) dictionary-encoded as `Dictionary<Int8, Union<...>>`.
|
|
78
|
+
* The schema-level type is unwrapped by {@link unwrapType}, but the row-level
|
|
79
|
+
* data then carries the dictionary keys in `values` and the Union itself in
|
|
80
|
+
* `dictionary`, so the type id must be read from the referenced dictionary
|
|
81
|
+
* entry rather than from the row data.
|
|
82
|
+
*/
|
|
83
|
+
function unionTypeIdAt(column, rowIndex) {
|
|
84
|
+
const row = locateChunk(column.data, rowIndex);
|
|
85
|
+
if (!row || !row.data.getValid(row.index))
|
|
86
|
+
return undefined;
|
|
87
|
+
let union = row;
|
|
88
|
+
if (row.data.dictionary) {
|
|
89
|
+
const key = Number(row.data.values[row.index]);
|
|
90
|
+
const entry = locateChunk(row.data.dictionary.data, key);
|
|
91
|
+
if (!entry || !entry.data.getValid(entry.index))
|
|
92
|
+
return undefined;
|
|
93
|
+
union = entry;
|
|
94
|
+
}
|
|
95
|
+
return union.data.typeIds?.[union.index];
|
|
96
|
+
}
|
|
59
97
|
/**
|
|
60
98
|
* Resolve the active child coercer for a Union row so Decimal, Date/Timestamp,
|
|
61
99
|
* and Int64 values follow the same conversion paths as non-Union columns.
|
|
100
|
+
* Handles both plain and dictionary-encoded Union columns.
|
|
62
101
|
*/
|
|
63
102
|
function makeUnionCoercer(field) {
|
|
64
103
|
const { type } = unwrapType(field);
|
|
@@ -68,17 +107,11 @@ function makeUnionCoercer(field) {
|
|
|
68
107
|
return null;
|
|
69
108
|
if (!column || rowIndex === undefined)
|
|
70
109
|
return raw;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const childCoercer = childCoercers[childIndex];
|
|
77
|
-
return childCoercer ? childCoercer(raw, columnName) : raw;
|
|
78
|
-
}
|
|
79
|
-
chunkIndex -= data.length;
|
|
80
|
-
}
|
|
81
|
-
return raw;
|
|
110
|
+
const typeId = unionTypeIdAt(column, rowIndex);
|
|
111
|
+
if (typeId === undefined)
|
|
112
|
+
return raw;
|
|
113
|
+
const childCoercer = childCoercers[type.typeIdToChildIndex[typeId]];
|
|
114
|
+
return childCoercer ? childCoercer(raw, columnName) : raw;
|
|
82
115
|
};
|
|
83
116
|
}
|
|
84
117
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rayfin-connector-fabric-semanticmodel",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.1",
|
|
4
4
|
"description": "Typed connector marker for the Fabric semantic-model (Power BI dataset) connector category. Pair with @microsoft/rayfin-client to type `client.connectors.<name>.executeQuery(...)`.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"apache-arrow": "^21.1.0",
|
|
30
30
|
"lz4js": "^0.2.0",
|
|
31
|
-
"@microsoft/rayfin-connectors": "1.36.
|
|
31
|
+
"@microsoft/rayfin-connectors": "1.36.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"registry": "https://npm.pkg.github.com",
|