kasakrisz commented on code in PR #3988:
URL: https://github.com/apache/hive/pull/3988#discussion_r1088657424
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java:
##########
@@ -1133,7 +1133,20 @@ private String processTable(QB qb, ASTNode tabref)
throws SemanticException {
if (asOfTimeIndex != -1 || asOfVersionIndex != -1) {
String asOfVersion = asOfVersionIndex == -1 ? null :
tabref.getChild(asOfVersionIndex).getChild(0).getText();
- String asOfTime = asOfTimeIndex == -1 ? null :
tabref.getChild(asOfTimeIndex).getChild(0).getText();
+ String asOfTime = null;
+
+ if (asOfTimeIndex != -1) {
+ ASTNode expr = (ASTNode) tabref.getChild(asOfTimeIndex).getChild(0);
+ if (expr.getChildCount() > 0) {
+ ExprNodeDesc desc = genExprNodeDesc(expr, null, false, true);
+ if (desc instanceof ExprNodeConstantDesc) {
+ ExprNodeConstantDesc c = (ExprNodeConstantDesc) desc;
+ asOfTime = String.valueOf(c.getValue());
+ }
Review Comment:
Should an exception be thrown if the expression can not be evaluated at
compile time?
It might be worth adding some negative test cases to cover this code path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]