Pentaho Saiku CE plugin - Change Asterisk CrossJoin in CrossJoin Classic

Saiku plugin is (maybe) the most used plugin in Pentaho CE. I like this plugin, but in 3.x version the developers, use for CrossJoin the asterisk (*) operator as a shorthand for crossjoin. It's easy, clean, but when i put more then 4 dimensions the query takes to much time against the classic CROSSJOIN().

See http://jira.pentaho.com/browse/MONDRIAN-2284

To achieve old functionality I've modified 2 files in saiku-query library: src/main/java/org/saiku/query/NodeConverter.java and src/main/java/org/saiku/query/Olap4jNodeConverter.java

NodeConverter.java


protected static CallNode generateCrossJoin(List selections, boolean nonEmpty, boolean asterisk) {
 String crossJoinFun = "CrossJoin";
 ParseTreeNode sel1 = selections.remove(0);
 if (sel1 instanceof MemberNode) {
  sel1 = generateSetCall(sel1);
 }
 if (selections.size() == 1) {
  ParseTreeNode sel2 = selections.get(0);
  if (sel2 instanceof MemberNode) {
   sel2 = generateSetCall(sel2);
  }
  return new CallNode(
    null, crossJoinFun, Syntax.Function, sel1, sel2);

 } else {
  return new CallNode(
   null, crossJoinFun, Syntax.Function, sel1,
   generateCrossJoin(selections, nonEmpty,false));
 }
}

Olap4jNodeConverter.java


axisExpression = generateCrossJoin(hierarchies, axis.isNonEmpty(), false);

Surce code: https://github.com/gdudau/saiku-query

Comentarii

Postări populare de pe acest blog

SmokePing integrate with Observium