Skip to content

Commit

Permalink
MONDRIAN: Integrating change #13038, added Vertica dialect, fix for M…
Browse files Browse the repository at this point in the history
…ONDRIAN-617 contributed by Pedro Alves, Vertica doesn't support ORDER BY.. NULLS LAST type of queries. Invalid sql

[git-p4: depot-paths = "//open/mondrian-release/3.1/": change = 13039]
  • Loading branch information
Will Gorman committed Sep 11, 2009
1 parent 3f28ed5 commit 02feb91
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/mondrian/olap/Mondrian.xml
Expand Up @@ -1111,6 +1111,7 @@ Revision is $Id$
<li>ingres</li>
<li>infobright</li>
<li>luciddb</li>
<li>vertica</li>
</ul>
</Doc>
</Attribute>
Expand Down
2 changes: 2 additions & 0 deletions src/main/mondrian/olap/Mondrian_SW.xml
Expand Up @@ -1147,6 +1147,7 @@
<li>ingres</li>
<li>infobright</li>
<li>luciddb</li>
<li>vertica</li>
</ul>
</Doc>
<Value>generic</Value>
Expand All @@ -1164,6 +1165,7 @@
<Value>ingres</Value>
<Value>infobright</Value>
<Value>luciddb</Value>
<Value>vertica</Value>
</Attribute>
<CData/>
<Code><![CDATA[
Expand Down
3 changes: 2 additions & 1 deletion src/main/mondrian/spi/Dialect.java
Expand Up @@ -736,7 +736,8 @@ enum DatabaseProduct {
MYSQL,
SQLSTREAM,
SYBASE,
TERADATA;
TERADATA,
VERTICA;

/**
* Return the root of the family of products this database product
Expand Down
2 changes: 2 additions & 0 deletions src/main/mondrian/spi/impl/JdbcDialectImpl.java
Expand Up @@ -861,6 +861,8 @@ public static DatabaseProduct getProduct(
return DatabaseProduct.TERADATA;
} else if (productName.toUpperCase().indexOf("HSQL") >= 0) {
return DatabaseProduct.HSQLDB;
} else if (productName.toUpperCase().indexOf("VERTICA") >= 0) {
return DatabaseProduct.VERTICA;
} else {
return DatabaseProduct.UNKNOWN;
}
Expand Down
56 changes: 56 additions & 0 deletions src/main/mondrian/spi/impl/VerticaDialect.java
@@ -0,0 +1,56 @@
/*
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 2009 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
package mondrian.spi.impl;

import java.sql.Connection;
import java.sql.SQLException;

/**
* Implementation of {@link mondrian.spi.Dialect} for the Vertica database.
*
* @author Pedro Alves
* @version $Id$
* @since Sept 11, 2009
*/
public class VerticaDialect extends JdbcDialectImpl {

public static final JdbcDialectFactory FACTORY =
new JdbcDialectFactory(
VerticaDialect.class,
DatabaseProduct.VERTICA);

/**
* Creates a VerticaDialect.
*
* @param connection Connection
*/
public VerticaDialect(Connection connection) throws SQLException {
super(connection);
}

public boolean requiresAliasForFromQuery() {
return true;
}

@Override
public String generateOrderItem(
String expr,
boolean nullable,
boolean ascending)
{
if (ascending) {
return expr + " ASC";
} else {
return expr + " DESC";
}
}

}

// End VerticaDialect.java

0 comments on commit 02feb91

Please sign in to comment.