use of org.apache.drill.common.expression.parser.ExprLexer in project drill by apache.
the class TestBuilder method parsePath.
// modified code from SchemaPath.De class. This should be used sparingly and only in tests if absolutely needed.
public static SchemaPath parsePath(String path) {
try {
ExprLexer lexer = new ExprLexer(new ANTLRStringStream(path));
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExprParser parser = new ExprParser(tokens);
ExprParser.parse_return ret = parser.parse();
if (ret.e instanceof SchemaPath) {
return (SchemaPath) ret.e;
} else {
throw new IllegalStateException("Schema path is not a valid format.");
}
} catch (RecognitionException e) {
throw new RuntimeException(e);
}
}
use of org.apache.drill.common.expression.parser.ExprLexer in project drill by axbaretto.
the class TestBuilder method parsePath.
// modified code from SchemaPath.De class. This should be used sparingly and only in tests if absolutely needed.
public static SchemaPath parsePath(String path) {
try {
ExprLexer lexer = new ExprLexer(new ANTLRStringStream(path));
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExprParser parser = new ExprParser(tokens);
ExprParser.parse_return ret = parser.parse();
if (ret.e instanceof SchemaPath) {
return (SchemaPath) ret.e;
} else {
throw new IllegalStateException("Schema path is not a valid format.");
}
} catch (RecognitionException e) {
throw new RuntimeException(e);
}
}
use of org.apache.drill.common.expression.parser.ExprLexer in project drill by axbaretto.
the class ExecTest method parseExpr.
protected LogicalExpression parseExpr(String expr) throws RecognitionException {
final ExprLexer lexer = new ExprLexer(new ANTLRStringStream(expr));
final CommonTokenStream tokens = new CommonTokenStream(lexer);
final ExprParser parser = new ExprParser(tokens);
final ExprParser.parse_return ret = parser.parse();
return ret.e;
}
use of org.apache.drill.common.expression.parser.ExprLexer in project drill by axbaretto.
the class PhysicalOpUnitTestBase method parseExpr.
@Override
protected LogicalExpression parseExpr(String expr) {
ExprLexer lexer = new ExprLexer(new ANTLRStringStream(expr));
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExprParser parser = new ExprParser(tokens);
try {
return parser.parse().e;
} catch (RecognitionException e) {
throw new RuntimeException("Error parsing expression: " + expr);
}
}
use of org.apache.drill.common.expression.parser.ExprLexer in project drill by axbaretto.
the class TestBuilder method parsePath.
// modified code from SchemaPath.De class. This should be used sparingly and only in tests if absolutely needed.
public static SchemaPath parsePath(String path) {
try {
ExprLexer lexer = new ExprLexer(new ANTLRStringStream(path));
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExprParser parser = new ExprParser(tokens);
ExprParser.parse_return ret = parser.parse();
if (ret.e instanceof SchemaPath) {
return (SchemaPath) ret.e;
} else {
throw new IllegalStateException("Schema path is not a valid format.");
}
} catch (RecognitionException e) {
throw new RuntimeException(e);
}
}
Aggregations