-1

我正在使用最新的 Saiku 3.8.3 独立版本,并且在使用具有不同架构的数据库 PostgreSQL 9.1 和 PUBLIC 时遇到了一些问题。

我创建了数据源并正确连接,这是我使用的数据源,没有个人详细信息:

type=OLAP
name=chegadaturistas
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:postgresql://DBNAME:PORT/DB;Catalog=mondrian:///datasources/chegada_turistas.xml;JdbcDrivers=org.postgresql.Driver;
username=postgres
password=PASSWORD
security.enabled=false

我还使用旧选项创建了 Mondrian Schema,因为我使用了 Schema Workbench。这是我创建的架构:

<Schema name="DEPES" description="DEPES">
  <Cube name="CHEGADAS" visible="true" cache="true" enabled="true">
    <Table name="chegada" schema="fato" alias="chegada">
    </Table>
    <Dimension type="StandardDimension" visible="true" foreignKey="id_tempo" highCardinality="false" name="Ano">
      <Hierarchy name="ANO" visible="true" hasAll="true" allMemberName="Todos os Anos" primaryKey="id_tempo">
        <Table name="tempo" schema="dimensao" alias="Tempo">
        </Table>
        <Level name="ANO" visible="true" column="nu_ano" nameColumn="nu_ano" ordinalColumn="nu_ano" type="Integer" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="id_origem" highCardinality="false" name="Origem">
      <Hierarchy name="Origem" visible="true" hasAll="true" allMemberName="Todas as Origens" primaryKey="id_origem">
        <Table name="origem" schema="dimensao">
        </Table>
        <Level name="Continente" visible="true" column="no_continente" nameColumn="no_continente" ordinalColumn="no_continente" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="Pais" visible="true" column="no_pais" nameColumn="no_pais" ordinalColumn="no_pais" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="id_via" highCardinality="false" name="Via">
      <Hierarchy name="Via" visible="true" hasAll="true" allMemberName="Todas as Vias" primaryKey="id_via">
        <Table name="via" schema="dimensao">
        </Table>
        <Level name="Nome" visible="true" column="id_via" nameColumn="no_via" ordinalColumn="no_via" type="Integer" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="id_destino" highCardinality="false" name="Destino">
      <Hierarchy name="Destino" visible="true" hasAll="true" allMemberName="Todos os Destinos" primaryKey="id_destino">
        <Table name="destino" schema="dimensao">
        </Table>
        <Level name="Regiao" visible="true" column="no_regiao" nameColumn="no_regiao" ordinalColumn="no_regiao" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="UF" visible="true" column="no_uf" nameColumn="no_uf" ordinalColumn="no_uf" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="id_tempo" highCardinality="false" name="Mes">
      <Hierarchy name="Mes" visible="true" hasAll="true" allMemberName="Todos os Meses" primaryKey="id_tempo">
        <Table name="tempo" schema="dimensao">
        </Table>
        <Level name="Nome do Mes" visible="true" column="nu_mes" nameColumn="no_mes" ordinalColumn="nu_mes" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="N&#250;mero do Mes" visible="true" column="nu_mes" nameColumn="nu_mes" ordinalColumn="nu_mes" type="Integer" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" visible="true" foreignKey="id_tempo" highCardinality="false" name="Semestre">
      <Hierarchy name="Semestre" visible="true" hasAll="true" allMemberName="Todos os Semestres" primaryKey="id_tempo">
        <Table name="tempo" schema="dimensao">
        </Table>
        <Level name="N&#250;mero do Semestre" visible="true" column="nu_semestre" nameColumn="nu_semestre" ordinalColumn="nu_semestre" type="Integer" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="Descri&#231;&#227;o do Semestre" visible="true" column="nu_semestre" nameColumn="no_semestre" ordinalColumn="no_semestre" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Measure name="qt_chegada" column="qt_chegada" datatype="Integer" aggregator="sum" caption="Chegadas" description="Quantidade de Turistas" visible="true">
    </Measure>
  </Cube>
<Schema>

问题是,当我运行 Saiku 时,我看不到架构,并且它在日志中有这个错误:

2016-04-08 08:17:31,976 WARN  [mondrian.rolap.RolapSchema] Model is in legacy format
2016-04-08 08:17:36,725 ERROR [org.saiku.web.core.SecurityAwareConnectionManager] Error connecting: chegadaturistas
mondrian.olap.MondrianException: Mondrian Error:Internal error: Reading row count from table [null, null, tempo]; sql=[select count(*) from "tempo"]

所以我注意到 mondrian 在 COUNT 中使用的选择只是表,而不是应该在 PostgreSQL 上使用的 schema.table。为了确保我在 PostgreSQL 公共模式中创建了一个 VIEW,它并没有在“tempo”表中给我这个错误,而是给了我另一个错误。有没有办法强制 Mondrian 在选择 PosgreSQL 时使用 SCHEMA.TABLE?

4

1 回答 1

1

问题解决了!似乎当您将旧版 Mondrian 3 XML 放在 Mondrian 4 上(Saiku 3.X 使用 Mondrian 4)时,它会升级 XML,但它只是“忘记”在更新后放置数据库 SCHEMA 标记。这是我所做的解决方案,感谢 Tom Barber(他在 Google 的 Saiku 小组上回答了这个问题。

所以只要找到log4j.xml,取消注释这个(不要重复,它已经在文件中注释了):

<appender name="MONDRIAN" class="org.apache.log4j.RollingFileAppender">
     <param name="File" value="${catalina.base}/logs/mondrian.log"/>
     <param name="Append" value="false"/>
     <param name="MaxFileSize" value="500KB"/>
     <param name="MaxBackupIndex" value="1"/>

     <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
     </layout>
   </appender>

   <category name="mondrian">
      <priority value="DEBUG"/>
      <appender-ref ref="MONDRIAN"/>
   </category> 

停止 SAIKU 并重新开始。稍等片刻,打开 saiku.log(它在“saiku_directory”\tomcat\logs\saiku.log 上,搜索如下所示的行:

<Schema name="YOUR_SCHEMA_NAME" missingLink="ignore" metamodelVersion="4.300">
    <PhysicalSchema>
........

复制整个架构并粘贴到新的 file.xml 上,在所有 TABLE 标记上插入标记 schema="SCHEMA_NAME",如下所示:

OLD:
<Table name="chegada" alias="chegada">
NEW:
<Table name="chegada" schema="fato"  alias="chegada">

再次启动 SAIKU,上传此架构,重新启动 saiku。

问题解决了!:D

于 2016-04-11T18:47:06.293 回答