lucidworks / hive-solr

Code to index Hive tables to Solr and Solr indexes to Hive
Apache License 2.0
47 stars 34 forks source link

Cannot retrieve data from a solr indexed external table #16

Open vishnucg opened 7 years ago

vishnucg commented 7 years ago

I am able to load data into solr external table from another managed hive table. I can see the data got indexed and do a serach on it using HUE interface. But when I try to retrieve data from the solr table, it is throwing "Failed with exception java.io.IOException:java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String". I am using solr-hive-serde-2.2.6.jar (using com.lucidworks.hadoop.hive.LWStorageHandler) on Hive 1.1.0-cdh5.4.5

acesar commented 7 years ago

Can you share the schema of the hive table?

I suggest you to use Solr dynamic field for the hive table.

Example

   CREATE EXTERNAL TABLE solr (id string, string_field_s string, int_field_i int, ...)

See https://cwiki.apache.org/confluence/display/solr/Dynamic+Fields

vishnucg commented 7 years ago

I was trying this one: CREATE EXTERNAL TABLE sales_table (id string, vin string, make_nm string,series_nm string,business_month string,msrp string,inctv_amt string ) STORED BY 'com.lucidworks.hadoop.hive.LWStorageHandler' LOCATION "" TBLPROPERTIES('solr.server.url'='', 'solr.collection'='salesschema', 'solr.query'=':_');

acesar commented 7 years ago

you can try changing the schema of the table,

CREATE EXTERNAL TABLE sales_table (id string, vin_s string, make_nm_s string,series_nm_s string,business_month_s string,msrp_s string,inctv_amt_s string )

I suspect that the business_month is an Integer and that is why you got that error.

vishnucg commented 7 years ago

Tried this dynamic fields approach, but throwing the same exception.