rpbouman / xmondrian

A java web archive (.WAR) to easily deploy and run the mondrian OLAP engine. Includes example schemas and datasets, client libraries, and web-frontends.
Apache License 2.0
21 stars 6 forks source link

Problem with MariaDB 10.2 #10

Open Peter2121 opened 6 years ago

Peter2121 commented 6 years ago

Hi, I installed xmondrian under tomcat8 and tested it on our data with MySQL 5.7.22 - all works correctly. Now I'm trying to switch it to the new database where the data will be migrated soon, and it does not work anymore. It seems that something is going wrong in getLevelMemberCount function, in mondrian.sql log I get the following logs:

2018-06-08 19:37:47,988 DEBUG [mondrian.sql] 3: SqlMemberSource.getLevelMemberCount: executing sql [
select
    count(*) as `c0`
from
    (select distinct
    `llx_olap_view_propal`.`date_valid_day` as `c0`,
    `llx_olap_view_propal`.`date_valid_month` as `c1`,
    `llx_olap_view_propal`.`date_valid_quarter` as `c2`,
    `llx_olap_view_propal`.`date_valid_year` as `c3`
from
    `llx_olap_view_propal` as `llx_olap_view_propal`) as `init`]

...for MySQL (working one) and

2018-06-08 19:39:37,126 DEBUG [mondrian.sql] 3: SqlMemberSource.getLevelMemberCount: executing sql [
select
    count(DISTINCT `llx_olap_view_propal`.`date_valid_day``llx_olap_view_propal`.`date_valid_month``llx_olap_view_propal`.`date_valid_quarter``llx_olap_view_propal`.`date_valid_year`) as `c0`
from
    `llx_olap_view_propal` as `llx_olap_view_propal`]
2018-06-08 19:39:37,129 DEBUG [mondrian.sql] 3: , exec+fetch 3 ms, 0 rows
2018-06-08 19:39:37,129 DEBUG [mondrian.sql] 3: , failed (java.sql.SQLSyntaxErrorException: (conn=6863) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.`date_valid_quarter``llx_olap_view_propal`.`date_valid_year`) as `c0`)

...for MariaDB - error. So in two cases, the SQL query is not the same, evidently the second query is incorrect. I would try to fix it myself, but I cannot build mondrian, downloaded from https://github.com/pentaho/mondrian. Can you share the build instructions, please?

warlock39 commented 6 years ago

I am investigating mondrian too, and had building experience of mondrian recently. I am not java developer, but i can share my experience. What your current building workflow and which errors you get?

Peter2121 commented 6 years ago

I solved the problem, rebuilding mondrian 3.14 jar from sources jar, downloaded from Sourceforge. The bug was in mondrian.rolap.SqlMemberSource.makeLevelMemberCountSql, around line 270

for (String colDef : columnList) {
                    if (i > 0) {
                        sb.append(", ");
                    }
                    sb.append(
                        sqlQuery.getDialect()
                            .generateCountExpression(colDef));
                    i++;    // ****************** this increment was lost
                }