ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [3/3] ignite git commit: Done.
Date Wed, 19 Apr 2017 16:37:39 GMT
Done.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/35e9bbdb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/35e9bbdb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/35e9bbdb

Branch: refs/heads/ignite-5033
Commit: 35e9bbdb6b4d93731906f5e61d660c29eb937430
Parents: 3db61e8
Author: devozerov <vozerov@gridgain.com>
Authored: Wed Apr 19 19:37:30 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Wed Apr 19 19:37:30 2017 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   |  2 +-
 .../query/h2/ddl/DdlStatementsProcessor.java    | 19 +++++++++++--------
 .../DynamicIndexAbstractBasicSelfTest.java      | 20 ++++++++++----------
 .../index/DynamicIndexAbstractSelfTest.java     |  2 +-
 4 files changed, 23 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/35e9bbdb/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 4f0a9f9..87b0d00 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1717,7 +1717,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
                     if (DdlStatementsProcessor.isDdlStatement(prepared)) {
                         try {
-                            return ddlProc.runDdlStatement(stmt);
+                            return ddlProc.runDdlStatement(sqlQry, stmt);
                         }
                         catch (IgniteCheckedException e) {
                             throw new IgniteSQLException("Failed to execute DDL statement
[stmt=" + sqlQry + ']', e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/35e9bbdb/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 5b4b494..949ea6a 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -71,10 +71,11 @@ public class DdlStatementsProcessor {
     /**
      * Execute DDL statement.
      *
+     * @param sql SQL.
      * @param stmt H2 statement to parse and execute.
      */
     @SuppressWarnings("unchecked")
-    public QueryCursor<List<?>> runDdlStatement(PreparedStatement stmt)
+    public QueryCursor<List<?>> runDdlStatement(String sql, PreparedStatement
stmt)
         throws IgniteCheckedException {
         assert stmt instanceof JdbcPreparedStatement;
 
@@ -99,8 +100,8 @@ public class DdlStatementsProcessor {
                 GridH2Table tbl = idx.dataTable(createIdx.schemaName(), createIdx.tableName());
 
                 if (tbl == null)
-                    throw new IgniteSQLException("Table not found [schemaName=" + createIdx.schemaName()
+ ", " +
-                        "tblName=" + createIdx.tableName() + ']', IgniteQueryErrorCode.TABLE_NOT_FOUND);
+                    throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND,
+                        createIdx.tableName());
 
                 assert tbl.rowDescriptor() != null;
 
@@ -111,8 +112,7 @@ public class DdlStatementsProcessor {
                     GridQueryProperty prop = typeDesc.property(e.getKey());
 
                     if (prop == null)
-                        throw new IgniteSQLException("Property not found [typeName=" + typeDesc.name()
+ ", propName=" +
-                            e.getKey() + ']');
+                        throw new SchemaOperationException(SchemaOperationException.CODE_COLUMN_NOT_FOUND,
e.getKey());
 
                     flds.put(prop.name(), e.getValue());
                 }
@@ -129,8 +129,8 @@ public class DdlStatementsProcessor {
                 fut = ctx.query().dynamicIndexDrop(spaceName, dropIdx.name(), dropIdx.ifExists());
             }
             else
-                throw new IgniteSQLException("Unexpected DDL operation [type=" + gridStmt.getClass()
+ ']',
-                    IgniteQueryErrorCode.UNEXPECTED_OPERATION);
+                throw new IgniteSQLException("Unsupported DDL operation: " + sql,
+                    IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
 
             fut.get();
 
@@ -144,8 +144,11 @@ public class DdlStatementsProcessor {
         catch (SchemaOperationException e) {
             throw convert(e);
         }
+        catch (IgniteSQLException e) {
+            throw e;
+        }
         catch (Exception e) {
-            throw new IgniteSQLException("DLL operation failed.", e);
+            throw new IgniteSQLException("Unexpected DLL operation failure: " + e.getMessage(),
e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/35e9bbdb/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
index 94dc831..fc3529b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractBasicSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.util.GridStringBuilder;
@@ -197,7 +198,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
             }
-        }, SchemaOperationException.CODE_INDEX_EXISTS);
+        }, IgniteQueryErrorCode.INDEX_ALREADY_EXISTS);
 
         dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
         assertIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1, field(FIELD_NAME_1));
@@ -437,7 +438,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 dynamicIndexCreate(CACHE_NAME, randomString(), idx, false);
             }
-        }, SchemaOperationException.CODE_TABLE_NOT_FOUND);
+        }, IgniteQueryErrorCode.TABLE_NOT_FOUND);
 
         assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
     }
@@ -513,7 +514,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
             }
-        }, SchemaOperationException.CODE_COLUMN_NOT_FOUND);
+        }, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
 
         assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
     }
@@ -590,7 +591,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
                 dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, false);
             }
-        }, SchemaOperationException.CODE_COLUMN_NOT_FOUND);
+        }, IgniteQueryErrorCode.COLUMN_NOT_FOUND);
 
         assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
 
@@ -757,7 +758,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, false);
             }
-        }, SchemaOperationException.CODE_INDEX_NOT_FOUND);
+        }, IgniteQueryErrorCode.INDEX_NOT_FOUND);
 
         dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
         assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
@@ -864,7 +865,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 dynamicIndexCreate(CACHE_NAME, TBL_NAME, idx, true);
             }
-        }, SchemaOperationException.CODE_GENERIC);
+        }, IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
 
         assertNoIndex(CACHE_NAME, TBL_NAME, IDX_NAME_1);
 
@@ -872,7 +873,7 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
             @Override public void run() throws Exception {
                 dynamicIndexDrop(CACHE_NAME, IDX_NAME_1, true);
             }
-        }, SchemaOperationException.CODE_GENERIC);
+        }, IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
     }
 
     /**
@@ -988,9 +989,8 @@ public abstract class DynamicIndexAbstractBasicSelfTest extends DynamicIndexAbst
 
             int code = cause0.statusCode();
 
-            // TODO: Re-enable.
-//            assertEquals("Unexpected error code [expected=" + expCode + ", actual=" + e.code()
+ ']',
-//                expCode, e.code());
+            assertEquals("Unexpected error code [expected=" + expCode + ", actual=" + code
+
+                ", msg=" + cause.getMessage() + ']', expCode, code);
 
             return;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/35e9bbdb/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
index caa3c07..1ed7426 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
@@ -359,7 +359,7 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
      * @return Random string.
      */
     protected static String randomString() {
-        return UUID.randomUUID().toString();
+        return "random" + UUID.randomUUID().toString().replace("-", "");
     }
 
     /**


Mime
View raw message