|
|
@ -1249,6 +1249,10 @@ async function extractColumnIdentifierType({ |
|
|
|
errors?: Set<string>; |
|
|
|
errors?: Set<string>; |
|
|
|
[p: string]: any; |
|
|
|
[p: string]: any; |
|
|
|
} = {}; |
|
|
|
} = {}; |
|
|
|
|
|
|
|
const sqlUI = |
|
|
|
|
|
|
|
typeof clientOrSqlUi === 'string' |
|
|
|
|
|
|
|
? SqlUiFactory.create({ client: clientOrSqlUi }) |
|
|
|
|
|
|
|
: clientOrSqlUi; |
|
|
|
|
|
|
|
|
|
|
|
switch (col?.uidt) { |
|
|
|
switch (col?.uidt) { |
|
|
|
// string
|
|
|
|
// string
|
|
|
@ -1342,10 +1346,6 @@ async function extractColumnIdentifierType({ |
|
|
|
case UITypes.ForeignKey: |
|
|
|
case UITypes.ForeignKey: |
|
|
|
case UITypes.SpecificDBType: |
|
|
|
case UITypes.SpecificDBType: |
|
|
|
{ |
|
|
|
{ |
|
|
|
const sqlUI = |
|
|
|
|
|
|
|
typeof clientOrSqlUi === 'string' |
|
|
|
|
|
|
|
? SqlUiFactory.create({ client: clientOrSqlUi }) |
|
|
|
|
|
|
|
: clientOrSqlUi; |
|
|
|
|
|
|
|
if (sqlUI) { |
|
|
|
if (sqlUI) { |
|
|
|
const abstractType = sqlUI.getAbstractType(col); |
|
|
|
const abstractType = sqlUI.getAbstractType(col); |
|
|
|
if (['integer', 'float', 'decimal'].includes(abstractType)) { |
|
|
|
if (['integer', 'float', 'decimal'].includes(abstractType)) { |
|
|
@ -1405,6 +1405,11 @@ export async function validateFormulaAndExtractTreeWithType({ |
|
|
|
column?: ColumnType; |
|
|
|
column?: ColumnType; |
|
|
|
getMeta: (tableId: string) => Promise<any>; |
|
|
|
getMeta: (tableId: string) => Promise<any>; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
|
|
|
|
const sqlUI = |
|
|
|
|
|
|
|
typeof clientOrSqlUi === 'string' |
|
|
|
|
|
|
|
? SqlUiFactory.create({ client: clientOrSqlUi }) |
|
|
|
|
|
|
|
: clientOrSqlUi; |
|
|
|
|
|
|
|
|
|
|
|
const colAliasToColMap = {}; |
|
|
|
const colAliasToColMap = {}; |
|
|
|
const colIdToColMap = {}; |
|
|
|
const colIdToColMap = {}; |
|
|
|
|
|
|
|
|
|
|
@ -1423,11 +1428,11 @@ export async function validateFormulaAndExtractTreeWithType({ |
|
|
|
if (parsedTree.type === JSEPNode.CALL_EXP) { |
|
|
|
if (parsedTree.type === JSEPNode.CALL_EXP) { |
|
|
|
const calleeName = parsedTree.callee.name.toUpperCase(); |
|
|
|
const calleeName = parsedTree.callee.name.toUpperCase(); |
|
|
|
// validate function name
|
|
|
|
// validate function name
|
|
|
|
if (!formulas[calleeName]) { |
|
|
|
if (!formulas[calleeName] || sqlUI?.getUnsupportedFnList().includes(calleeName)) { |
|
|
|
throw new FormulaError( |
|
|
|
throw new FormulaError( |
|
|
|
FormulaErrorType.INVALID_FUNCTION_NAME, |
|
|
|
FormulaErrorType.INVALID_FUNCTION_NAME, |
|
|
|
{}, |
|
|
|
{}, |
|
|
|
'Function not available' |
|
|
|
`Function ${calleeName} is not available` |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|