[Mondrian] Mondrian 4 Failing on <Query>

Julian Hyde jhyde at pentaho.com
Fri Nov 2 21:28:42 EDT 2012

I just added the AdventureWorksDW schema to Mondrian's test infrastructure. There is a test, AdventureWorksTest.testFoo() that successfully executes a simple query using the schema.

To populate the data set on MySQL:

$ mysqladmin -u foodmart -pfoodmart create adventureworks_dw
$ bin/loadFoodMart.sh  --db mysql --dataset ADVENTUREWORKS_DW

(Our terminology about AdventureWorks versus AdventureWorksDW is a little bit mixed up. I'd like to preserve space in the namespace for us to run against the operational AdventureWorks schema, but for now the DW schema file is misleadingly called AdventureWorks.mondrian.xml.)


You might find it useful to diff mondrian/demo/AdventureWorks.mondrian.xml with the one you are using to develop the book. I made a couple of changes.

I saw you had a <QueryElement> in the schema, as I had hypothesized. But I can't reproduce this latest error (regarding VARCHAR).


On Nov 2, 2012, at 5:26 PM, William Back <wback at pentaho.com> wrote:

> I'm encountering an exception when attempting to use the <Query> element.  
> I get the following exception:
> mondrian.rolap.RolapSchema$MondrianSchemaException: Unknown data type VARCHAR (-1) for column CountryRegionCode of view; mondrian is probably not familiar with this database's type system (in Query) (at line 38, column 4)
> 	at mondrian.rolap.RolapSchemaLoaderHandlerImpl.warning(RolapSchemaLoaderHandlerImpl.java:69)
> 	at mondrian.rolap.RolapSchemaLoaderHandlerImpl.warning(RolapSchemaLoaderHandlerImpl.java:59)
> 	at mondrian.rolap.RolapSchema$PhysSchema.describe(RolapSchema.java:1040)
> 	at mondrian.rolap.RolapSchema$PhysView.populateColumns(RolapSchema.java:1598)
> 	at mondrian.rolap.RolapSchema$PhysRelationImpl.ensurePopulated(RolapSchema.java:1502)
> This is occurring because the return from metaData.getColumnType(i + 1) is -1.  However, the ResultSetMetadata has the following values:
> 	com.mysql.jdbc.Field at 489de27c[catalog=adventure_works_dw,tableName=c,originalTableName=dim_customer,columnName=CustomerKey,originalColumnName=CustomerKey,mysqlType=3(FIELD_TYPE_LONG),flags= PRIMARY_KEY, charsetIndex=63, charsetName=US-ASCII]
> 	com.mysql.jdbc.Field at 75806022[catalog=adventure_works_dw,tableName=g,originalTableName=dim_geography,columnName=CountryRegionCode,originalColumnName=CountryRegionCode,mysqlType=253(FIELD_TYPE_VAR_STRING),flags= BLOB, charsetIndex=8, charsetName=Cp1252]
> 	com.mysql.jdbc.Field at 3f279472[catalog=adventure_works_dw,tableName=g,originalTableName=dim_geography,columnName=StateProvinceName,originalColumnName=StateProvinceName,mysqlType=253(FIELD_TYPE_VAR_STRING),flags= BLOB, charsetIndex=8, charsetName=Cp1252]
> 	com.mysql.jdbc.Field at 3f82e8c2[catalog=adventure_works_dw,tableName=g,originalTableName=dim_geography,columnName=City,originalColumnName=City,mysqlType=253(FIELD_TYPE_VAR_STRING),flags= BLOB, charsetIndex=8, charsetName=Cp1252]
> I would expect the call to return Types.VARCHAR rather than -1. 
> Any ideas?  
> Bill.
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

More information about the Mondrian mailing list