use of org.apache.hadoop.hive.druid.QTestDruidSerDe in project hive by apache.
the class TestDruidSerDe method testDruidDeserializer.
@Test
public void testDruidDeserializer() throws SerDeException, NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, IOException, InterruptedException, NoSuchMethodException, InvocationTargetException {
// Create, initialize, and test the SerDe
QTestDruidSerDe serDe = new QTestDruidSerDe();
Configuration conf = new Configuration();
Properties tbl;
// Timeseries query
tbl = createPropertiesQuery("sample_datasource", Query.TIMESERIES, TIMESERIES_QUERY, TIMESERIES_COLUMN_NAMES, TIMESERIES_COLUMN_TYPES);
serDe.initialize(conf, tbl, null);
deserializeQueryResults(serDe, Query.TIMESERIES, TIMESERIES_QUERY, tsQueryResults, TIMESERIES_QUERY_RESULTS_RECORDS);
// TopN query
tbl = createPropertiesQuery("sample_data", Query.TOPN, TOPN_QUERY, TOPN_COLUMN_NAMES, TOPN_COLUMN_TYPES);
serDe.initialize(conf, tbl, null);
deserializeQueryResults(serDe, Query.TOPN, TOPN_QUERY, topNQueryResults, TOPN_QUERY_RESULTS_RECORDS);
// GroupBy query
tbl = createPropertiesQuery("sample_datasource", Query.GROUP_BY, GROUP_BY_QUERY, GROUP_BY_COLUMN_NAMES, GROUP_BY_COLUMN_TYPES);
serDe.initialize(conf, tbl, null);
deserializeQueryResults(serDe, Query.GROUP_BY, GROUP_BY_QUERY, groupByQueryResults, GROUP_BY_QUERY_RESULTS_RECORDS);
tbl = createPropertiesQuery("sample_datasource", Query.GROUP_BY, GB_TIME_EXTRACTIONS, GB_TIME_EXTRACTIONS_COLUMN_NAMES, GB_TIME_EXTRACTIONS_COLUMN_TYPES);
serDe.initialize(conf, tbl, null);
deserializeQueryResults(serDe, Query.GROUP_BY, GB_TIME_EXTRACTIONS, groupByTimeExtractQueryResults, GROUP_BY_QUERY_EXTRACTION_RESULTS_RECORDS);
tbl = createPropertiesQuery("sample_datasource", Query.GROUP_BY, GB_MONTH_EXTRACTIONS, GB_MONTH_EXTRACTIONS_COLUMN_NAMES, GB_MONTH_EXTRACTIONS_COLUMN_TYPES);
serDe.initialize(conf, tbl, null);
deserializeQueryResults(serDe, Query.GROUP_BY, GB_MONTH_EXTRACTIONS, groupByMonthExtractQueryResults, GB_MONTH_EXTRACTION_RESULTS_RECORDS);
// Scan query -- results should be same as select query
tbl = createPropertiesQuery("wikipedia", Query.SCAN, SCAN_QUERY, SCAN_COLUMN_NAMES, SCAN_COLUMN_TYPES);
serDe.initialize(conf, tbl, null);
deserializeQueryResults(serDe, Query.SCAN, SCAN_QUERY, scanQueryResults, SCAN_QUERY_RESULTS_RECORDS);
}
Aggregations