[Mondrian] Forcing "expr direction NULLS LAST" in order by without rebuild?

Jesús Barrasa jbarrasa at outlook.com
Mon Apr 14 12:10:10 EDT 2014


Thanks for the quick reply, Luc,

I had used the FirebirdDialect as inspiration as it is simple and also calls the generateOrderByNullsAnsi method. Is that not an equally valid starting point?

https://github.com/pentaho/mondrian/blob/master/src/main/mondrian/spi/impl/FirebirdDialect.java


Also, the problem with the JdbcDialectFactory is that it takes a 
Dialect.DatabaseProduct enumeration item as second argument and that would involve 
touching the Dialect class, wouldn't it?  :(


JB.


From: lucboudreau at gmail.com
Date: Mon, 14 Apr 2014 11:51:16 -0400
To: mondrian at pentaho.org
Subject: Re: [Mondrian] Forcing "expr direction NULLS LAST" in order by without rebuild?

You'll need to add some more code to your dialect.
Take a look at the MonetDbDialect to get you started. You need an empty constructor which calls the super class's one, and you also need to define a dialect factory.


ref: https://github.com/pentaho/mondrian/blob/master/src/main/mondrian/spi/impl/MonetDbDialect.java



On Mon, Apr 14, 2014 at 11:35 AM, Jesús Barrasa <jbarrasa at outlook.com> wrote:





Hi Luc, thanks.
I've tried building my own extension of JdbcDialectImpl and placed the jar in the lib directory of the mondrian webapp.
My class actually only implements this method:



@Override
        public String generateOrderByNulls(
            String expr,
            boolean ascending,
            boolean collateNullsLast)
        {
            LOGGER.info("Generating Order By expression");


            return generateOrderByNullsAnsi(expr, ascending, collateNullsLast);
        }

But still no luck. The 'Dialect' property in the connection string seems to be ignored. 
I wonder if I'm using the right version of the code (I'm on 3.6.1).



Any ideas?

Regards,

JB.

From: lucboudreau at gmail.com
Date: Thu, 10 Apr 2014 15:41:39 -0400
To: mondrian at pentaho.org


Subject: Re: [Mondrian] Forcing "expr direction NULLS LAST" in order by without rebuild?

The Oracle dialect has checks in place to validate that it talks to an Oracle DB, so it might fallback to JdbcDialectImpl. If you turn on debugging output in log4j, you'll see which dialect is chosen.




Try creating your own class and then pass it with the Dialect property, making sure it is present in your classpath. I think that should work.
Luc



On Wed, Apr 9, 2014 at 1:11 PM, Jesús Barrasa <jbarrasa at outlook.com> wrote:







Thanks! That sounds great but I cannot make it work :(
Is this on 3.6.1 ?
I've been trying to set the dialect to the Oracle one as it seems to use the group by notation that I need.
That's what my connection string looks like:





Provider=mondrian;Jdbc=jdbc:<mydb>;JdbcUser=<myuser>;JdbcPassword=<pwd>;Dialect=mondrian.spi.impl.OracleDialect;JdbcDrivers=<mydriver>;Catalog=/WEB-INF/queries/mycat.xml

But I see no difference, still generating the default SQL with the CASE expressions in the ORDER BY.




Am I missing something?

Regards,

JB.



> From: julianhyde at gmail.com
> Date: Tue, 8 Apr 2014 18:12:24 -0700
> To: mondrian at pentaho.org




> Subject: Re: [Mondrian] Forcing "expr direction NULLS LAST" in order by	without rebuild?
> 
> You can pass Dialect=com.example.MyDialect as part of the connect string. Mondrian will ignore its usual process of deducing the dialect from the JDBC database name and use the class you provide. You don’t need to re-compile Mondrian.




> 
> In other words, dialects are pluggable.
> 
> Julian
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org




> http://lists.pentaho.org/mailman/listinfo/mondrian
 		 	   		  

_______________________________________________

Mondrian mailing list

Mondrian at pentaho.org

http://lists.pentaho.org/mailman/listinfo/mondrian





_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian 		 	   		  

_______________________________________________

Mondrian mailing list

Mondrian at pentaho.org

http://lists.pentaho.org/mailman/listinfo/mondrian





_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20140414/f06ca3e8/attachment.html 


More information about the Mondrian mailing list