From b97eb8676994bb2023803bf36b7eb3a9e6165114 Mon Sep 17 00:00:00 2001 From: zixi0825 Date: Sun, 13 Oct 2024 13:41:55 +0800 Subject: [PATCH] [Fix-462][Engine] Fix error in multi-table-accuracy local mode (#464) --- .../engine/config/MetricParserUtils.java | 17 +++++++++++++++-- .../LocalMultiTableAccuracyMetricBuilder.java | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/datavines-engine/datavines-engine-config/src/main/java/io/datavines/engine/config/MetricParserUtils.java b/datavines-engine/datavines-engine-config/src/main/java/io/datavines/engine/config/MetricParserUtils.java index cc08601e3..d9cc63f67 100644 --- a/datavines-engine/datavines-engine-config/src/main/java/io/datavines/engine/config/MetricParserUtils.java +++ b/datavines-engine/datavines-engine-config/src/main/java/io/datavines/engine/config/MetricParserUtils.java @@ -148,9 +148,22 @@ public static String getOnClause(List mappingColumnList, Map mappingColumnList, Map inputParameterValueResult, boolean needQuote) { + //get on clause + String[] columnList = new String[mappingColumnList.size()]; + for (int i = 0; i < mappingColumnList.size(); i++) { + MappingColumn column = mappingColumnList.get(i); + columnList[i] = inputParameterValueResult.get(TABLE_ALIAS) + "." + QuoteIdentifier.quote(column.getColumn(), needQuote) + + column.getOperator() + + inputParameterValueResult.get(TABLE2_ALIAS) + "." + QuoteIdentifier.quote(column.getColumn2(), needQuote); } return String.join(AND,columnList); diff --git a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-config/src/main/java/io/datavines/engine/local/config/LocalMultiTableAccuracyMetricBuilder.java b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-config/src/main/java/io/datavines/engine/local/config/LocalMultiTableAccuracyMetricBuilder.java index eaaf13923..9c5137211 100644 --- a/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-config/src/main/java/io/datavines/engine/local/config/LocalMultiTableAccuracyMetricBuilder.java +++ b/datavines-engine/datavines-engine-plugins/datavines-engine-local/datavines-engine-local-config/src/main/java/io/datavines/engine/local/config/LocalMultiTableAccuracyMetricBuilder.java @@ -57,7 +57,7 @@ public void buildTransformConfigs() { List mappingColumns = JSONUtils.toList(metricInputParameter.get(MAPPING_COLUMNS),MappingColumn.class); metricInputParameter.put(TABLE_ALIAS_COLUMNS, MetricParserUtils.getTableAliasColumns(mappingColumns,metricInputParameter.get(TABLE_ALIAS),1, false)); metricInputParameter.put(TABLE2_ALIAS_COLUMNS, MetricParserUtils.getTableAliasColumns(mappingColumns,metricInputParameter.get(TABLE2_ALIAS),2, false)); - metricInputParameter.put(ON_CLAUSE, MetricParserUtils.getOnClause(mappingColumns, metricInputParameter, false)); + metricInputParameter.put(ON_CLAUSE, MetricParserUtils.getOnClauseForLocal(mappingColumns, metricInputParameter, false)); metricInputParameter.put(WHERE_CLAUSE, MetricParserUtils.getWhereClause(mappingColumns, metricInputParameter,false)); metric2InputParameter.put(metricUniqueKey, metricInputParameter);