use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class HiveUtils method addTableasJobInput.
@SuppressWarnings("unchecked")
public static List<FieldSchema> addTableasJobInput(String db, String table, JobConf job, FileSystem fs) throws WindowingException {
LOG.info("HiveUtils::addTableasJobInput invoked");
try {
HiveMetaStoreClient client = getClient(job);
// 1. get Table details from Hive metastore
db = validateDB(client, db);
Table t = getTable(client, db, table);
StorageDescriptor sd = t.getSd();
// 2. add table's location to job input
FileInputFormat.addInputPath(job, new Path(sd.getLocation()));
// 3. set job inputFormatClass, extract from StorageDescriptor
Class<? extends InputFormat<? extends Writable, ? extends Writable>> inputFormatClass = (Class<? extends InputFormat<? extends Writable, ? extends Writable>>) Class.forName(sd.getInputFormat());
job.setInputFormat(inputFormatClass);
return client.getFields(db, table);
} catch (WindowingException w) {
throw w;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class HiveUtils method getFields.
public static List<FieldSchema> getFields(String db, String table, JobConf job) throws WindowingException {
LOG.info("HiveUtils::getFields invoked");
try {
HiveMetaStoreClient client = getClient(job);
db = validateDB(client, db);
getTable(client, db, table);
return client.getFields(db, table);
} catch (WindowingException w) {
throw w;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class HiveUtils method getDeserializer.
public static Deserializer getDeserializer(String db, String table, Configuration conf) throws WindowingException {
LOG.info("HiveUtils::getDeserializer invoked");
try {
HiveMetaStoreClient client = getClient(conf);
db = validateDB(client, db);
Table t = getTable(client, db, table);
return MetaStoreUtils.getDeserializer(conf, t);
} catch (WindowingException w) {
throw w;
} catch (Exception e) {
throw new WindowingException(e);
}
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class WindowSpecTranslation method translateWindowFrame.
static WindowFrameDef translateWindowFrame(QueryDef qDef, WindowFrameSpec wfSpec, InputInfo iInfo) throws WindowingException {
if (wfSpec == null) {
return null;
}
BoundarySpec s = wfSpec.getStart();
BoundarySpec e = wfSpec.getEnd();
WindowFrameDef wfDef = new WindowFrameDef(wfSpec);
wfDef.setStart(translateBoundary(qDef, s, iInfo));
wfDef.setEnd(translateBoundary(qDef, e, iInfo));
int cmp = s.compareTo(e);
if (cmp > 0) {
throw new WindowingException(sprintf("Window range invalid, start boundary is greater than end boundary: %s", wfSpec));
}
return wfDef;
}
use of com.sap.hadoop.windowing.WindowingException in project SQLWindowing by hbutani.
the class Partition method getAt.
public Object getAt(int i) throws WindowingException {
try {
elems.get(i, wRow);
Object o = serDe.deserialize(wRow);
return o;
} catch (Exception se) {
throw new WindowingException(se);
}
}
Aggregations