[
https://issues.apache.org/jira/browse/PHOENIX-1639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14321042#comment-14321042
]
ASF GitHub Bot commented on PHOENIX-1639:
-----------------------------------------
Github user twdsilva commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/36#discussion_r24708850
--- Diff:
phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java ---
@@ -1493,5 +1493,77 @@ public void testMultiCFProjection() throws Exception
{
assertTrue(scan.getFilter() instanceof FirstKeyOnlyFilter);
assertEquals(1, scan.getFamilyMap().size());
}
+
+ @Test
+ public void testNonDeterministicExpressionIndex() throws Exception {
+ String ddl = "CREATE TABLE t (k1 INTEGER PRIMARY KEY)";
+ Connection conn = DriverManager.getConnection(getUrl());
+ Statement stmt = null;
+ try {
+ stmt = conn.createStatement();
+ stmt.execute(ddl);
+ stmt.execute("CREATE INDEX i ON t (RAND())");
+ fail();
+ } catch (SQLException e) {
+
assertEquals(SQLExceptionCode.NON_DETERMINISTIC_EXPRESSION_NOT_ALLOWED_IN_INDEX.getErrorCode(),
e.getErrorCode());
+ }
+ finally {
+ stmt.close();
+ }
+ }
+
+ @Test
+ public void testStatelessExpressionIndex() throws Exception {
+ String ddl = "CREATE TABLE t (k1 INTEGER PRIMARY KEY)";
+ Connection conn = DriverManager.getConnection(getUrl());
+ Statement stmt = null;
+ try {
+ stmt = conn.createStatement();
+ stmt.execute(ddl);
+ stmt.execute("CREATE INDEX i ON t (SUM())");
+ fail();
+ } catch (SQLException e) {
+
assertEquals(SQLExceptionCode.STATELESS_EXPRESSION_NOT_ALLOWED_IN_INDEX.getErrorCode(),
e.getErrorCode());
--- End diff --
I changed this to a constant expression.
> Enhance function/expression index tests
> ---------------------------------------
>
> Key: PHOENIX-1639
> URL: https://issues.apache.org/jira/browse/PHOENIX-1639
> Project: Phoenix
> Issue Type: Test
> Reporter: Thomas D'Silva
> Assignee: Thomas D'Silva
>
> Add tests for views, negative scenarios, sort order of expression.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)