From 643771929a6255309bfe20679f8651eccdca0d55 Mon Sep 17 00:00:00 2001 From: Dmitry Bolotin Date: Wed, 28 May 2025 00:21:39 +0200 Subject: [PATCH] WIP --- sdk/workflow-tengo/src/pt/index.lib.tengo | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sdk/workflow-tengo/src/pt/index.lib.tengo b/sdk/workflow-tengo/src/pt/index.lib.tengo index 41c4e1338f..15107fed54 100644 --- a/sdk/workflow-tengo/src/pt/index.lib.tengo +++ b/sdk/workflow-tengo/src/pt/index.lib.tengo @@ -102,6 +102,7 @@ workflow := func() { * - `file` {object}: A resource reference to the input file. * - `xsvType` {string}: The type of the file, either "csv" or "tsv". * - `schema` {map} (optional): A PTabler schema definition for the input file. + * - `noHeader` {boolean} (optional): Whether the input file has no header row. Defaults to `false`. * @param ...optionsRaw {map} (optional) - A single map argument for additional options: * - `xsvType` {string}: The type of the file ("csv" or "tsv"). Required if `frameInput` is a direct file reference or content, * and cannot be inferred. Overrides `xsvType` from structural input if provided there. @@ -136,6 +137,7 @@ workflow := func() { fileRef := undefined fileContent := undefined inputSchema := undefined + noHeader := false inputXsvType := undefined finalDataFrameId := undefined finalFileName := undefined @@ -194,6 +196,14 @@ workflow := func() { inferSchemaOpt = opts.inferSchema } + // Handle noHeader option + if !is_undefined(opts.noHeader) { + if !is_bool(opts.noHeader) { + ll.panic("'noHeader' option must be a boolean. Got: %T", opts.noHeader) + } + noHeader = opts.noHeader + } + // Handle schema option from opts if !is_undefined(opts.schema) { if !is_array(opts.schema) { @@ -220,6 +230,10 @@ workflow := func() { name: finalDataFrameId } + if noHeader { + readCsvStep.noHeader = true + } + if finalXsvType == "csv" { readCsvStep.delimiter = "," } else if finalXsvType == "tsv" {