julianhyde commented on a change in pull request #1031: CALCITE-2742: Update RexImpTable to use DataContext to retrieve USER and SYSTEM_USER URL: https://github.com/apache/calcite/pull/1031#discussion_r260952365
########## File path: core/src/test/java/org/apache/calcite/rex/RexExecutorTest.java ########## @@ -175,6 +177,58 @@ private void checkConstant(final Object operand, }); } + @Test public void testUserFromContext() throws Exception { + testContextLiteral(SqlStdOperatorTable.USER, + DataContext.Variable.USER, "happyCalciteUser"); + } + + @Test public void testSystemUserFromContext() throws Exception { + testContextLiteral(SqlStdOperatorTable.SYSTEM_USER, + DataContext.Variable.SYSTEM_USER, ""); + } + + @Test public void testTimestampFromContext() throws Exception { + // current timestamp currently rounds to the nearest second (?) + long val = System.currentTimeMillis() / 1000 * 1000; + testContextLiteral(SqlStdOperatorTable.CURRENT_TIMESTAMP, + DataContext.Variable.CURRENT_TIMESTAMP, val); + } + + /** + * Ensure that for a given context operator, the correct value is retrieved from the DataContext. Review comment: "Ensures" not "Ensure". ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services