SO社区,
我的BI应用程序出现问题:
我有一个基于Schema Workbench的架构,当我使用内置查询测试器时,它可以完美而准确地工作。但是,当从我的java应用程序调用时,相同的模式为完全相同的MDX查询返回不同的单元格值(我已经尝试过PreparedOlapStatement.execute()和OlapStatement.executeOlapQuery(String)方法)。
执行该语句后,这些值是错误的,所以我认为这对我的应用程序来说不是问题。我已经尝试对查询进行硬编码以确保它与我在工作台中使用的查询相同,但它仍然返回错误的值。
查询如下,由于(相当愚蠢的)公司政策而改变了一些名称:
WITH
SET [SET1] as Filter(Filter1)
SET [T] as FILTER(FilterTime)
MEMBER Measures.[V] as SUM([T].item(0):Time.currentmember, Measures.[Measure1])
SET [Medida] as ({Measures.[V]})
SET [CJ] as ([ClassFin]*[Medida])
SELECT
[CJ] on 1,
[T] on 0
FROM [Cube]
假设过滤器按预期工作(因为我从Schema Workbench获得的结果是正确的,使用底层数据库进行了双重检查),可能出现什么问题?
生成的两个SQL查询都是相同的:
SELECT "td"."ano" AS "c0",
"td"."mes" AS "c1",
"fechamento_classificacao_financeira"."id_pai" AS "c2",
sum((CASE
WHEN sinal = 0 THEN vr
ELSE 0
END)) AS "m0"
FROM "util"."tempo_datas" AS "td",
(SELECT fc.classificacaofinanceira AS classfin,
fc.bempatrimonial AS bempat,
tt.id_pessoa AS participante,
tt.sinal AS sinal,
fc.centrocusto AS cc,
fc.data AS DATA,
fc.projeto AS pj,
fc.valorrealizado_recebimento vr,
fc.valorrealizado_pagamento vp
FROM financas.dadosanaliticosfluxocaixa fc
LEFT JOIN financas.titulos tt ON tt.id = fc.titulo) AS "fc",
"util"."fechamento_classificacao_financeira" AS "fechamento_classificacao_financeira"
WHERE "fc"."data" = "td"."data_completa"
AND "td"."ano" = '2017'
AND "fc"."classfin" = "fechamento_classificacao_financeira"."id_filho"
AND "fechamento_classificacao_financeira"."id_pai" IN ('8875114b-5dd3-4e5c-915f-55f91a825a74',
'cbae1877-9913-44b2-8533-f33a9a28ea31',
'e22fb59b-a6be-4d6b-a2de-8bb66b2b1b2a')
GROUP BY "td"."ano",
"td"."mes",
"fechamento_classificacao_financeira"."id_pai"
所以不允许我并排上传查询的屏幕截图,但我使用差异检查器确认它们是相同的。
答案 0 :(得分:1)
我发现了什么问题。结果是底层DBMS有两个同名的数据库,一个大写,一个不大。架构工作台使用大写的工作台,而我的应用程序则使用另一个。现在它已经修好了,它给了我正确的价值。