diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index ce119736ac..284343fd47 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -816,17 +816,12 @@ public class DataSetTableService { List fieldList = (List) sqlMap.get("field"); List join = (List) sqlMap.get("join"); - // 处理结果 - DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); - // 使用输入的sql先预执行一次,并拿到所有字段 - datasourceRequest.setQuery(sql); - Map res = new HashMap<>(); + // 处理结果 try { - List previewFields = datasourceProvider.fetchResultField(datasourceRequest); - QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); - datasourceRequest.setQuery(qp.createSQLPreview(sql, previewFields.get(0).getFieldName())); + DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); + datasourceRequest.setQuery(qp.createSQLPreview(sql, null)); Map result = datasourceProvider.fetchResultAndField(datasourceRequest); List data = result.get("dataList"); List fields = result.get("fieldList"); @@ -878,16 +873,11 @@ public class DataSetTableService { datasourceRequest.setDatasource(ds); sql = getCustomSQLDoris(dataTableInfoDTO, list); } - DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); - // 使用输入的sql先预执行一次,并拿到所有字段 - datasourceRequest.setQuery(sql); - Map res = new HashMap<>(); try { - List previewFields = datasourceProvider.fetchResultField(datasourceRequest); - + DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); - datasourceRequest.setQuery(qp.createSQLPreview(sql, previewFields.get(0).getFieldName())); + datasourceRequest.setQuery(qp.createSQLPreview(sql, null)); Map result = datasourceProvider.fetchResultAndField(datasourceRequest); List data = result.get("dataList"); List fields = result.get("fieldList");