From 774d98b85b90c753c7378c292e0d1b920b622635 Mon Sep 17 00:00:00 2001 From: Serhii Filonenko Date: Thu, 7 Dec 2023 11:32:09 +0200 Subject: [PATCH 1/2] FE: allow defining the quantity of estimated rows for udfs that returns table --- .../ddlProvider/ddlHelpers/functionHelper.js | 7 ++++++- properties_pane/container_level/containerLevelConfig.json | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js b/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js index bdb9580..417e064 100644 --- a/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js +++ b/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js @@ -67,7 +67,7 @@ module.exports = ({ _, templates, assignTemplates, getFunctionArguments, getName } }; const getExecutionRows = (value, udf) => { - if (!value || !udf.functionReturnsSetOf) { + if (!value || (!udf.functionReturnsSetOf && !isFunctionReturnsTable(udf))) { return ''; } @@ -84,6 +84,11 @@ module.exports = ({ _, templates, assignTemplates, getFunctionArguments, getName } }; + const isFunctionReturnsTable = (udf) => { + const returnType = (udf.functionReturnType || '').replace(/\s/g, '').toUpperCase(); + return returnType.startsWith('TABLE('); + }; + return { getFunctionsScript, }; diff --git a/properties_pane/container_level/containerLevelConfig.json b/properties_pane/container_level/containerLevelConfig.json index f8f8604..a512189 100644 --- a/properties_pane/container_level/containerLevelConfig.json +++ b/properties_pane/container_level/containerLevelConfig.json @@ -312,11 +312,7 @@ making sure that you maintain a proper JSON format. "valueType": "number", "minValue": 0, "step": 1, - "propertyTooltip": "A positive number giving the estimated number of rows that the planner should expect the function to return.", - "dependency": { - "key": "functionReturnsSetOf", - "value": true - } + "propertyTooltip": "A positive number giving the estimated number of rows that the planner should expect the function to return." }, { "propertyName": "Support function", From 059d74be7b66f521cb79135134ed6b109cb0ac24 Mon Sep 17 00:00:00 2001 From: Serhii Filonenko Date: Thu, 7 Dec 2023 11:49:25 +0200 Subject: [PATCH 2/2] FE: update checking that the function returns a table --- forward_engineering/ddlProvider/ddlHelpers/functionHelper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js b/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js index 417e064..3fe3ec3 100644 --- a/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js +++ b/forward_engineering/ddlProvider/ddlHelpers/functionHelper.js @@ -85,8 +85,8 @@ module.exports = ({ _, templates, assignTemplates, getFunctionArguments, getName }; const isFunctionReturnsTable = (udf) => { - const returnType = (udf.functionReturnType || '').replace(/\s/g, '').toUpperCase(); - return returnType.startsWith('TABLE('); + const returnType = (udf.functionReturnType || '').trim().toUpperCase(); + return returnType.startsWith('TABLE'); }; return {