Skip to content

Commit

Permalink
Use csv_transformed for csv serialization with engine to leverage c…
Browse files Browse the repository at this point in the history
…orrect handling of enums and timestamps in results (#2874)
  • Loading branch information
MauricioUyaguari authored Jan 16, 2024
1 parent 9613cb0 commit 42b9b95
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/eight-foxes-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@finos/legend-graph': patch
---


Use `csv_transformed` for csv serialization with engine to leverage correct handling of enums and timestamps in results.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import type { V1_LightQuery, V1_Query } from './query/V1_Query.js';
import type { V1_ServiceStorage } from './service/V1_ServiceStorage.js';
import type { GenerationMode } from '../../../../../graph-manager/action/generation/GenerationConfigurationDescription.js';
import type { V1_QuerySearchSpecification } from './query/V1_QuerySearchSpecification.js';
import type { EXECUTION_SERIALIZATION_FORMAT } from '../../../../../graph-manager/action/execution/ExecutionResult.js';
import { EXECUTION_SERIALIZATION_FORMAT } from '../../../../../graph-manager/action/execution/ExecutionResult.js';
import type { V1_ExternalFormatDescription } from './externalFormat/V1_ExternalFormatDescription.js';
import type { V1_ExternalFormatModelGenerationInput } from './externalFormat/V1_ExternalFormatModelGeneration.js';
import type { V1_GenerateSchemaInput } from './externalFormat/V1_GenerateSchemaInput.js';
Expand Down Expand Up @@ -141,6 +141,21 @@ export type V1_GrammarParserBatchInputEntry = {
| undefined;
};

enum ENGINE_EXECUTION_SERIALIZATION_FORMAT {
CSV_TRANSFORMED = 'csv_transformed',
}

const getEngineSerializationFormat = (
val: EXECUTION_SERIALIZATION_FORMAT,
): ENGINE_EXECUTION_SERIALIZATION_FORMAT | string => {
switch (val) {
case EXECUTION_SERIALIZATION_FORMAT.CSV:
return ENGINE_EXECUTION_SERIALIZATION_FORMAT.CSV_TRANSFORMED;
default:
return val;
}
};

export class V1_EngineServerClient extends AbstractServerClient {
currentUserId?: string | undefined;
private env?: string | undefined;
Expand Down Expand Up @@ -603,7 +618,9 @@ export class V1_EngineServerClient extends AbstractServerClient {
{},
undefined,
{
serializationFormat: options?.serializationFormat,
serializationFormat: options?.serializationFormat
? getEngineSerializationFormat(options.serializationFormat)
: undefined,
},
{ enableCompression: true },
{ skipProcessing: Boolean(options?.returnResultAsText) },
Expand Down

0 comments on commit 42b9b95

Please sign in to comment.