use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class QueryDefDeserializer method visit.
/*
* Use the serde class name and properties on the query output specification
* to recreate the serde and OI on the query output definition
*/
@Override
public void visit(QueryOutputDef output) throws WindowingException {
String serDeClassName = output.getOutputSpec().getSerDeClass();
Properties serDeProps = output.getOutputSpec().getSerDeProps();
try {
SerDe serDe = (SerDe) SerDeUtils.lookupDeserializer(serDeClassName);
serDe.initialize(hConf, serDeProps);
output.setSerDe(serDe);
} catch (SerDeException se) {
throw new WindowingException(se);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class QueryDefDeserializer method visit.
/*
* 1. Determine the serde properties from the hive table definition
* 2. Retrieve the deserializer using the serde class name and
* initialize it using the serdeproperties
* 3. setup the serde and OI on the hive table definition The OI is
* used to evaluate expressions in the next PTF in the
* chain. This OI is constructed from the hive meta table info.
* 4. We add the hive table definition to the input
* map on the query translation info.
*/
@Override
public void visit(HiveTableDef hiveTable) throws WindowingException {
this.qInDef = hiveTable;
String serDeClassName = hiveTable.getTableSerdeClassName();
Properties serDeProps = new Properties();
Map<String, String> serdePropsMap = hiveTable.getTableSerdeProps();
for (String serdeName : serdePropsMap.keySet()) {
serDeProps.setProperty(serdeName, serdePropsMap.get(serdeName));
}
try {
SerDe serDe = (SerDe) SerDeUtils.lookupDeserializer(serDeClassName);
serDe.initialize(hConf, serDeProps);
hiveTable.setSerde(serDe);
hiveTable.setOI((StructObjectInspector) serDe.getObjectInspector());
} catch (SerDeException se) {
throw new WindowingException(se);
}
tInfo.addInput(hiveTable);
inputInfo = tInfo.getInputInfo(hiveTable);
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class TranslateUtils method validateValueBoundaryExprType.
public static void validateValueBoundaryExprType(ObjectInspector OI) throws WindowingException {
if (!OI.getCategory().equals(Category.PRIMITIVE)) {
throw new WindowingException("Value Boundary expression must be of primitve type");
}
PrimitiveObjectInspector pOI = (PrimitiveObjectInspector) OI;
PrimitiveCategory pC = pOI.getPrimitiveCategory();
switch(pC) {
case BYTE:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:
case TIMESTAMP:
break;
default:
throw new WindowingException(sprintf("Primitve type %s not supported in Value Boundary expression", pC));
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class CompositeDataType method define.
public static CompositeDataType define(StructObjectInspector OI) throws WindowingException {
List<? extends StructField> fields = OI.getAllStructFieldRefs();
@SuppressWarnings("unchecked") DataType<? extends WritableComparable>[] elementTypes = (DataType<? extends WritableComparable>[]) new DataType[fields.size()];
int i = 0;
for (StructField f : fields) {
ObjectInspector fOI = f.getFieldObjectInspector();
if (fOI.getCategory() != Category.PRIMITIVE) {
throw new WindowingException("Cannot handle non primitve fields for partitioning/sorting");
}
PrimitiveObjectInspector pOI = (PrimitiveObjectInspector) fOI;
switch(pOI.getPrimitiveCategory()) {
case BOOLEAN:
elementTypes[i] = BOOLEAN;
break;
case DOUBLE:
elementTypes[i] = DOUBLE;
break;
case BYTE:
elementTypes[i] = BYTE;
break;
case FLOAT:
elementTypes[i] = FLOAT;
break;
case INT:
elementTypes[i] = INT;
break;
case LONG:
elementTypes[i] = LONG;
break;
case SHORT:
elementTypes[i] = SHORT;
break;
case STRING:
elementTypes[i] = TEXT;
break;
default:
throw new WindowingException(Utils.sprintf("Cannot handle datatype %s for partitioning/sorting", pOI.toString()));
}
i++;
}
return new CompositeDataType(",", elementTypes);
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class WindowingHiveCliDriver method setupWindowing.
public void setupWindowing() throws WindowingException {
// not nice, but ...
try {
// NoSuchFieldException
Field f = CliDriver.class.getDeclaredField("conf");
f.setAccessible(true);
// IllegalAccessException
cfg = (HiveConf) f.get(this);
// NoSuchFieldException
f = CliDriver.class.getDeclaredField("console");
f.setAccessible(true);
// IllegalAccessException
hiveConsole = (LogHelper) f.get(this);
} catch (Throwable t) {
throw new WindowingException("Failed to access conf and console members from HiveCliDriver", t);
}
// initialize windowing client
wClient = new WindowingClient(this);
}
Aggregations