use of com.questdb.common.NumericException in project questdb by bluestreak01.
the class QueryFilterAnalyser method analyzeInInterval.
private boolean analyzeInInterval(IntrinsicModel model, ExprNode col, ExprNode in) throws ParserException {
if (!isTimestamp(col)) {
return false;
}
if (in.paramCount > 3) {
throw QueryError.$(in.args.getQuick(0).position, "Too many args");
}
if (in.paramCount < 3) {
throw QueryError.$(in.position, "Too few args");
}
ExprNode lo = in.args.getQuick(1);
ExprNode hi = in.args.getQuick(0);
if (lo.type == ExprNode.CONSTANT && hi.type == ExprNode.CONSTANT) {
long loMillis;
long hiMillis;
try {
loMillis = DateFormatUtils.tryParse(quoteEraser.ofQuoted(lo.token));
} catch (NumericException ignore) {
throw QueryError.$(lo.position, "Unknown date format");
}
try {
hiMillis = DateFormatUtils.tryParse(quoteEraser.ofQuoted(hi.token));
} catch (NumericException ignore) {
throw QueryError.$(hi.position, "Unknown date format");
}
model.intersectIntervals(loMillis, hiMillis);
in.intrinsicValue = IntrinsicValue.TRUE;
return true;
}
return false;
}
use of com.questdb.common.NumericException in project questdb by bluestreak01.
the class QueryFilterAnalyser method analyzeNotInInterval.
private boolean analyzeNotInInterval(IntrinsicModel model, ExprNode col, ExprNode in) throws ParserException {
if (!isTimestamp(col)) {
return false;
}
if (in.paramCount > 3) {
throw ParserException.$(in.args.getQuick(0).position, "Too many args");
}
if (in.paramCount < 3) {
throw ParserException.$(in.position, "Too few args");
}
ExprNode lo = in.args.getQuick(1);
ExprNode hi = in.args.getQuick(0);
if (lo.type == ExprNode.CONSTANT && hi.type == ExprNode.CONSTANT) {
long loMillis;
long hiMillis;
try {
loMillis = DateFormatUtils.tryParse(lo.token, 1, lo.token.length() - 1);
} catch (NumericException ignore) {
throw ParserException.invalidDate(lo.position);
}
try {
hiMillis = DateFormatUtils.tryParse(hi.token, 1, hi.token.length() - 1);
} catch (NumericException ignore) {
throw ParserException.invalidDate(hi.position);
}
model.subtractIntervals(loMillis, hiMillis);
in.intrinsicValue = IntrinsicValue.TRUE;
return true;
}
return false;
}
Aggregations