Skip to content

Commit f3bfbd1

Browse files
authored
Merge pull request #491 from KxSystems/ee-pykx
gg plot support for pykx
2 parents 1863967 + 7f064be commit f3bfbd1

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

resources/evaluatePy.q

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@
9696
result[`error]:string result`error;
9797
if [`backtrace in key result;
9898
result[`backtrace]:string result`backtrace];
99+
if[result `errored; :result];
100+
if[type[result[`result]] = 99h;
101+
if[`output in key result[`result];
102+
if[type[result[`result][`output]] = 99h;
103+
if[`bytes in key result[`result][`output];
104+
result[`base64]:1b; result[`result]: .Q.btoa result[`result][`output][`bytes]; :result]]]];
99105
result[`result]:
100106
$[result`errored;
101107
::;

src/classes/localConnection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class LocalConnection {
219219
return { base64, result };
220220
}
221221

222-
if (!stringify) {
222+
if (!stringify && !isPython) {
223223
return JSON.parse(result);
224224
}
225225

src/commands/serverCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,7 @@ export async function writeQueryResultsToView(
12241224
result,
12251225
isInsights,
12261226
connVersion,
1227+
isPython,
12271228
);
12281229
if (!checkIfIsDatasource(type)) {
12291230
addQueryHistory(

src/extension.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,18 @@ export async function activate(context: ExtensionContext) {
209209
),
210210
commands.registerCommand(
211211
"kdb.resultsPanel.update",
212-
(results: any, isInsights: boolean, connVersion?: number) => {
213-
ext.resultsViewProvider.updateResults(results, isInsights, connVersion);
212+
(
213+
results: any,
214+
isInsights: boolean,
215+
connVersion?: number,
216+
isPython?: boolean,
217+
) => {
218+
ext.resultsViewProvider.updateResults(
219+
results,
220+
isInsights,
221+
connVersion,
222+
isPython,
223+
);
214224
},
215225
),
216226
commands.registerCommand("kdb.resultsPanel.clear", () => {

src/services/resultsPanelProvider.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { decodeQUTF } from "../utils/decode";
3131
export class KdbResultsViewProvider implements WebviewViewProvider {
3232
public static readonly viewType = "kdb-results";
3333
public isInsights = false;
34+
public isPython = false;
3435
public _colorTheme: any;
3536
private _view?: WebviewView;
3637
private _results: string | string[] = "";
@@ -97,10 +98,12 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
9798
queryResults: any,
9899
isInsights?: boolean,
99100
connVersion?: number,
101+
isPython?: boolean,
100102
) {
101103
if (this._view) {
102104
this._view.show?.(true);
103105
this.isInsights = !!isInsights;
106+
this.isPython = !!isPython;
104107
this.updateWebView(queryResults, connVersion);
105108
}
106109
}
@@ -231,11 +234,15 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
231234
results: any,
232235
isInsights: boolean,
233236
connVersion?: number,
237+
isPython?: boolean,
234238
): GridOptions {
235239
let rowData = [];
236240
let columnDefs = [];
237241

238-
if (!isInsights || (connVersion && compareVersions(connVersion, 1.12))) {
242+
if (
243+
(!isInsights && !isPython) ||
244+
(isInsights && connVersion && compareVersions(connVersion, 1.12))
245+
) {
239246
rowData = this.updatedExtractRowData(results);
240247
columnDefs = this.updatedExtractColumnDefs(results);
241248
} else {
@@ -370,6 +377,7 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
370377
queryResult,
371378
this.isInsights,
372379
connVersion,
380+
this.isPython,
373381
);
374382
}
375383
if (gridOptions) {

0 commit comments

Comments
 (0)