teiid SVN: r4390 - trunk/admin/src/main/java/org/teiid/adminapi/impl.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-31 15:28:05 -0400 (Fri, 31 Aug 2012)
New Revision: 4390
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
Log:
TEIID-2173 adding clearMessages
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-08-31 19:27:33 UTC (rev 4389)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-08-31 19:28:05 UTC (rev 4390)
@@ -236,10 +236,13 @@
}
public synchronized void clearRuntimeMessages() {
- if (runtimeMessages != null) {
- runtimeMessages = null;
- }
- }
+ runtimeMessages = null;
+ }
+
+ public synchronized void clearMessages() {
+ clearRuntimeMessages();
+ this.messages = null;
+ }
public static class Message implements Serializable{
private static final long serialVersionUID = 2044197069467559527L;
@@ -334,4 +337,6 @@
return allErrors;
}
+
+
}
12 years, 4 months
teiid SVN: r4389 - in trunk/test-integration/common/src/test/resources: TestMMDatabaseMetaData and 5 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-31 15:27:33 -0400 (Fri, 31 Aug 2012)
New Revision: 4389
Modified:
trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetColumns.expected
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRDEF.expected
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected
trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testColumns.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
trunk/test-integration/common/src/test/resources/TestVirtualDocWithVirtualProc/testDefect15241b.expected
Log:
TEIID-2166 TEIID-247 adding additional array support for internal consistency and pg emulation
Modified: trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestJDBCSocketTransport/testSelect.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -18,19 +18,19 @@
parts SYS Tables Table <null> true false tid:2cb59cfd55db-94dc2a85-00000083 -1 <null> true false 15
parts SYSADMIN VDBResources Table <null> true false tid:60b87e792634-1e9b1131-0000000b -1 <null> true false 18
parts SYS VirtualDatabases Table <null> true false tid:2cb59cfd55db-a9e11fad-00000091 -1 <null> true false 16
-parts pg_catalog matpg_datatype Table <null> false false tid:7ff2755e9621-e544c1cc-00000068 -1 <null> true true 19
-parts pg_catalog matpg_relatt Table <null> false false tid:7ff2755e9621-75d65150-0000005e -1 <null> true true 20
-parts pg_catalog pg_am Table <null> false false tid:7ff2755e9621-065a8b74-00000031 -1 <null> true false 21
-parts pg_catalog pg_attrdef Table <null> false false tid:7ff2755e9621-ec00662c-0000004a -1 <null> true false 22
+parts pg_catalog matpg_datatype Table <null> false false tid:7ff2755e9621-e544c1cc-00000069 -1 <null> true true 19
+parts pg_catalog matpg_relatt Table <null> false false tid:7ff2755e9621-75d65150-0000005f -1 <null> true true 20
+parts pg_catalog pg_am Table <null> false false tid:7ff2755e9621-065a8b74-00000032 -1 <null> true false 21
+parts pg_catalog pg_attrdef Table <null> false false tid:7ff2755e9621-ec00662c-0000004b -1 <null> true false 22
parts pg_catalog pg_attribute Table <null> false false tid:7ff2755e9621-edc4ea54-0000000f -1 <null> true true 23
parts pg_catalog pg_class Table <null> false false tid:7ff2755e9621-62e78530-00000004 -1 <null> true true 24
-parts pg_catalog pg_database Table <null> false false tid:7ff2755e9621-dda8fac3-0000004f -1 <null> true false 25
+parts pg_catalog pg_database Table <null> false false tid:7ff2755e9621-dda8fac3-00000050 -1 <null> true false 25
parts pg_catalog pg_index Table <null> false false tid:7ff2755e9621-633d048a-00000027 -1 <null> true true 26
parts pg_catalog pg_namespace Table <null> false false tid:7ff2755e9621-37a09513-00000001 -1 <null> true false 27
-parts pg_catalog pg_proc Table <null> false false tid:7ff2755e9621-d9ec709e-00000034 -1 <null> true true 28
-parts pg_catalog pg_trigger Table <null> false false tid:7ff2755e9621-d50d2370-00000040 -1 <null> true false 29
-parts pg_catalog pg_type Table <null> false false tid:7ff2755e9621-d9ee5c82-0000001b -1 <null> true false 30
-parts pg_catalog pg_user Table <null> false false tid:7ff2755e9621-d9eeb913-00000059 -1 <null> true false 31
+parts pg_catalog pg_proc Table <null> false false tid:7ff2755e9621-d9ec709e-00000035 -1 <null> true true 28
+parts pg_catalog pg_trigger Table <null> false false tid:7ff2755e9621-d50d2370-00000041 -1 <null> true false 29
+parts pg_catalog pg_type Table <null> false false tid:7ff2755e9621-d9ee5c82-0000001b -1 <null> true true 30
+parts pg_catalog pg_user Table <null> false false tid:7ff2755e9621-d9eeb913-0000005a -1 <null> true false 31
Row Count : 31
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 parts java.lang.String VDBName string SYS Tables 255 255 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetColumns.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetColumns.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -826,11 +826,12 @@
QT_Ora9DS pg_catalog pg_index oid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 1 YES <null> <null> <null> !
<null> NO
QT_Ora9DS pg_catalog pg_index indexrelid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 2 YES <null> <null> <null> !
<null> NO
QT_Ora9DS pg_catalog pg_index indrelid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 3 YES <null> <null> <null> !
<null> NO
-QT_Ora9DS pg_catalog pg_index indisclustered -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 4 YES <null> <null> <null> !
<null> NO
-QT_Ora9DS pg_catalog pg_index indisunique -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 5 YES <null> <null> <null> !
<null> NO
-QT_Ora9DS pg_catalog pg_index indisprimary -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 6 YES <null> <null> <null> !
<null> NO
-QT_Ora9DS pg_catalog pg_index indexprs 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 7 YES <null> <null> <null> !
<null> NO
-QT_Ora9DS pg_catalog pg_index indkey 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 8 YES <null> <null> <null> !
<null> NO
+QT_Ora9DS pg_catalog pg_index indnatts 5 short 5 <null> 0 10 1 <null> <null> <null> <null> 0 4 YES <null> <null> <null> !
<null> NO
+QT_Ora9DS pg_catalog pg_index indisclustered -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 5 YES <null> <null> <null> !
<null> NO
+QT_Ora9DS pg_catalog pg_index indisunique -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 6 YES <null> <null> <null> !
<null> NO
+QT_Ora9DS pg_catalog pg_index indisprimary -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 7 YES <null> <null> <null> !
<null> NO
+QT_Ora9DS pg_catalog pg_index indexprs 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 8 YES <null> <null> <null> !
<null> NO
+QT_Ora9DS pg_catalog pg_index indkey 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 9 YES <null> <null> <null> !
<null> NO
QT_Ora9DS pg_catalog pg_namespace oid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 1 YES <null> <null> <null> !
<null> NO
QT_Ora9DS pg_catalog pg_namespace nspname 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 2 YES <null> <null> <null> !
<null> NO
QT_Ora9DS pg_catalog pg_proc oid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 1 YES <null> <null> <null> !
<null> NO
@@ -1086,7 +1087,7 @@
QT_Ora9DS XQT xqtFullData BigIntegerValue 2 biginteger 19 <null> 0 10 1 <null> <null> <null> <null> 28 15 YES <null> <null> <null> !
<null> NO
QT_Ora9DS XQT xqtFullData BigDecimalValue 2 bigdecimal 20 <null> 0 10 1 <null> <null> <null> <null> 126 16 YES <null> <null> <null> !
<null> NO
QT_Ora9DS XQT xqtFullData ObjectValue 2000 object 2048 <null> 0 10 1 <null> <null> <null> <null> 2048 17 YES <null> <null> <null> !
<null> NO
-Row Count : 1086
+Row Count : 1087
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 QT_Ora9DS java.lang.String TABLE_CAT string SYS Columns 255 255 0 false true false false 0 true true false false
SchemaName 12 QT_Ora9DS java.lang.String TABLE_SCHEM string SYS Columns 255 255 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRDEF.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRDEF.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRDEF.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -218,6 +218,7 @@
26 6 <null> <null>
26 7 <null> <null>
26 8 <null> <null>
+26 9 <null> <null>
27 1 <null> <null>
27 2 <null> <null>
28 1 <null> <null>
@@ -254,7 +255,7 @@
31 2 <null> <null>
31 3 <null> <null>
31 4 <null> <null>
-Row Count : 254
+Row Count : 255
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
adrelid 4 PartsSupplier java.lang.Integer adrelid integer pg_catalog pg_attrdef 11 10 0 false false false false 1 true true true false
adnum 5 PartsSupplier java.lang.Short adnum short pg_catalog pg_attrdef 6 5 0 false false false false 1 true true true false
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_ATTRIBUTE.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -213,48 +213,49 @@
211 26 oid 23 4 1 8 false false false
212 26 indexrelid 23 4 2 8 false false false
213 26 indrelid 23 4 3 8 false false false
-214 26 indisclustered 16 1 4 5 false false false
-215 26 indisunique 16 1 5 5 false false false
-216 26 indisprimary 16 1 6 5 false false false
-217 26 indexprs 1043 -1 7 4004 false false false
-218 26 indkey 1043 -1 8 4004 false false false
-219 27 oid 23 4 1 8 false false false
-220 27 nspname 1043 -1 2 4004 false false false
-221 28 oid 23 4 1 8 false false false
-222 28 proname 1043 -1 2 4004 false false false
-223 28 proretset 16 1 3 5 false false false
-224 28 prorettype 23 4 4 8 false false false
-225 28 pronargs 21 2 5 6 false false false
-226 28 proargtypes 705 -2 6 -2147483645 false false false
-227 28 proargnames 705 -2 7 -2147483645 false false false
-228 28 proargmodes 705 -2 8 -2147483645 false false false
-229 28 proallargtypes 705 -2 9 -2147483645 false false false
-230 28 pronamespace 23 4 10 8 false false false
-231 29 oid 23 4 1 8 false false false
-232 29 tgconstrrelid 23 4 2 8 false false false
-233 29 tgfoid 23 4 3 8 false false false
-234 29 tgargs 23 4 4 8 false false false
-235 29 tgnargs 23 4 5 8 false false false
-236 29 tgdeferrable 16 1 6 5 false false false
-237 29 tginitdeferred 16 1 7 5 false false false
-238 29 tgconstrname 1043 -1 8 4004 false false false
-239 29 tgrelid 23 4 9 8 false false false
-240 30 oid 23 4 1 8 false false false
-241 30 typname 1043 -1 2 4004 false false false
-242 30 typnamespace 23 4 3 8 false false false
-243 30 typlen 21 2 4 6 false false false
-244 30 typtype 1042 1 5 5 false false false
-245 30 typnotnull 16 1 6 5 false false false
-246 30 typbasetype 23 4 7 8 false false false
-247 30 typtypmod 23 4 8 8 false false false
-248 30 typdelim 1042 1 9 5 false false false
-249 30 typrelid 23 4 10 8 false false false
-250 30 typelem 23 4 11 8 false false false
-251 31 oid 23 4 1 8 false false false
-252 31 usename 1043 -1 2 4004 false false false
-253 31 usecreatedb 16 1 3 5 false false false
-254 31 usesuper 16 1 4 5 false false false
-Row Count : 254
+214 26 indnatts 21 2 4 6 false false false
+215 26 indisclustered 16 1 5 5 false false false
+216 26 indisunique 16 1 6 5 false false false
+217 26 indisprimary 16 1 7 5 false false false
+218 26 indexprs 1043 -1 8 4004 false false false
+219 26 indkey 1043 -1 9 4004 false false false
+220 27 oid 23 4 1 8 false false false
+221 27 nspname 1043 -1 2 4004 false false false
+222 28 oid 23 4 1 8 false false false
+223 28 proname 1043 -1 2 4004 false false false
+224 28 proretset 16 1 3 5 false false false
+225 28 prorettype 23 4 4 8 false false false
+226 28 pronargs 21 2 5 6 false false false
+227 28 proargtypes 705 -2 6 -2147483645 false false false
+228 28 proargnames 705 -2 7 -2147483645 false false false
+229 28 proargmodes 705 -2 8 -2147483645 false false false
+230 28 proallargtypes 705 -2 9 -2147483645 false false false
+231 28 pronamespace 23 4 10 8 false false false
+232 29 oid 23 4 1 8 false false false
+233 29 tgconstrrelid 23 4 2 8 false false false
+234 29 tgfoid 23 4 3 8 false false false
+235 29 tgargs 23 4 4 8 false false false
+236 29 tgnargs 23 4 5 8 false false false
+237 29 tgdeferrable 16 1 6 5 false false false
+238 29 tginitdeferred 16 1 7 5 false false false
+239 29 tgconstrname 1043 -1 8 4004 false false false
+240 29 tgrelid 23 4 9 8 false false false
+241 30 oid 23 4 1 8 false false false
+242 30 typname 1043 -1 2 4004 false false false
+243 30 typnamespace 23 4 3 8 false false false
+244 30 typlen 21 2 4 6 false false false
+245 30 typtype 1042 1 5 5 false false false
+246 30 typnotnull 16 1 6 5 false false false
+247 30 typbasetype 23 4 7 8 false false false
+248 30 typtypmod 23 4 8 8 false false false
+249 30 typdelim 1042 1 9 5 false false false
+250 30 typrelid 23 4 10 8 false false false
+251 30 typelem 23 4 11 8 false false false
+252 31 oid 23 4 1 8 false false false
+253 31 usename 1043 -1 2 4004 false false false
+254 31 usecreatedb 16 1 3 5 false false false
+255 31 usesuper 16 1 4 5 false false false
+Row Count : 255
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
oid 4 PartsSupplier java.lang.Integer oid integer pg_catalog pg_attribute 11 10 0 false false false false 1 true true true false
attrelid 4 PartsSupplier java.lang.Integer attrelid integer pg_catalog pg_attribute 11 10 0 false false false false 1 true true true false
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_TYPE.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -36,7 +36,8 @@
1183 _time 2 -1 b false 0 -1 , 0 1083
2287 _record 2 -1 b false 0 -1 , 0 2249
2283 anyelement 2 4 p false 0 -1 , 0 0
-Row Count : 36
+22 int2vector 2 -1 b false 0 -1 , 0 0
+Row Count : 37
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
oid 4 PartsSupplier java.lang.Integer oid integer pg_catalog pg_type 11 10 0 false false false false 1 true true true false
typname 12 PartsSupplier java.lang.String typname string pg_catalog pg_type 4000 4000 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestODBCSocketTransport/testSelect.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -18,19 +18,19 @@
parts SYS Tables Table <null> true false tid:2cb59cfd55db-94dc2a85-00000083 -1 <null> true false 15
parts SYSADMIN VDBResources Table <null> true false tid:60b87e792634-1e9b1131-0000000b -1 <null> true false 18
parts SYS VirtualDatabases Table <null> true false tid:2cb59cfd55db-a9e11fad-00000091 -1 <null> true false 16
-parts pg_catalog matpg_datatype Table <null> false false tid:7ff2755e9621-e544c1cc-00000068 -1 <null> true true 19
-parts pg_catalog matpg_relatt Table <null> false false tid:7ff2755e9621-75d65150-0000005e -1 <null> true true 20
-parts pg_catalog pg_am Table <null> false false tid:7ff2755e9621-065a8b74-00000031 -1 <null> true false 21
-parts pg_catalog pg_attrdef Table <null> false false tid:7ff2755e9621-ec00662c-0000004a -1 <null> true false 22
+parts pg_catalog matpg_datatype Table <null> false false tid:7ff2755e9621-e544c1cc-00000069 -1 <null> true true 19
+parts pg_catalog matpg_relatt Table <null> false false tid:7ff2755e9621-75d65150-0000005f -1 <null> true true 20
+parts pg_catalog pg_am Table <null> false false tid:7ff2755e9621-065a8b74-00000032 -1 <null> true false 21
+parts pg_catalog pg_attrdef Table <null> false false tid:7ff2755e9621-ec00662c-0000004b -1 <null> true false 22
parts pg_catalog pg_attribute Table <null> false false tid:7ff2755e9621-edc4ea54-0000000f -1 <null> true true 23
parts pg_catalog pg_class Table <null> false false tid:7ff2755e9621-62e78530-00000004 -1 <null> true true 24
-parts pg_catalog pg_database Table <null> false false tid:7ff2755e9621-dda8fac3-0000004f -1 <null> true false 25
+parts pg_catalog pg_database Table <null> false false tid:7ff2755e9621-dda8fac3-00000050 -1 <null> true false 25
parts pg_catalog pg_index Table <null> false false tid:7ff2755e9621-633d048a-00000027 -1 <null> true true 26
parts pg_catalog pg_namespace Table <null> false false tid:7ff2755e9621-37a09513-00000001 -1 <null> true false 27
-parts pg_catalog pg_proc Table <null> false false tid:7ff2755e9621-d9ec709e-00000034 -1 <null> true true 28
-parts pg_catalog pg_trigger Table <null> false false tid:7ff2755e9621-d50d2370-00000040 -1 <null> true false 29
-parts pg_catalog pg_type Table <null> false false tid:7ff2755e9621-d9ee5c82-0000001b -1 <null> true false 30
-parts pg_catalog pg_user Table <null> false false tid:7ff2755e9621-d9eeb913-00000059 -1 <null> true false 31
+parts pg_catalog pg_proc Table <null> false false tid:7ff2755e9621-d9ec709e-00000035 -1 <null> true true 28
+parts pg_catalog pg_trigger Table <null> false false tid:7ff2755e9621-d50d2370-00000041 -1 <null> true false 29
+parts pg_catalog pg_type Table <null> false false tid:7ff2755e9621-d9ee5c82-0000001b -1 <null> true true 30
+parts pg_catalog pg_user Table <null> false false tid:7ff2755e9621-d9eeb913-0000005a -1 <null> true false 31
Row Count : 31
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
vdbname 12 java.lang.String vdbname varchar 255 255 0 false true false false 1 false true false true
Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testColumns.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testColumns.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -213,11 +213,12 @@
PartsSupplier pg_catalog pg_index oid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 1 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_index indexrelid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 2 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_index indrelid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 3 YES <null> <null> <null> !
<null> NO
-PartsSupplier pg_catalog pg_index indisclustered -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 4 YES <null> <null> <null> !
<null> NO
-PartsSupplier pg_catalog pg_index indisunique -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 5 YES <null> <null> <null> !
<null> NO
-PartsSupplier pg_catalog pg_index indisprimary -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 6 YES <null> <null> <null> !
<null> NO
-PartsSupplier pg_catalog pg_index indexprs 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 7 YES <null> <null> <null> !
<null> NO
-PartsSupplier pg_catalog pg_index indkey 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 8 YES <null> <null> <null> !
<null> NO
+PartsSupplier pg_catalog pg_index indnatts 5 short 5 <null> 0 10 1 <null> <null> <null> <null> 0 4 YES <null> <null> <null> !
<null> NO
+PartsSupplier pg_catalog pg_index indisclustered -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 5 YES <null> <null> <null> !
<null> NO
+PartsSupplier pg_catalog pg_index indisunique -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 6 YES <null> <null> <null> !
<null> NO
+PartsSupplier pg_catalog pg_index indisprimary -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 7 YES <null> <null> <null> !
<null> NO
+PartsSupplier pg_catalog pg_index indexprs 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 8 YES <null> <null> <null> !
<null> NO
+PartsSupplier pg_catalog pg_index indkey 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 9 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_namespace oid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 1 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_namespace nspname 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 2 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_proc oid 4 integer 10 <null> 0 10 1 <null> <null> <null> <null> 0 1 YES <null> <null> <null> !
<null> NO
@@ -254,7 +255,7 @@
PartsSupplier pg_catalog pg_user usename 12 string 4000 <null> 0 0 1 <null> <null> <null> <null> 0 2 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_user usecreatedb -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 3 YES <null> <null> <null> !
<null> NO
PartsSupplier pg_catalog pg_user usesuper -7 boolean 1 <null> 0 10 1 <null> <null> <null> <null> 0 4 YES <null> <null> <null> !
<null> NO
-Row Count : 254
+Row Count : 255
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String TABLE_CAT string SYS Columns 255 255 0 false true false false 0 true true false false
SchemaName 12 PartsSupplier java.lang.String TABLE_SCHEM string SYS Columns 255 255 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testColumns.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -162,99 +162,100 @@
PartsSupplier SYSADMIN MatViews Valid 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:60b87e792634-db64!
21d6-00000007 <null> 159
PartsSupplier SYS Properties Value 2 <null> string 0 255 false true false true false false false No Nulls <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:2cb59cfd55db-0fb9!
2c5d-00000068 <null> 114
PartsSupplier SYS VirtualDatabases Version 2 <null> string 0 50 false true false true false false false No Nulls <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:2cb59cfd55db-27fe!
e087-00000093 <null> 153
-PartsSupplier pg_catalog pg_attrdef adbin 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-b094!
89b6-0000004d <null> 181
-PartsSupplier pg_catalog pg_attrdef adnum 2 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-b094!
b835-0000004c <null> 180
-PartsSupplier pg_catalog pg_attrdef adrelid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-6765!
c4e3-0000004b <null> 179
-PartsSupplier pg_catalog pg_attrdef adsrc 4 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-b094!
ca93-0000004e <null> 182
-PartsSupplier pg_catalog pg_am amname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-a44d!
26e2-00000033 <null> 178
+PartsSupplier pg_catalog pg_attrdef adbin 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-b094!
89d5-0000004e <null> 181
+PartsSupplier pg_catalog pg_attrdef adnum 2 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-b094!
b854-0000004d <null> 180
+PartsSupplier pg_catalog pg_attrdef adrelid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-6765!
c502-0000004c <null> 179
+PartsSupplier pg_catalog pg_attrdef adsrc 4 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-b094!
cab2-0000004f <null> 182
+PartsSupplier pg_catalog pg_am amname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-a44d!
2701-00000034 <null> 178
PartsSupplier pg_catalog pg_attribute atthasdef 10 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-8b55!
8751-00000019 <null> 192
PartsSupplier pg_catalog pg_attribute attisdropped 9 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-9c40!
981a-00000018 <null> 191
PartsSupplier pg_catalog pg_attribute attlen 5 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-4826!
ae19-00000014 <null> 187
-PartsSupplier pg_catalog matpg_relatt attname 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-81f4!
e333-00000061 <null> 172
+PartsSupplier pg_catalog matpg_relatt attname 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-81f4!
e352-00000062 <null> 172
PartsSupplier pg_catalog pg_attribute attname 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-73cc!
52f1-00000012 <null> 185
PartsSupplier pg_catalog pg_attribute attnotnull 8 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-ebd3!
e35e-00000017 <null> 190
-PartsSupplier pg_catalog matpg_relatt attnum 2 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-564f!
47cc-00000060 <null> 171
+PartsSupplier pg_catalog matpg_relatt attnum 2 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-564f!
47eb-00000061 <null> 171
PartsSupplier pg_catalog pg_attribute attnum 6 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-4826!
b78a-00000015 <null> 188
-PartsSupplier pg_catalog matpg_relatt attrelid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-cb3d!
2bfa-0000005f <null> 170
+PartsSupplier pg_catalog matpg_relatt attrelid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-cb3d!
2c19-00000060 <null> 170
PartsSupplier pg_catalog pg_attribute attrelid 2 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-bd14!
9bb8-00000011 <null> 184
PartsSupplier pg_catalog pg_attribute atttypid 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-bd39!
f12a-00000013 <null> 186
PartsSupplier pg_catalog pg_attribute atttypmod 7 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-a120!
a8bd-00000016 <null> 189
-PartsSupplier pg_catalog matpg_relatt autoinc 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-83aa!
4e56-00000064 <null> 175
+PartsSupplier pg_catalog matpg_relatt autoinc 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-83aa!
4e75-00000065 <null> 175
PartsSupplier SYSADMIN VDBResources contents 2 <null> blob 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> org.teiid.core.types.BlobType 0 0 0 tid:60b87e792634-2c5e!
89f3-0000000d <null> 164
-PartsSupplier pg_catalog pg_database datacl 7 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-dad6!
37f3-00000056 <null> 208
-PartsSupplier pg_catalog pg_database datallowconn 5 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-5e2b!
9a9e-00000054 <null> 206
-PartsSupplier pg_catalog pg_database datconfig 6 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-1944!
37f9-00000055 <null> 207
-PartsSupplier pg_catalog pg_database datdba 8 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-dad6!
430c-00000057 <null> 209
-PartsSupplier pg_catalog pg_database datlastsysoid 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-6243!
db2a-00000053 <null> 205
-PartsSupplier pg_catalog pg_database datname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-80af!
d902-00000051 <null> 203
-PartsSupplier pg_catalog pg_database dattablespace 9 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-5f2f!
972f-00000058 <null> 210
-PartsSupplier pg_catalog pg_database encoding 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-90a3!
abb3-00000052 <null> 204
-PartsSupplier pg_catalog pg_index indexprs 7 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-3c90!
62a5-0000002e <null> 217
+PartsSupplier pg_catalog pg_database datacl 7 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-dad6!
352a-00000057 <null> 208
+PartsSupplier pg_catalog pg_database datallowconn 5 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-5e2b!
97d5-00000055 <null> 206
+PartsSupplier pg_catalog pg_database datconfig 6 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-1944!
3530-00000056 <null> 207
+PartsSupplier pg_catalog pg_database datdba 8 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-dad6!
4043-00000058 <null> 209
+PartsSupplier pg_catalog pg_database datlastsysoid 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-6243!
d861-00000054 <null> 205
+PartsSupplier pg_catalog pg_database datname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-80af!
d639-00000052 <null> 203
+PartsSupplier pg_catalog pg_database dattablespace 9 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-5f2f!
9466-00000059 <null> 210
+PartsSupplier pg_catalog pg_database encoding 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-90a3!
a8ea-00000053 <null> 204
+PartsSupplier pg_catalog pg_index indexprs 8 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-3c90!
62a5-0000002f <null> 218
PartsSupplier pg_catalog pg_index indexrelid 2 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-6368!
efe8-00000029 <null> 212
-PartsSupplier pg_catalog pg_index indisclustered 4 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-47ce!
22f6-0000002b <null> 214
-PartsSupplier pg_catalog pg_index indisprimary 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-2c22!
f29f-0000002d <null> 216
-PartsSupplier pg_catalog pg_index indisunique 5 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-56a1!
3c60-0000002c <null> 215
-PartsSupplier pg_catalog pg_index indkey 8 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-ef45!
6826-0000002f <null> 218
+PartsSupplier pg_catalog pg_index indisclustered 5 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-47ce!
22f6-0000002c <null> 215
+PartsSupplier pg_catalog pg_index indisprimary 7 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-2c22!
f29f-0000002e <null> 217
+PartsSupplier pg_catalog pg_index indisunique 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-56a1!
3c60-0000002d <null> 216
+PartsSupplier pg_catalog pg_index indkey 9 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-ef45!
6826-00000030 <null> 219
+PartsSupplier pg_catalog pg_index indnatts 4 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-3d04!
d0e7-0000002b <null> 214
PartsSupplier pg_catalog pg_index indrelid 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-3d3e!
e0fb-0000002a <null> 213
-PartsSupplier pg_catalog matpg_datatype name 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-9edf!
60b7-0000006b <null> 167
-PartsSupplier pg_catalog matpg_relatt nspname 5 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-2fb8!
aedd-00000063 <null> 174
-PartsSupplier pg_catalog pg_namespace nspname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-e055!
7576-00000003 <null> 220
-PartsSupplier pg_catalog matpg_datatype oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9ead!
93f6-00000069 <null> 165
-PartsSupplier pg_catalog pg_am oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-f895!
43f5-00000032 <null> 177
+PartsSupplier pg_catalog matpg_datatype name 3 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-9edf!
60d6-0000006c <null> 167
+PartsSupplier pg_catalog matpg_relatt nspname 5 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-2fb8!
aefc-00000064 <null> 174
+PartsSupplier pg_catalog pg_namespace nspname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-e055!
7576-00000003 <null> 221
+PartsSupplier pg_catalog matpg_datatype oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9ead!
9415-0000006a <null> 165
+PartsSupplier pg_catalog pg_am oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-f895!
4414-00000033 <null> 177
PartsSupplier pg_catalog pg_attribute oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9c09!
440f-00000010 <null> 183
PartsSupplier pg_catalog pg_class oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-7f51!
b3be-00000005 <null> 193
-PartsSupplier pg_catalog pg_database oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-2aa6!
2c2a-00000050 <null> 202
+PartsSupplier pg_catalog pg_database oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-2aa6!
2961-00000051 <null> 202
PartsSupplier pg_catalog pg_index oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-35dd!
0fd0-00000028 <null> 211
-PartsSupplier pg_catalog pg_namespace oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-5ace!
9aea-00000002 <null> 219
-PartsSupplier pg_catalog pg_proc oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-eef9!
add1-00000035 <null> 221
-PartsSupplier pg_catalog pg_trigger oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-d272!
8add-00000041 <null> 231
-PartsSupplier pg_catalog pg_type oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-b1cd!
f706-0000001c <null> 240
-PartsSupplier pg_catalog pg_user oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-a354!
8e04-0000005a <null> 251
-PartsSupplier pg_catalog pg_proc proallargtypes 9 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-f418!
fbbe-0000003d <null> 229
-PartsSupplier pg_catalog pg_proc proargmodes 8 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-c636!
3c4e-0000003c <null> 228
-PartsSupplier pg_catalog pg_proc proargnames 7 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-c63e!
1866-0000003b <null> 227
-PartsSupplier pg_catalog pg_proc proargtypes 6 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-c69d!
9997-0000003a <null> 226
-PartsSupplier pg_catalog pg_proc proname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-dc8a!
0ebf-00000036 <null> 222
-PartsSupplier pg_catalog pg_proc pronamespace 10 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-d103!
5555-0000003e <null> 230
-PartsSupplier pg_catalog pg_proc pronargs 5 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-b3a7!
dbc5-00000039 <null> 225
-PartsSupplier pg_catalog pg_proc proretset 3 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-c750!
7115-00000037 <null> 223
-PartsSupplier pg_catalog pg_proc prorettype 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-21ae!
7015-00000038 <null> 224
+PartsSupplier pg_catalog pg_namespace oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-5ace!
9aea-00000002 <null> 220
+PartsSupplier pg_catalog pg_proc oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-eef9!
adf0-00000036 <null> 222
+PartsSupplier pg_catalog pg_trigger oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-d272!
8afc-00000042 <null> 232
+PartsSupplier pg_catalog pg_type oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-b1cd!
f706-0000001c <null> 241
+PartsSupplier pg_catalog pg_user oid 1 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-a354!
92dc-0000005b <null> 252
+PartsSupplier pg_catalog pg_proc proallargtypes 9 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-f418!
fbdd-0000003e <null> 230
+PartsSupplier pg_catalog pg_proc proargmodes 8 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-c636!
3c6d-0000003d <null> 229
+PartsSupplier pg_catalog pg_proc proargnames 7 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-c63e!
1885-0000003c <null> 228
+PartsSupplier pg_catalog pg_proc proargtypes 6 <null> object 0 2147483647 false true false false false false false Nullable <null> <null> -1 -1 Unsearchable <null> <null> java.lang.Object 0 0 0 tid:7ff2755e9621-c69d!
99b6-0000003b <null> 227
+PartsSupplier pg_catalog pg_proc proname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-dc8a!
0ede-00000037 <null> 223
+PartsSupplier pg_catalog pg_proc pronamespace 10 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-d103!
5574-0000003f <null> 231
+PartsSupplier pg_catalog pg_proc pronargs 5 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-b3a7!
dbe4-0000003a <null> 226
+PartsSupplier pg_catalog pg_proc proretset 3 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-c750!
7134-00000038 <null> 224
+PartsSupplier pg_catalog pg_proc prorettype 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-21ae!
7034-00000039 <null> 225
PartsSupplier pg_catalog pg_class relam 5 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-85c6!
0879-00000009 <null> 197
PartsSupplier pg_catalog pg_class relhasoids 9 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-c399!
e0be-0000000d <null> 201
PartsSupplier pg_catalog pg_class relhasrules 8 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-c471!
5c2a-0000000c <null> 200
PartsSupplier pg_catalog pg_class relkind 4 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-c054!
05a1-00000008 <null> 196
-PartsSupplier pg_catalog matpg_relatt relname 4 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-eb35!
652b-00000062 <null> 173
+PartsSupplier pg_catalog matpg_relatt relname 4 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-eb35!
654a-00000063 <null> 173
PartsSupplier pg_catalog pg_class relname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-c055!
4498-00000006 <null> 194
PartsSupplier pg_catalog pg_class relnamespace 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-0445!
3ed6-00000007 <null> 195
PartsSupplier pg_catalog pg_class relpages 7 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-5f0e!
b4bf-0000000b <null> 199
PartsSupplier pg_catalog pg_class reltuples 6 <null> float 3 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Float 7 0 10 tid:7ff2755e9621-9f58!
9978-0000000a <null> 198
PartsSupplier SYSADMIN VDBResources resourcePath 1 <null> string 0 255 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:60b87e792634-3744!
142c-0000000c <null> 163
-PartsSupplier pg_catalog pg_trigger tgargs 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9e3c!
4ae3-00000044 <null> 234
-PartsSupplier pg_catalog pg_trigger tgconstrname 8 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-2ba0!
9840-00000048 <null> 238
-PartsSupplier pg_catalog pg_trigger tgconstrrelid 2 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9f72!
b425-00000042 <null> 232
-PartsSupplier pg_catalog pg_trigger tgdeferrable 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-2e2d!
7860-00000046 <null> 236
-PartsSupplier pg_catalog pg_trigger tgfoid 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9e3e!
85aa-00000043 <null> 233
-PartsSupplier pg_catalog pg_trigger tginitdeferred 7 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-cb89!
33f5-00000047 <null> 237
-PartsSupplier pg_catalog pg_trigger tgnargs 5 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-80c2!
c8cb-00000045 <null> 235
-PartsSupplier pg_catalog pg_trigger tgrelid 9 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-80fc!
e1f4-00000049 <null> 239
-PartsSupplier pg_catalog pg_type typbasetype 7 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-1787!
1652-00000022 <null> 246
-PartsSupplier pg_catalog pg_type typdelim 9 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-8976!
2000-00000024 <null> 248
-PartsSupplier pg_catalog pg_type typelem 11 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-7ef3!
59d6-00000026 <null> 250
-PartsSupplier pg_catalog matpg_datatype typlen 5 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-6b7b!
b5d6-0000006d <null> 169
-PartsSupplier pg_catalog pg_type typlen 4 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-7e9c!
18e6-0000001f <null> 243
-PartsSupplier pg_catalog matpg_datatype typname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-6bd6!
e5c2-0000006a <null> 166
-PartsSupplier pg_catalog pg_type typname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-7ef7!
48d2-0000001d <null> 241
-PartsSupplier pg_catalog pg_type typnamespace 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-b928!
886c-0000001e <null> 242
-PartsSupplier pg_catalog pg_type typnotnull 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-68dd!
732b-00000021 <null> 245
-PartsSupplier pg_catalog matpg_relatt typoid 7 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-7700!
01e6-00000065 <null> 176
-PartsSupplier pg_catalog pg_type typrelid 10 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-8a3b!
6905-00000025 <null> 249
-PartsSupplier pg_catalog pg_type typtype 5 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-7efa!
5d81-00000020 <null> 244
-PartsSupplier pg_catalog pg_type typtypmod 8 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-ebc6!
8c1e-00000023 <null> 247
-PartsSupplier pg_catalog matpg_datatype uid 4 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-9ead!
aa7c-0000006c <null> 168
-PartsSupplier pg_catalog pg_user usecreatedb 3 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-5857!
8d3b-0000005c <null> 253
-PartsSupplier pg_catalog pg_user usename 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-9a8c!
04cc-0000005b <null> 252
-PartsSupplier pg_catalog pg_user usesuper 4 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-938d!
e68e-0000005d <null> 254
-Row Count : 254
+PartsSupplier pg_catalog pg_trigger tgargs 4 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9e3c!
4b02-00000045 <null> 235
+PartsSupplier pg_catalog pg_trigger tgconstrname 8 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-2ba0!
985f-00000049 <null> 239
+PartsSupplier pg_catalog pg_trigger tgconstrrelid 2 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9f72!
b444-00000043 <null> 233
+PartsSupplier pg_catalog pg_trigger tgdeferrable 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-2e2d!
787f-00000047 <null> 237
+PartsSupplier pg_catalog pg_trigger tgfoid 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-9e3e!
85c9-00000044 <null> 234
+PartsSupplier pg_catalog pg_trigger tginitdeferred 7 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-cb89!
3414-00000048 <null> 238
+PartsSupplier pg_catalog pg_trigger tgnargs 5 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-80c2!
c8ea-00000046 <null> 236
+PartsSupplier pg_catalog pg_trigger tgrelid 9 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-80fc!
e213-0000004a <null> 240
+PartsSupplier pg_catalog pg_type typbasetype 7 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-1787!
1652-00000022 <null> 247
+PartsSupplier pg_catalog pg_type typdelim 9 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-8976!
2000-00000024 <null> 249
+PartsSupplier pg_catalog pg_type typelem 11 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-7ef3!
59d6-00000026 <null> 251
+PartsSupplier pg_catalog matpg_datatype typlen 5 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-6b7b!
b5f5-0000006e <null> 169
+PartsSupplier pg_catalog pg_type typlen 4 <null> short 0 2 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Short 5 0 10 tid:7ff2755e9621-7e9c!
18e6-0000001f <null> 244
+PartsSupplier pg_catalog matpg_datatype typname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-6bd6!
e5e1-0000006b <null> 166
+PartsSupplier pg_catalog pg_type typname 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-7ef7!
48d2-0000001d <null> 242
+PartsSupplier pg_catalog pg_type typnamespace 3 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-b928!
886c-0000001e <null> 243
+PartsSupplier pg_catalog pg_type typnotnull 6 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-68dd!
732b-00000021 <null> 246
+PartsSupplier pg_catalog matpg_relatt typoid 7 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-7700!
0205-00000066 <null> 176
+PartsSupplier pg_catalog pg_type typrelid 10 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-8a3b!
6905-00000025 <null> 250
+PartsSupplier pg_catalog pg_type typtype 5 <null> char 0 1 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Character 0 0 0 tid:7ff2755e9621-7efa!
5d81-00000020 <null> 245
+PartsSupplier pg_catalog pg_type typtypmod 8 <null> integer 0 4 false true false false true false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Integer 10 0 10 tid:7ff2755e9621-ebc6!
8c1e-00000023 <null> 248
+PartsSupplier pg_catalog matpg_datatype uid 4 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-9ead!
aa9b-0000006d <null> 168
+PartsSupplier pg_catalog pg_user usecreatedb 3 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-5857!
9213-0000005d <null> 254
+PartsSupplier pg_catalog pg_user usename 2 <null> string 0 4000 false true false true false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 tid:7ff2755e9621-9a8c!
09a4-0000005c <null> 253
+PartsSupplier pg_catalog pg_user usesuper 4 <null> boolean 0 1 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.Boolean 1 0 10 tid:7ff2755e9621-938d!
eb66-0000005e <null> 255
+Row Count : 255
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String VDBName string SYS Columns 255 255 0 false true false false 0 true true false false
SchemaName 12 PartsSupplier java.lang.String SchemaName string SYS Columns 255 255 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeyColumns.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -9,19 +9,19 @@
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER SUPPLIER_ID PK_SUPPLIER Primary <null> mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590 1 4
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER_PARTS SUPPLIER_ID PK_SUPPLIER_PARTS Primary <null> mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590 1 6
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER SUPPLIER_STATUS FK_SPLIER_STATS Foreign mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590 mmuuid:5ac43c00-73ff-1edc-a81c-ecf397b10590 1 5
-PartsSupplier pg_catalog matpg_relatt attname pk_matpg_relatt_names Primary <null> tid:7ff2755e9621-965abee4-00000066 1 14
-PartsSupplier pg_catalog matpg_relatt attnum idx_matpg_relatt_ids Index <null> tid:7ff2755e9621-2a649312-00000067 2 18
-PartsSupplier pg_catalog matpg_relatt attrelid idx_matpg_relatt_ids Index <null> tid:7ff2755e9621-2a649312-00000067 1 17
-PartsSupplier pg_catalog matpg_datatype name matpg_datatype_names Primary <null> tid:7ff2755e9621-e36b5941-0000006e 2 11
-PartsSupplier pg_catalog matpg_relatt nspname pk_matpg_relatt_names Primary <null> tid:7ff2755e9621-965abee4-00000066 3 16
-PartsSupplier pg_catalog matpg_datatype oid matpg_datatype_ids Index <null> tid:7ff2755e9621-ed0fa7f1-0000006f 2 13
-PartsSupplier pg_catalog matpg_datatype oid matpg_datatype_names Primary <null> tid:7ff2755e9621-e36b5941-0000006e 1 10
+PartsSupplier pg_catalog matpg_relatt attname pk_matpg_relatt_names Primary <null> tid:7ff2755e9621-965abf03-00000067 1 14
+PartsSupplier pg_catalog matpg_relatt attnum idx_matpg_relatt_ids Index <null> tid:7ff2755e9621-2a649331-00000068 2 18
+PartsSupplier pg_catalog matpg_relatt attrelid idx_matpg_relatt_ids Index <null> tid:7ff2755e9621-2a649331-00000068 1 17
+PartsSupplier pg_catalog matpg_datatype name matpg_datatype_names Primary <null> tid:7ff2755e9621-e36b5960-0000006f 2 11
+PartsSupplier pg_catalog matpg_relatt nspname pk_matpg_relatt_names Primary <null> tid:7ff2755e9621-965abf03-00000067 3 16
+PartsSupplier pg_catalog matpg_datatype oid matpg_datatype_ids Index <null> tid:7ff2755e9621-ed0fa810-00000070 2 13
+PartsSupplier pg_catalog matpg_datatype oid matpg_datatype_names Primary <null> tid:7ff2755e9621-e36b5960-0000006f 1 10
PartsSupplier pg_catalog pg_attribute oid pk_pg_attr Primary <null> tid:7ff2755e9621-db38c73a-0000001a 1 19
PartsSupplier pg_catalog pg_class oid pk_pg_class Primary <null> tid:7ff2755e9621-265d38e8-0000000e 1 20
-PartsSupplier pg_catalog pg_index oid pk_pg_index Primary <null> tid:7ff2755e9621-dd3e1454-00000030 1 21
-PartsSupplier pg_catalog pg_proc oid pk_pg_proc Primary <null> tid:7ff2755e9621-2e2ffa61-0000003f 1 22
-PartsSupplier pg_catalog matpg_relatt relname pk_matpg_relatt_names Primary <null> tid:7ff2755e9621-965abee4-00000066 2 15
-PartsSupplier pg_catalog matpg_datatype typname matpg_datatype_ids Index <null> tid:7ff2755e9621-ed0fa7f1-0000006f 1 12
+PartsSupplier pg_catalog pg_index oid pk_pg_index Primary <null> tid:7ff2755e9621-dd3e1454-00000031 1 21
+PartsSupplier pg_catalog pg_proc oid pk_pg_proc Primary <null> tid:7ff2755e9621-2e2ffa80-00000040 1 22
+PartsSupplier pg_catalog matpg_relatt relname pk_matpg_relatt_names Primary <null> tid:7ff2755e9621-965abf03-00000067 2 15
+PartsSupplier pg_catalog matpg_datatype typname matpg_datatype_ids Index <null> tid:7ff2755e9621-ed0fa810-00000070 1 12
Row Count : 22
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String VDBName string SYS KeyColumns 255 255 0 false true false false 0 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testKeys.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -8,14 +8,14 @@
PartsSupplier PartsSupplier PARTSSUPPLIER.STATUS PK_STATUS <null> <null> Primary false <null> mmuuid:25a8a740-73ff-1edc-a81c-ecf397b10590 3
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER PK_SUPPLIER <null> <null> Primary false <null> mmuuid:375c8380-73ff-1edc-a81c-ecf397b10590 4
PartsSupplier PartsSupplier PARTSSUPPLIER.SUPPLIER_PARTS PK_SUPPLIER_PARTS <null> <null> Primary false <null> mmuuid:455e5440-73ff-1edc-a81c-ecf397b10590 6
-PartsSupplier pg_catalog matpg_relatt idx_matpg_relatt_ids <null> <null> Index false <null> tid:7ff2755e9621-2a649312-00000067 12
-PartsSupplier pg_catalog matpg_datatype matpg_datatype_ids <null> <null> Index false <null> tid:7ff2755e9621-ed0fa7f1-0000006f 10
-PartsSupplier pg_catalog matpg_datatype matpg_datatype_names <null> <null> Primary false <null> tid:7ff2755e9621-e36b5941-0000006e 9
-PartsSupplier pg_catalog matpg_relatt pk_matpg_relatt_names <null> <null> Primary false <null> tid:7ff2755e9621-965abee4-00000066 11
+PartsSupplier pg_catalog matpg_relatt idx_matpg_relatt_ids <null> <null> Index false <null> tid:7ff2755e9621-2a649331-00000068 12
+PartsSupplier pg_catalog matpg_datatype matpg_datatype_ids <null> <null> Index false <null> tid:7ff2755e9621-ed0fa810-00000070 10
+PartsSupplier pg_catalog matpg_datatype matpg_datatype_names <null> <null> Primary false <null> tid:7ff2755e9621-e36b5960-0000006f 9
+PartsSupplier pg_catalog matpg_relatt pk_matpg_relatt_names <null> <null> Primary false <null> tid:7ff2755e9621-965abf03-00000067 11
PartsSupplier pg_catalog pg_attribute pk_pg_attr <null> <null> Primary false <null> tid:7ff2755e9621-db38c73a-0000001a 13
PartsSupplier pg_catalog pg_class pk_pg_class <null> <null> Primary false <null> tid:7ff2755e9621-265d38e8-0000000e 14
-PartsSupplier pg_catalog pg_index pk_pg_index <null> <null> Primary false <null> tid:7ff2755e9621-dd3e1454-00000030 15
-PartsSupplier pg_catalog pg_proc pk_pg_proc <null> <null> Primary false <null> tid:7ff2755e9621-2e2ffa61-0000003f 16
+PartsSupplier pg_catalog pg_index pk_pg_index <null> <null> Primary false <null> tid:7ff2755e9621-dd3e1454-00000031 15
+PartsSupplier pg_catalog pg_proc pk_pg_proc <null> <null> Primary false <null> tid:7ff2755e9621-2e2ffa80-00000040 16
Row Count : 16
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String VDBName string SYS Keys 255 255 0 false true false false 0 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testTables.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -18,19 +18,19 @@
PartsSupplier SYS Tables Table <null> true false tid:2cb59cfd55db-94dc2a85-00000083 -1 <null> true false 15
PartsSupplier SYSADMIN VDBResources Table <null> true false tid:60b87e792634-1e9b1131-0000000b -1 <null> true false 18
PartsSupplier SYS VirtualDatabases Table <null> true false tid:2cb59cfd55db-a9e11fad-00000091 -1 <null> true false 16
-PartsSupplier pg_catalog matpg_datatype Table <null> false false tid:7ff2755e9621-e544c1cc-00000068 -1 <null> true true 19
-PartsSupplier pg_catalog matpg_relatt Table <null> false false tid:7ff2755e9621-75d65150-0000005e -1 <null> true true 20
-PartsSupplier pg_catalog pg_am Table <null> false false tid:7ff2755e9621-065a8b74-00000031 -1 <null> true false 21
-PartsSupplier pg_catalog pg_attrdef Table <null> false false tid:7ff2755e9621-ec00662c-0000004a -1 <null> true false 22
+PartsSupplier pg_catalog matpg_datatype Table <null> false false tid:7ff2755e9621-e544c1cc-00000069 -1 <null> true true 19
+PartsSupplier pg_catalog matpg_relatt Table <null> false false tid:7ff2755e9621-75d65150-0000005f -1 <null> true true 20
+PartsSupplier pg_catalog pg_am Table <null> false false tid:7ff2755e9621-065a8b74-00000032 -1 <null> true false 21
+PartsSupplier pg_catalog pg_attrdef Table <null> false false tid:7ff2755e9621-ec00662c-0000004b -1 <null> true false 22
PartsSupplier pg_catalog pg_attribute Table <null> false false tid:7ff2755e9621-edc4ea54-0000000f -1 <null> true true 23
PartsSupplier pg_catalog pg_class Table <null> false false tid:7ff2755e9621-62e78530-00000004 -1 <null> true true 24
-PartsSupplier pg_catalog pg_database Table <null> false false tid:7ff2755e9621-dda8fac3-0000004f -1 <null> true false 25
+PartsSupplier pg_catalog pg_database Table <null> false false tid:7ff2755e9621-dda8fac3-00000050 -1 <null> true false 25
PartsSupplier pg_catalog pg_index Table <null> false false tid:7ff2755e9621-633d048a-00000027 -1 <null> true true 26
PartsSupplier pg_catalog pg_namespace Table <null> false false tid:7ff2755e9621-37a09513-00000001 -1 <null> true false 27
-PartsSupplier pg_catalog pg_proc Table <null> false false tid:7ff2755e9621-d9ec709e-00000034 -1 <null> true true 28
-PartsSupplier pg_catalog pg_trigger Table <null> false false tid:7ff2755e9621-d50d2370-00000040 -1 <null> true false 29
-PartsSupplier pg_catalog pg_type Table <null> false false tid:7ff2755e9621-d9ee5c82-0000001b -1 <null> true false 30
-PartsSupplier pg_catalog pg_user Table <null> false false tid:7ff2755e9621-d9eeb913-00000059 -1 <null> true false 31
+PartsSupplier pg_catalog pg_proc Table <null> false false tid:7ff2755e9621-d9ec709e-00000035 -1 <null> true true 28
+PartsSupplier pg_catalog pg_trigger Table <null> false false tid:7ff2755e9621-d50d2370-00000041 -1 <null> true false 29
+PartsSupplier pg_catalog pg_type Table <null> false false tid:7ff2755e9621-d9ee5c82-0000001b -1 <null> true true 30
+PartsSupplier pg_catalog pg_user Table <null> false false tid:7ff2755e9621-d9eeb913-0000005a -1 <null> true false 31
Row Count : 31
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
VDBName 12 PartsSupplier java.lang.String VDBName string SYS Tables 255 255 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestVirtualDocWithVirtualProc/testDefect15241b.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestVirtualDocWithVirtualProc/testDefect15241b.expected 2012-08-31 18:45:31 UTC (rev 4388)
+++ trunk/test-integration/common/src/test/resources/TestVirtualDocWithVirtualProc/testDefect15241b.expected 2012-08-31 19:27:33 UTC (rev 4389)
@@ -2,11 +2,12 @@
Name Value UID
NugentXAttribute Nuuuuuge22222 mmuuid:4789b280-841c-1f15-9526-ebd0cace03e1
NugentYAttribute Nuuuuuge44444 mmuuid:4789b280-841c-1f15-9526-ebd0cace03e1
-pg_type:oid 30 tid:7ff2755e9621-c69d9997-0000003a
-pg_type:oid 1009 tid:7ff2755e9621-c63e1866-0000003b
-pg_type:oid 1002 tid:7ff2755e9621-c6363c4e-0000003c
-pg_type:oid 1028 tid:7ff2755e9621-f418fbbe-0000003d
-Row Count : 6
+pg_type:oid 22 tid:7ff2755e9621-ef456826-00000030
+pg_type:oid 30 tid:7ff2755e9621-c69d99b6-0000003b
+pg_type:oid 1009 tid:7ff2755e9621-c63e1885-0000003c
+pg_type:oid 1002 tid:7ff2755e9621-c6363c6d-0000003d
+pg_type:oid 1028 tid:7ff2755e9621-f418fbdd-0000003e
+Row Count : 7
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
Name 12 xmlvp java.lang.String Name string SYS Properties 255 255 0 false true false false 0 true true false false
Value 12 xmlvp java.lang.String Value string SYS Properties 255 255 0 false true false false 0 true true false false
12 years, 4 months
teiid SVN: r4388 - in trunk: client/src/main/java/org/teiid/client/metadata and 34 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-31 14:45:31 -0400 (Fri, 31 Aug 2012)
New Revision: 4388
Added:
trunk/common-core/src/main/java/org/teiid/core/types/ArrayImpl.java
trunk/test-integration/common/src/test/resources/TestODBCProceduresSchema/
trunk/test-integration/common/src/test/resources/TestODBCProceduresSchema/test_Pg_Proc_with_return_table.expected
trunk/test-integration/common/src/test/resources/TestODBCSchema/testOBIEEColumnQuery.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testArrayAggType.expected
Removed:
trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java
Modified:
trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
trunk/client/src/main/java/org/teiid/client/metadata/MetadataResult.java
trunk/client/src/main/java/org/teiid/jdbc/MetadataProvider.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java
trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java
trunk/common-core/src/main/java/org/teiid/core/types/JDBCSQLTypeInfo.java
trunk/common-core/src/main/java/org/teiid/core/types/basic/AnyToObjectTransform.java
trunk/common-core/src/test/java/org/teiid/core/types/TestDataTypeManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
trunk/engine/src/main/java/org/teiid/query/function/aggregate/ArrayAgg.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentProcedureCriteriaProcessor.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/AbstractNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
trunk/engine/src/test/java/org/teiid/query/processor/TestArrayTable.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java
trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
trunk/runtime/src/main/java/org/teiid/odbc/PGUtil.java
trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProperties.expected
Log:
TEIID-2166 TEIID-247 adding additional array support for internal consistency and pg emulation
Modified: trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-08-31 18:45:31 UTC (rev 4388)
@@ -32,6 +32,7 @@
<li>TEIID-2158 <b>Rest Services</b> - when required extension metadata defined on the virtual procedure, a REST based service on that procedure is automatically generated and deployed upon VDB deployment.
<li>TEIID-2163 <b>Binary XMLSERIALIZE</b> - XMLSERIALIZE now supports blob/varbinary and the encoding/version and XMLDECLARATION options.
<li>TEIID-2141 <b>OBJECTTABLE</b> - was added to extract values from objects using arbitrary scripts. See the Reference for usage.
+ <li>TEIID-2111 <b>Vararg Procedures</b> - variable argument procedures and functions can be created through DDL using the VARIADIC parameter type. See the Reference for usage.
</ul>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
@@ -43,6 +44,11 @@
<h4>from 8.0</h4>
<ul>
+ <li>TEIID-2166 array_get will return null if the index is out of bounds rather than raising an error.
+</ul>
+
+<h4>from 8.0</h4>
+<ul>
<li>org.teiid.metadata.Schema holds FunctionMethods by uuid rather than name to accommodate overridden method signatures.
<li>MetadataFactory no longer extends Schema. Use the MetadataFactory.getSchema method to get the target Schema.
<li>DDL created VIRTUAL pushdown functions should be referenced in the ExecutionFactory.getSupportedFunctions by their full <schema>.<function> name.
Modified: trunk/client/src/main/java/org/teiid/client/metadata/MetadataResult.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/metadata/MetadataResult.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/client/src/main/java/org/teiid/client/metadata/MetadataResult.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -33,18 +33,17 @@
public class MetadataResult implements Externalizable {
private static final long serialVersionUID = -1520482281079030324L;
- private Map[] columnMetadata;
- private Map[] parameterMetadata;
+ private Map<Integer, Object>[] columnMetadata;
+ private Map<Integer, Object>[] parameterMetadata;
public MetadataResult() {
}
- public MetadataResult(Map[] columnMetadata, Map[] parameterMetadata) {
- super();
+ public MetadataResult(Map<Integer, Object>[] columnMetadata, Map<Integer, Object>[] parameterMetadata) {
this.columnMetadata = columnMetadata;
this.parameterMetadata = parameterMetadata;
}
- public Map[] getColumnMetadata() {
+ public Map<Integer, Object>[] getColumnMetadata() {
return columnMetadata;
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/MetadataProvider.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/MetadataProvider.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/client/src/main/java/org/teiid/jdbc/MetadataProvider.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -46,7 +46,7 @@
return column.get(metadataPropertyKey);
}
- public int getColumnCount() throws SQLException {
+ public int getColumnCount() {
return metadata.length;
}
@@ -55,8 +55,16 @@
}
public int getIntValue(int columnIndex, Integer metadataPropertyKey) throws SQLException {
- return ((Integer) getValue(columnIndex, metadataPropertyKey)).intValue();
+ return getIntValue(columnIndex, metadataPropertyKey, 0);
}
+
+ public int getIntValue(int columnIndex, Integer metadataPropertyKey, int defaultValue) throws SQLException {
+ Integer val = (Integer) getValue(columnIndex, metadataPropertyKey);
+ if (val == null) {
+ return defaultValue;
+ }
+ return val;
+ }
public boolean getBooleanValue(int columnIndex, Integer metadataPropertyKey) throws SQLException {
return ((Boolean) getValue(columnIndex, metadataPropertyKey)).booleanValue();
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -98,7 +98,7 @@
}
public int getColumnDisplaySize(int index) throws SQLException {
- return provider.getIntValue(adjustColumn(index), ResultsMetadataConstants.DISPLAY_SIZE);
+ return provider.getIntValue(adjustColumn(index), ResultsMetadataConstants.DISPLAY_SIZE, Integer.MAX_VALUE);
}
public String getColumnLabel(int index) throws SQLException {
Copied: trunk/common-core/src/main/java/org/teiid/core/types/ArrayImpl.java (from rev 4382, trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java)
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/ArrayImpl.java (rev 0)
+++ trunk/common-core/src/main/java/org/teiid/core/types/ArrayImpl.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -0,0 +1,198 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.core.types;
+
+import java.io.Serializable;
+import java.sql.Array;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Map;
+
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.HashCodeUtil;
+
+/**
+ * Provides a serializable {@link Array} implementation with minimal JDBC functionality.
+ */
+public final class ArrayImpl implements Comparable<ArrayImpl>, Serializable, Array {
+ private static final long serialVersionUID = 517794153664734815L;
+ /**
+ * a regrettable hack for pg compatibility since we want to avoid adding a vector type
+ */
+ private boolean zeroBased;
+ private Object[] values;
+
+ @SuppressWarnings("serial")
+ public final static class NullException extends RuntimeException {};
+ private final static NullException ex = new NullException();
+
+ public ArrayImpl(Object[] values) {
+ this.values = values;
+ }
+
+ @Override
+ public int compareTo(ArrayImpl o) {
+ return compareTo(o, false, null);
+ }
+
+ public int compareTo(ArrayImpl o, boolean noNulls, Comparator<Object> comparator) {
+ if (zeroBased != o.zeroBased) {
+ throw new TeiidRuntimeException("Incompatible types"); //$NON-NLS-1$
+ }
+ int len1 = values.length;
+ int len2 = o.values.length;
+ int lim = Math.min(len1, len2);
+ for (int k = 0; k < lim; k++) {
+ Object object1 = values[k];
+ Object object2 = o.values[k];
+ if (object1 == null) {
+ if (noNulls) {
+ throw ex;
+ }
+ if (object2 != null) {
+ return -1;
+ }
+ continue;
+ } else if (object2 == null) {
+ if (noNulls) {
+ throw ex;
+ }
+ return 1;
+ }
+ int comp = 0;
+ if (comparator != null) {
+ comp = comparator.compare(object1, object2);
+ } else {
+ comp = ((Comparable)object1).compareTo(object2);
+ }
+ if (comp != 0) {
+ return comp;
+ }
+ }
+ return len1 - len2;
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeUtil.expHashCode(0, this.values);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof ArrayImpl)) {
+ return false;
+ }
+ ArrayImpl other = (ArrayImpl)obj;
+ return zeroBased == other.zeroBased && Arrays.equals(values, other.values);
+ }
+
+ public Object[] getValues() {
+ return values;
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.toString(this.values);
+ }
+
+ public boolean isZeroBased() {
+ return zeroBased;
+ }
+
+ public void setZeroBased(boolean zeroBased) {
+ this.zeroBased = zeroBased;
+ }
+
+ @Override
+ public void free() throws SQLException {
+
+ }
+
+ @Override
+ public Object getArray() throws SQLException {
+ return values;
+ }
+
+ @Override
+ public Object getArray(Map<String, Class<?>> map) throws SQLException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+ @Override
+ public Object getArray(long index, int count) throws SQLException {
+ if (index > Integer.MAX_VALUE) {
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
+ }
+ int offset = zeroBased?0:1;
+ int iIndex = (int)index - offset;
+ if (iIndex >= values.length || iIndex < 0) {
+ throw new ArrayIndexOutOfBoundsException(iIndex);
+ }
+ return Arrays.copyOfRange(values, iIndex, Math.min(iIndex + count, values.length));
+ }
+
+ @Override
+ public Object getArray(long index, int count, Map<String, Class<?>> map)
+ throws SQLException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+ @Override
+ public int getBaseType() throws SQLException {
+ return JDBCSQLTypeInfo.getSQLType(DataTypeManager.getDataTypeName(values.getClass().getComponentType()));
+ }
+
+ @Override
+ public String getBaseTypeName() throws SQLException {
+ return DataTypeManager.getDataTypeName(values.getClass().getComponentType());
+ }
+
+ @Override
+ public ResultSet getResultSet() throws SQLException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+ @Override
+ public ResultSet getResultSet(Map<String, Class<?>> map)
+ throws SQLException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+ @Override
+ public ResultSet getResultSet(long index, int count) throws SQLException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+ @Override
+ public ResultSet getResultSet(long index, int count,
+ Map<String, Class<?>> map) throws SQLException {
+ throw new SQLFeatureNotSupportedException();
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/org/teiid/core/types/ArrayImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -31,15 +31,7 @@
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import org.teiid.core.CorePlugin;
import org.teiid.core.types.basic.*;
@@ -66,7 +58,7 @@
*/
public class DataTypeManager {
- private static final String ARRAY_SUFFIX = "[]"; //$NON-NLS-1$
+ static final String ARRAY_SUFFIX = "[]"; //$NON-NLS-1$
private static final boolean USE_VALUE_CACHE = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.useValueCache", false); //$NON-NLS-1$
private static final boolean COMPARABLE_LOBS = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.comparableLobs", false); //$NON-NLS-1$
private static final boolean COMPARABLE_OBJECT = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.comparableObject", false); //$NON-NLS-1$
@@ -308,6 +300,9 @@
/** Base data type names and classes, Type class --> Type name */
private static Map<Class<?>, String> dataTypeClasses = new LinkedHashMap<Class<?>, String>(128);
+
+ private static Map<Class<?>, Class<?>> arrayTypes = new HashMap<Class<?>, Class<?>>(128);
+ private static Map<Class<?>, String> arrayTypeNames = new HashMap<Class<?>, String>(128);
private static Set<String> DATA_TYPE_NAMES;
@@ -324,6 +319,12 @@
loadBasicTransforms();
loadSourceConversions();
+
+ for (Map.Entry<String, Class<?>> entry : dataTypeNames.entrySet()) {
+ Class<?> arrayType = getArrayType(entry.getValue());
+ arrayTypes.put(entry.getValue(), arrayType);
+ arrayTypeNames.put(arrayType, getDataTypeName(arrayType));
+ }
}
/**
@@ -379,13 +380,17 @@
}
if (dataTypeClass == null) {
- if (name.endsWith(ARRAY_SUFFIX)) {
+ if (isArrayType(name)) {
return getArrayType(getDataTypeClass(name.substring(0, name.length() - 2)));
}
dataTypeClass = DefaultDataClasses.OBJECT;
}
return dataTypeClass;
}
+
+ public static boolean isArrayType(String name) {
+ return name.endsWith(ARRAY_SUFFIX);
+ }
public static String getDataTypeName(Class<?> typeClass) {
if (typeClass == null) {
@@ -394,11 +399,14 @@
String result = dataTypeClasses.get(typeClass);
if (result == null) {
if (typeClass.isArray()) {
- return getDataTypeName(typeClass.getComponentType()) + ARRAY_SUFFIX;
+ result = arrayTypeNames.get(typeClass);
+ if (result == null) {
+ return getDataTypeName(typeClass.getComponentType()) + ARRAY_SUFFIX;
+ }
+ return result;
}
result = DefaultDataTypes.OBJECT;
}
-
return result;
}
@@ -517,18 +525,22 @@
innerMap.put(targetName, transform);
}
- public static List<String> getImplicitConversions(String type) {
+ public static void getImplicitConversions(String type, Collection<String> result) {
Map<String, Transform> innerMap = transforms.get(type);
if (innerMap != null) {
- List<String> result = new ArrayList<String>(innerMap.size());
for (Map.Entry<String, Transform> entry : innerMap.entrySet()) {
if (!entry.getValue().isExplicit()) {
result.add(entry.getKey());
}
}
- return result;
+ return;
}
- return Collections.emptyList();
+ String previous = DataTypeManager.DefaultDataTypes.OBJECT;
+ while (isArrayType(type)) {
+ previous += ARRAY_SUFFIX;
+ result.add(previous);
+ type = getComponentType(type);
+ }
}
public static boolean isImplicitConversion(String srcType, String tgtType) {
@@ -536,9 +548,19 @@
if (t != null) {
return !t.isExplicit();
}
+ if (DefaultDataTypes.NULL.equals(srcType) && !DefaultDataTypes.NULL.equals(tgtType)) {
+ return true;
+ }
+ if (isArrayType(srcType) && isArrayType(tgtType)) {
+ return isImplicitConversion(getComponentType(srcType), getComponentType(tgtType));
+ }
return false;
}
+ private static String getComponentType(String srcType) {
+ return srcType.substring(0, srcType.length() - ARRAY_SUFFIX.length());
+ }
+
public static boolean isExplicitConversion(String srcType, String tgtType) {
Transform t = getTransform(srcType, tgtType);
if (t != null) {
@@ -913,6 +935,10 @@
}
public static Class<?> getArrayType(Class<?> classType) {
+ Class<?> result = arrayTypes.get(classType);
+ if (result != null) {
+ return result;
+ }
return Array.newInstance(classType, 0).getClass();
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/JDBCSQLTypeInfo.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/JDBCSQLTypeInfo.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/common-core/src/main/java/org/teiid/core/types/JDBCSQLTypeInfo.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -22,6 +22,7 @@
package org.teiid.core.types;
+import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.SQLXML;
@@ -93,6 +94,11 @@
addType(DataTypeManager.DefaultDataTypes.XML, Integer.MAX_VALUE, Integer.MAX_VALUE, SQLXML.class.getName(), Types.SQLXML);
addType(DataTypeManager.DefaultDataTypes.NULL, 4, 1, null, Types.NULL);
addType(DataTypeManager.DefaultDataTypes.VARBINARY, DataTypeManager.MAX_LOB_MEMORY_BYTES, DataTypeManager.MAX_LOB_MEMORY_BYTES, byte[].class.getName(), Types.VARBINARY, Types.BINARY);
+ addType(DataTypeManager.DefaultDataTypes.VARBINARY, DataTypeManager.MAX_LOB_MEMORY_BYTES, DataTypeManager.MAX_LOB_MEMORY_BYTES, byte[].class.getName(), Types.VARBINARY, Types.BINARY);
+
+ TypeInfo typeInfo = new TypeInfo(Integer.MAX_VALUE, 0, "ARRAY", Array.class.getName(), new int[Types.ARRAY]); //$NON-NLS-1$
+ CLASSNAME_TO_TYPEINFO.put(Array.class.getName(), typeInfo);
+ TYPE_TO_TYPEINFO.put(Types.ARRAY, typeInfo);
}
private static TypeInfo addType(String typeName, int maxDisplaySize, int precision, String javaClassName, int... sqlTypes) {
@@ -117,7 +123,7 @@
/**
* This method is used to obtain a short indicating JDBC SQL type for any object.
* The short values that give the type info are from java.sql.Types.
- * @param Name of the metamatrix type.
+ * @param Name of the teiid type.
* @return A short value representing SQL Type for the given java type.
*/
public static final int getSQLType(String typeName) {
@@ -129,6 +135,9 @@
TypeInfo sqlType = NAME_TO_TYPEINFO.get(typeName);
if (sqlType == null) {
+ if (DataTypeManager.isArrayType(typeName)) {
+ return Types.ARRAY;
+ }
return Types.JAVA_OBJECT;
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/basic/AnyToObjectTransform.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/basic/AnyToObjectTransform.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/common-core/src/main/java/org/teiid/core/types/basic/AnyToObjectTransform.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -35,7 +35,7 @@
}
@Override
- public Class getSourceType() {
+ public Class<?> getSourceType() {
return sourceType;
}
@@ -55,7 +55,7 @@
* Type of the outgoing value.
* @return Target type
*/
- public Class getTargetType() {
+ public Class<?> getTargetType() {
return DataTypeManager.DefaultDataClasses.OBJECT;
}
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestDataTypeManager.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestDataTypeManager.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestDataTypeManager.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -25,7 +25,9 @@
import static org.junit.Assert.*;
import java.sql.Types;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.Set;
import javax.sql.rowset.serial.SerialBlob;
@@ -174,6 +176,8 @@
assertEquals(Types.SQLXML, JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.XML));
assertEquals(DataTypeManager.DefaultDataTypes.STRING, JDBCSQLTypeInfo.getTypeName(Types.CHAR));
assertEquals(Types.CHAR, JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.CHAR));
+
+ assertEquals(Types.ARRAY, JDBCSQLTypeInfo.getSQLType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.BIG_DECIMAL))));
}
@Test public void testRuntimeTypeConversion() throws Exception {
@@ -197,12 +201,14 @@
}
@Test public void testImplicitConversions() {
+ List<String> c = new ArrayList<String>();
+ DataTypeManager.getImplicitConversions(DataTypeManager.DefaultDataTypes.INTEGER, c);
assertEquals(Arrays.asList(DataTypeManager.DefaultDataTypes.LONG,
DataTypeManager.DefaultDataTypes.BIG_INTEGER,
DataTypeManager.DefaultDataTypes.DOUBLE,
DataTypeManager.DefaultDataTypes.BIG_DECIMAL,
DataTypeManager.DefaultDataTypes.STRING,
- DataTypeManager.DefaultDataTypes.OBJECT), DataTypeManager.getImplicitConversions(DataTypeManager.DefaultDataTypes.INTEGER));
+ DataTypeManager.DefaultDataTypes.OBJECT), c);
}
@Test(expected=TransformationException.class) public void testStringToXML() throws Exception {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -32,6 +32,7 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.language.*;
import org.teiid.language.DerivedColumn;
@@ -586,7 +587,7 @@
result.setValueIndex(valueIndex++);
return result;
}
- if (constant.getValue() instanceof ArrayValue) {
+ if (constant.getValue() instanceof ArrayImpl) {
//TODO: we could check if there is a common base type (also needs to be in the dependent logic)
// and expand binding options in the translators
@@ -597,7 +598,7 @@
//result.setBindEligible(constant.isBindEligible());
//return result;
- ArrayValue av = (ArrayValue)constant.getValue();
+ ArrayImpl av = (ArrayImpl)constant.getValue();
List<Constant> vals = new ArrayList<Constant>();
Class<?> baseType = null;
for (Object o : av.getValues()) {
@@ -820,7 +821,7 @@
Literal value = null;
if (direction != Direction.OUT) {
if (param.isVarArg()) {
- ArrayValue av = (ArrayValue) ((Constant)param.getExpression()).getValue();
+ ArrayImpl av = (ArrayImpl) ((Constant)param.getExpression()).getValue();
for (Object obj : av.getValues()) {
Argument arg = new Argument(direction, new Literal(obj, param.getClassType().getComponentType()), param.getClassType().getComponentType(), metadataParam);
translatedParameters.add(arg);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -147,7 +147,7 @@
// For each projected symbol, construct a metadata map
private MetadataResult getMetadataForCommand(Command originalCommand) throws TeiidComponentException {
- Map[] columnMetadata = null;
+ Map<Integer, Object>[] columnMetadata = null;
switch(originalCommand.getType()) {
case Command.TYPE_QUERY:
@@ -196,7 +196,7 @@
}
}
List<Reference> params = ReferenceCollectorVisitor.getReferences(originalCommand);
- Map[] paramMetadata = new Map[params.size()];
+ Map<Integer, Object>[] paramMetadata = new Map[params.size()];
for (int i = 0; i < params.size(); i++) {
Reference param = params.get(i);
paramMetadata[i] = getDefaultColumn(null, paramMap.get(param), param.getType());
@@ -205,8 +205,8 @@
return new MetadataResult(columnMetadata, paramMetadata);
}
- private Map[] createProjectedSymbolMetadata(Command originalCommand) throws TeiidComponentException {
- Map[] columnMetadata;
+ private Map<Integer, Object>[] createProjectedSymbolMetadata(Command originalCommand) throws TeiidComponentException {
+ Map<Integer, Object>[] columnMetadata;
// Allow command to use temporary metadata
TempMetadataStore tempMetadata = originalCommand.getTemporaryMetadata();
if(tempMetadata != null && tempMetadata.getData().size() > 0) {
@@ -250,9 +250,9 @@
return getMetadataForCommand(command);
}
- private Map createXMLColumnMetadata(Query xmlCommand) {
+ private Map<Integer, Object> createXMLColumnMetadata(Query xmlCommand) {
GroupSymbol doc = xmlCommand.getFrom().getGroups().get(0);
- Map xmlMetadata = getDefaultColumn(doc.getName(), XML_COLUMN_NAME, XMLType.class);
+ Map<Integer, Object> xmlMetadata = getDefaultColumn(doc.getName(), XML_COLUMN_NAME, XMLType.class);
// Override size as XML may be big
xmlMetadata.put(ResultsMetadataConstants.DISPLAY_SIZE, JDBCSQLTypeInfo.XML_COLUMN_LENGTH);
@@ -260,7 +260,7 @@
return xmlMetadata;
}
- private Map createColumnMetadata(String label, Expression symbol) throws QueryMetadataException, TeiidComponentException {
+ private Map<Integer, Object> createColumnMetadata(String label, Expression symbol) throws QueryMetadataException, TeiidComponentException {
if(symbol instanceof ElementSymbol) {
return createElementMetadata(label, (ElementSymbol) symbol);
}
@@ -273,7 +273,7 @@
return createTypedMetadata(label, symbol);
}
- private Map createElementMetadata(String label, ElementSymbol symbol) throws QueryMetadataException, TeiidComponentException {
+ private Map<Integer, Object> createElementMetadata(String label, ElementSymbol symbol) throws QueryMetadataException, TeiidComponentException {
Object elementID = symbol.getMetadataID();
Map<Integer, Object> column = new HashMap<Integer, Object>();
@@ -339,7 +339,7 @@
return column;
}
- private Map createAggregateMetadata(String shortColumnName,
+ private Map<Integer, Object> createAggregateMetadata(String shortColumnName,
AggregateSymbol symbol) throws QueryMetadataException, TeiidComponentException {
Type function = symbol.getAggregateFunction();
@@ -352,7 +352,7 @@
return createTypedMetadata(shortColumnName, symbol);
}
- private Map createTypedMetadata(String shortColumnName, Expression symbol) {
+ private Map<Integer, Object> createTypedMetadata(String shortColumnName, Expression symbol) {
return getDefaultColumn(null, shortColumnName, symbol.getType());
}
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -367,7 +367,6 @@
TEIID30411,
TEIID30412,
TEIID30413,
- TEIID30415,
TEIID30416,
TEIID30418,
TEIID30419,
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -54,15 +54,7 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.types.BaseLob;
-import org.teiid.core.types.BlobType;
-import org.teiid.core.types.ClobType;
-import org.teiid.core.types.InputStreamFactory;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.types.Sequencable;
-import org.teiid.core.types.Streamable;
-import org.teiid.core.types.TransformationException;
-import org.teiid.core.types.XMLType;
+import org.teiid.core.types.*;
import org.teiid.core.types.XMLType.Type;
import org.teiid.core.types.basic.StringToSQLXMLTransform;
import org.teiid.core.util.EquivalenceUtil;
@@ -544,11 +536,11 @@
//semantics. each element is treated as an individual comparison,
//so null implies unknown. h2 (and likely other dbms) allow for null
//array element equality
- if (leftValue instanceof ArrayValue) {
- ArrayValue av = (ArrayValue)leftValue;
+ if (leftValue instanceof ArrayImpl) {
+ ArrayImpl av = (ArrayImpl)leftValue;
try {
- compare = av.compareTo((ArrayValue)value, true);
- } catch (ArrayValue.NullException e) {
+ compare = av.compareTo((ArrayImpl)value, true, Constant.COMPARATOR);
+ } catch (ArrayImpl.NullException e) {
return null;
}
} else {
@@ -664,11 +656,11 @@
} else if (expression instanceof Array) {
Array array = (Array)expression;
List<Expression> exprs = array.getExpressions();
- Object[] result = new Object[exprs.size()];
+ Object[] result = (Object[]) java.lang.reflect.Array.newInstance(array.getComponentType(), exprs.size());
for (int i = 0; i < exprs.size(); i++) {
result[i] = internalEvaluate(exprs.get(i), tuple);
}
- return new ArrayValue(result);
+ return new ArrayImpl(result);
} else {
throw new TeiidComponentException(QueryPlugin.Event.TEIID30329, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30329, expression.getClass().getName()));
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -30,6 +30,7 @@
import org.teiid.api.exception.query.FunctionExecutionException;
import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.BinaryType;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.TransformationException;
@@ -38,7 +39,6 @@
import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.metadata.FunctionMethod.PushDown;
import org.teiid.query.QueryPlugin;
-import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.util.CommandContext;
@@ -224,7 +224,7 @@
}
if (method.isVarArgs()) {
if (calledWithVarArgArrayParam) {
- ArrayValue av = (ArrayValue)values[values.length -1];
+ ArrayImpl av = (ArrayImpl)values[values.length -1];
if (av != null) {
Object[] vals = av.getValues();
values[values.length - 1] = vals;
@@ -296,6 +296,9 @@
}
}
result = DataTypeManager.convertToRuntimeType(result);
+ if (expectedType.isArray() && result instanceof ArrayImpl) {
+ return result;
+ }
result = DataTypeManager.transformValue(result, expectedType);
if (result instanceof String) {
String s = (String)result;
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -59,7 +59,6 @@
import org.teiid.language.SQLConstants;
import org.teiid.language.SQLConstants.NonReserved;
import org.teiid.query.QueryPlugin;
-import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.util.CommandContext;
/**
@@ -1402,30 +1401,24 @@
public static Object array_get(Object array, int index) throws FunctionExecutionException, SQLException {
try {
- if (array.getClass().isArray()) {
- return Array.get(array, index - 1);
- }
if (array instanceof java.sql.Array) {
return Array.get(((java.sql.Array)array).getArray(index, 1), 0);
}
- if (array instanceof ArrayValue) {
- return ((ArrayValue)array).getValues()[index - 1];
+ if (array.getClass().isArray()) {
+ return Array.get(array, index - 1);
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new FunctionExecutionException(QueryPlugin.Event.TEIID30415, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30415, index));
+ return null;
}
throw new FunctionExecutionException(QueryPlugin.Event.TEIID30416, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30416, array.getClass()));
}
public static int array_length(Object array) throws FunctionExecutionException, SQLException {
- if (array.getClass().isArray()) {
- return Array.getLength(array);
- }
if (array instanceof java.sql.Array) {
return Array.getLength(((java.sql.Array)array).getArray());
}
- if (array instanceof ArrayValue) {
- return ((ArrayValue)array).getValues().length;
+ if (array.getClass().isArray()) {
+ return Array.getLength(array);
}
throw new FunctionExecutionException(QueryPlugin.Event.TEIID30416, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30416, array.getClass()));
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/aggregate/ArrayAgg.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/aggregate/ArrayAgg.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/function/aggregate/ArrayAgg.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -21,6 +21,7 @@
*/
package org.teiid.query.function.aggregate;
+import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
@@ -28,12 +29,20 @@
import org.teiid.api.exception.query.FunctionExecutionException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ArrayImpl;
+import org.teiid.core.types.DataTypeManager;
import org.teiid.query.util.CommandContext;
public class ArrayAgg extends SingleArgumentAggregateFunction {
private ArrayList<Object> result;
+ private Class<?> componentType;
+ @Override
+ public void initialize(Class<?> dataType, Class<?> inputType) {
+ this.componentType = inputType;
+ }
+
@Override
public void addInputDirect(Object input, List<?> tuple, CommandContext commandContext) throws TeiidComponentException, TeiidProcessingException {
if (this.result == null) {
@@ -50,7 +59,14 @@
if (this.result == null) {
return null;
}
- return this.result.toArray();
+ if (this.componentType == DataTypeManager.DefaultDataClasses.OBJECT) {
+ return new ArrayImpl(this.result.toArray());
+ }
+ Object array = Array.newInstance(componentType, this.result.size());
+ for (int i = 0; i < result.size(); i++) {
+ Array.set(array, i, result.get(i));
+ }
+ return new ArrayImpl((Object[]) array);
}
@Override
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -253,7 +253,7 @@
private void connectSubqueryContainers(PlanNode plan) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
Set<GroupSymbol> groupSymbols = getGroupSymbols(plan);
- for (PlanNode node : NodeEditor.findAllNodes(plan, NodeConstants.Types.PROJECT | NodeConstants.Types.SELECT | NodeConstants.Types.JOIN | NodeConstants.Types.SOURCE)) {
+ for (PlanNode node : NodeEditor.findAllNodes(plan, NodeConstants.Types.PROJECT | NodeConstants.Types.SELECT | NodeConstants.Types.JOIN | NodeConstants.Types.SOURCE | NodeConstants.Types.GROUP)) {
List<SubqueryContainer> subqueryContainers = node.getSubqueryContainers();
if (subqueryContainers.isEmpty()){
continue;
@@ -267,7 +267,7 @@
Command subCommand = (Command)container.getCommand().clone();
ArrayList<Reference> correlatedReferences = new ArrayList<Reference>();
CorrelatedReferenceCollectorVisitor.collectReferences(subCommand, localGroupSymbols, correlatedReferences);
- if (node.getType() != NodeConstants.Types.JOIN) {
+ if (node.getType() != NodeConstants.Types.JOIN && node.getType() != NodeConstants.Types.GROUP) {
PlanNode grouping = NodeEditor.findNodePreOrder(node, NodeConstants.Types.GROUP, NodeConstants.Types.SOURCE | NodeConstants.Types.JOIN);
if (grouping != null && !correlatedReferences.isEmpty()) {
SymbolMap map = (SymbolMap) grouping.getProperty(Info.SYMBOL_MAP);
Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -48,6 +48,7 @@
import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.Assertion;
import org.teiid.dqp.internal.process.DataTierTupleSource;
@@ -71,7 +72,6 @@
import org.teiid.query.sql.ProcedureReservedWords;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.util.VariableContext;
@@ -252,8 +252,8 @@
if (value == null) {
throw new QueryValidatorException(QueryPlugin.Event.TEIID30164, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30164, param));
}
- if (value instanceof ArrayValue && metadata.isVariadic(param.getMetadataID())) {
- ArrayValue av = (ArrayValue)value;
+ if (value instanceof ArrayImpl && metadata.isVariadic(param.getMetadataID())) {
+ ArrayImpl av = (ArrayImpl)value;
for (Object o : av.getValues()) {
if (o == null) {
throw new QueryValidatorException(QueryPlugin.Event.TEIID30164, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30164, param));
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentProcedureCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentProcedureCriteriaProcessor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentProcedureCriteriaProcessor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -29,13 +29,13 @@
import org.teiid.common.buffer.BlockedException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.util.Assertion;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.CompareCriteria;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.IsNullCriteria;
import org.teiid.query.sql.symbol.Array;
-import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.Reference;
@@ -101,7 +101,7 @@
validRow = false;
break;
}
- ArrayValue valueArray = (ArrayValue)value;
+ ArrayImpl valueArray = (ArrayImpl)value;
for (int j = 0; j < array.getExpressions().size(); j++) {
validRow = setParam(context, valueArray.getValues()[j], nullAllowed, (Reference) array.getExpressions().get(j));
if (!validRow) {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -33,10 +33,10 @@
import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.Assertion;
import org.teiid.query.sql.symbol.Array;
-import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.util.ValueIteratorSource;
@@ -76,7 +76,7 @@
int index = 0;
if (valueExpression != null) {
if (valueExpression instanceof Array) {
- Array array = (Array)valueExpression;
+ final Array array = (Array)valueExpression;
List<Expression> exprs = array.getExpressions();
final int[] indexes = new int[exprs.size()];
for (int i = 0; i < exprs.size(); i++) {
@@ -86,14 +86,14 @@
@Override
public Object next() throws TeiidComponentException {
List<?> tuple = super.nextTuple();
- Object[] a = new Object[indexes.length];
+ Object[] a = (Object[]) java.lang.reflect.Array.newInstance(array.getComponentType(), indexes.length);
for (int i = 0; i < indexes.length; i++) {
a[i] = tuple.get(indexes[i]);
if (a[i] == null) {
return null; //TODO: this is a hack
}
}
- return new ArrayValue(a);
+ return new ArrayImpl(a);
}
};
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -105,32 +105,56 @@
* @param typeNames an ordered array of unique type names.
* @return a type name to which all the given types can be converted
*/
- public static String getCommonType(String[] typeNames) {
+ @SuppressWarnings("null")
+ public static String getCommonType(String[] typeNames) {
if (typeNames == null || typeNames.length == 0) {
return null;
}
- // If there is only one type, then simply return it
if (typeNames.length == 1) {
- return typeNames[0];
+ return typeNames[0];
}
- // A type can be implicitly converted to itself, so we put the implicit
- // conversions as well as the original type in the working list of
- // conversions.
- HashSet<String> commonConversions = new LinkedHashSet<String>();
- commonConversions.add(typeNames[0]);
- commonConversions.addAll(DataTypeManager.getImplicitConversions(typeNames[0]));
- for (int i = 1; i < typeNames.length; i++ ) {
- HashSet<String> conversions = new LinkedHashSet<String>(DataTypeManager.getImplicitConversions(typeNames[i]));
- conversions.add(typeNames[i]);
- // Equivalent to set intersection
- commonConversions.retainAll(conversions);
+ LinkedHashSet<String> commonConversions = null;
+ Set<String> types = new LinkedHashSet<String>();
+ Set<String> conversions = null;
+ boolean first = true;
+ for (int i = 0; i < typeNames.length && (first || !commonConversions.isEmpty()); i++) {
+ String string = typeNames[i];
+ if (string == null) {
+ return null;
+ }
+ if (DataTypeManager.DefaultDataTypes.NULL.equals(string) || !types.add(string)) {
+ continue;
+ }
+ if (first) {
+ commonConversions = new LinkedHashSet<String>();
+ // A type can be implicitly convertd to itself, so we put the implicit
+ // conversions as well as the original type in the working list of
+ // conversions.
+ commonConversions.add(string);
+ DataTypeManager.getImplicitConversions(string, commonConversions);
+ first = false;
+ } else {
+ if (conversions == null) {
+ conversions = new HashSet<String>();
+ }
+ DataTypeManager.getImplicitConversions(string, conversions);
+ conversions.add(string);
+ // Equivalent to set intersection
+ commonConversions.retainAll(conversions);
+ conversions.clear();
+ }
+
+ }
+ // If there is only one type, then simply return it
+ if (types.size() == 1) {
+ return types.iterator().next();
}
- if (commonConversions.isEmpty()) {
- return null;
+ if (types.isEmpty()) {
+ return DataTypeManager.DefaultDataTypes.NULL;
}
- for (int i = 0; i < typeNames.length; i++) {
- if (commonConversions.contains(typeNames[i])) {
- return typeNames[i];
+ for (String string : types) {
+ if (commonConversions.contains(string)) {
+ return string;
}
}
commonConversions.remove(DefaultDataTypes.STRING);
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -57,7 +57,8 @@
public class ResolverVisitor extends LanguageVisitor {
- private static final String SYS_PREFIX = CoreConstants.SYSTEM_MODEL + '.';
+ public static final String TEIID_PASS_THROUGH_TYPE = "teiid:pass-through-type"; //$NON-NLS-1$
+ private static final String SYS_PREFIX = CoreConstants.SYSTEM_MODEL + '.';
private static class ElementMatch {
ElementSymbol element;
@@ -542,6 +543,9 @@
} else if (FunctionLibrary.ARRAY_GET.equalsIgnoreCase(fd.getName()) && args[0].getType().isArray()) {
//hack to use typed array values
fd = library.copyFunctionChangeReturnType(fd, args[0].getType().getComponentType());
+ } else if (Boolean.valueOf(fd.getMethod().getProperty(TEIID_PASS_THROUGH_TYPE, false))) {
+ //hack largely to support pg
+ fd = library.copyFunctionChangeReturnType(fd, args[0].getType());
}
function.setFunctionDescriptor(fd);
@@ -958,16 +962,12 @@
for (int i = 0; i < whenCount; i++) {
then = obj.getThenExpression(i);
setDesiredType(then, thenType, obj);
- if (!thenTypeNames.contains(DataTypeManager.getDataTypeName(then.getType()))) {
- thenTypeNames.add(DataTypeManager.getDataTypeName(then.getType()));
- }
+ thenTypeNames.add(DataTypeManager.getDataTypeName(then.getType()));
}
// Set the type of the else expression
if (elseExpr != null) {
setDesiredType(elseExpr, thenType, obj);
- if (!thenTypeNames.contains(DataTypeManager.getDataTypeName(elseExpr.getType()))) {
- thenTypeNames.add(DataTypeManager.getDataTypeName(elseExpr.getType()));
- }
+ thenTypeNames.add(DataTypeManager.getDataTypeName(elseExpr.getType()));
}
// Invariants: all the expressions' types are non-null
@@ -977,7 +977,7 @@
if (thenTypeName == null) {
throw new QueryResolverException(QueryPlugin.Event.TEIID30079, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30079, "THEN/ELSE", obj)); //$NON-NLS-1$
}
- ArrayList thens = new ArrayList(whenCount);
+ ArrayList<Expression> thens = new ArrayList<Expression>(whenCount);
for (int i = 0; i < whenCount; i++) {
thens.add(ResolverUtil.convertExpression(obj.getThenExpression(i), thenTypeName, metadata));
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/AbstractNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/AbstractNavigator.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/AbstractNavigator.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -23,6 +23,8 @@
package org.teiid.query.sql.navigator;
import java.util.Collection;
+import java.util.List;
+import java.util.RandomAccess;
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.LanguageVisitor;
@@ -63,11 +65,18 @@
}
protected void visitNodes(Collection<? extends LanguageObject> nodes) {
- if(this.visitor.shouldAbort()) {
+ if(this.visitor.shouldAbort() || nodes == null) {
return;
}
-
- if (nodes != null && nodes.size() > 0) {
+ int size = nodes.size();
+ if (size > 0) {
+ if (nodes instanceof List<?> && nodes instanceof RandomAccess) {
+ List<? extends LanguageObject> list = (List<? extends LanguageObject>) nodes;
+ for (int i = 0; i < size; i++) {
+ visitNode(list.get(i));
+ }
+ return;
+ }
for (LanguageObject languageObject : nodes) {
visitNode(languageObject);
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -197,7 +197,10 @@
expressionType = this.getArg(0).getType();
return AVG_TYPES.get(expressionType);
case ARRAY_AGG:
- return DataTypeManager.DefaultDataClasses.OBJECT;
+ if (this.getArg(0) == null) {
+ return null;
+ }
+ return DataTypeManager.getArrayType(this.getArg(0).getType());
case TEXTAGG:
return DataTypeManager.DefaultDataClasses.BLOB;
case USER_DEFINED:
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -66,7 +66,8 @@
@Override
public Array clone() {
- Array clone = new Array(type, LanguageObject.Util.deepClone(getExpressions(), Expression.class));
+ Array clone = new Array(LanguageObject.Util.deepClone(getExpressions(), Expression.class));
+ clone.type = type;
clone.implicit = implicit;
return clone;
}
@@ -92,7 +93,7 @@
@Override
public int hashCode() {
- return HashCodeUtil.hashCode(0, getExpressions());
+ return HashCodeUtil.expHashCode(type.hashCode(), getExpressions());
}
@Override
Deleted: trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.query.sql.symbol;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import org.teiid.query.sql.visitor.SQLStringVisitor;
-
-public class ArrayValue implements Comparable<ArrayValue>, Serializable {
- private static final long serialVersionUID = 517794153664734815L;
- private Object[] values;
-
- @SuppressWarnings("serial")
- public final static class NullException extends RuntimeException {};
- private final static NullException ex = new NullException();
-
- public ArrayValue(Object[] values) {
- this.values = values;
- }
-
- @Override
- public int compareTo(ArrayValue o) {
- return compareTo(o, false);
- }
-
- public int compareTo(ArrayValue o, boolean noNulls) {
- int len1 = values.length;
- int len2 = o.values.length;
- int lim = Math.min(len1, len2);
- for (int k = 0; k < lim; k++) {
- Object object1 = values[k];
- Object object2 = o.values[k];
- if (object1 == null) {
- if (noNulls) {
- throw ex;
- }
- if (object2 != null) {
- return -1;
- }
- continue;
- } else if (object2 == null) {
- if (noNulls) {
- throw ex;
- }
- return 1;
- }
- int comp = Constant.COMPARATOR.compare(object1, object2);
- if (comp != 0) {
- return comp;
- }
- }
- return len1 - len2;
- }
-
- @Override
- public int hashCode() {
- return Arrays.hashCode(values);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof ArrayValue)) {
- return false;
- }
- ArrayValue other = (ArrayValue)obj;
- return Arrays.equals(values, other.values);
- }
-
- public Object[] getValues() {
- return values;
- }
-
- @Override
- public String toString() {
- return SQLStringVisitor.getSQLString(new Constant(this));
- }
-
-}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -30,6 +30,7 @@
import java.util.List;
import java.util.Map;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.StringUtil;
import org.teiid.language.SQLConstants;
@@ -1155,8 +1156,8 @@
constantParts = new String[] {"null"}; //$NON-NLS-1$
}
} else {
- if (value.getClass() == ArrayValue.class) {
- ArrayValue av = (ArrayValue)value;
+ if (value.getClass() == ArrayImpl.class) {
+ ArrayImpl av = (ArrayImpl)value;
append(Tokens.LPAREN);
for (int i = 0; i < av.getValues().length; i++) {
if (i > 0) {
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -47,6 +47,7 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.language.SQLConstants;
@@ -373,8 +374,8 @@
Object evaluatedValue = Evaluator.evaluate(param.getExpression());
if(evaluatedValue == null) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$
- } else if (evaluatedValue instanceof ArrayValue && getMetadata().isVariadic(param.getMetadataID())) {
- ArrayValue av = (ArrayValue)evaluatedValue;
+ } else if (evaluatedValue instanceof ArrayImpl && getMetadata().isVariadic(param.getMetadataID())) {
+ ArrayImpl av = (ArrayImpl)evaluatedValue;
for (Object o : av.getValues()) {
if (o == null) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-08-31 18:45:31 UTC (rev 4388)
@@ -3692,6 +3692,7 @@
QueryCommand subquery = null;
Integer index = null;
Expression condition = null;
+ Expression indexExpr = null;
}
{
(
@@ -3721,7 +3722,7 @@
return new Constant(normalizeStringLiteral(symbolImage));
}
} | symbol=nonReserved())
- (<LSBRACE> index = intVal() <RSBRACE>)?
+ (<LSBRACE> indexExpr = commonValueExpression(info) <RSBRACE>)?
)
|
LOOKAHEAD(subquery(info)) subquery = subquery(info)
@@ -3729,7 +3730,7 @@
( <LPAREN>
expression = expression(info)
<RPAREN>
- (<LSBRACE> index = intVal() <RSBRACE>)?
+ (<LSBRACE> indexExpr = commonValueExpression(info) <RSBRACE>)?
)
|
// Searched CASE expressions
@@ -3748,8 +3749,8 @@
if (condition != null) {
((AggregateSymbol)expression).setCondition(condition);
}
- if (index != null) {
- expression = new Function("array_get", new Expression[] {expression, new Constant(index)});
+ if (indexExpr != null) {
+ expression = new Function("array_get", new Expression[] {expression, indexExpr});
}
return expression;
}
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-08-31 18:45:31 UTC (rev 4388)
@@ -902,7 +902,6 @@
TEIID30561=The multisource plan must execute a procedure returning parameter values exactly 1: {0}
TEIID30546=Unknown log level: {0}, expected one of {1}
-TEIID30415=Array index out of range: {0}
TEIID30190=Could not convert value for column: {0}
TEIID30116={0} is not a valid view.
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -174,6 +174,14 @@
helpCheckNumericAttributes(response, 2, 22, 20, 0);
helpCheckNumericAttributes(response, 3, 22, 20, 0);
}
+
+ @Test public void testArrayAgg() throws Exception {
+ QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
+ String sql = "SELECT array_agg(e1) FROM pm1.g2"; //$NON-NLS-1$
+
+ MetadataResult response = helpTestQuery(metadata, sql, RealMetadataFactory.example1VDB());
+ assertEquals("string[]", response.getColumnMetadata()[0].get(ResultsMetadataConstants.DATA_TYPE));
+ }
@Test public void testWindowFunction() throws Exception {
QueryMetadataInterface metadata = TestMetaDataProcessor.examplePrivatePhysicalModel();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -35,6 +35,7 @@
import org.teiid.UserDefinedAggregate;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.impl.BufferManagerImpl;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.metadata.AggregateAttributes;
import org.teiid.metadata.FunctionMethod;
@@ -415,8 +416,8 @@
// Create expected results
List[] expected = new List[] {
- Arrays.asList((Object)new Integer[] {1, 0, 0, 2}),
- Arrays.asList((Object)new Integer[] {3, 1}),
+ Arrays.asList(new ArrayImpl(new Integer[] {1, 0, 0, 2})),
+ Arrays.asList(new ArrayImpl(new Integer[] {3, 1})),
};
// Construct data manager with data
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestArrayTable.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestArrayTable.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestArrayTable.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -65,10 +65,13 @@
process(sql, expected);
}
- @Test(expected=TeiidProcessingException.class) public void testCorrelatedTextTable3() throws Exception {
+ @Test public void testCorrelatedTextTable3() throws Exception {
String sql = "select x.* from bqt1.smalla, arraytable(objectvalue COLUMNS x string, y integer, z integer, aa object) x"; //$NON-NLS-1$
- List[] expected = new List[] {};
+ List[] expected = new List[] {
+ Arrays.asList("a", 1, 2, null),
+ Arrays.asList("b", 3, 6, null),
+ };
process(sql, expected);
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -321,10 +321,7 @@
compareDocuments((String)expectedResults[i].get(0), actualDoc);
continue;
}
- } else if (cellValue instanceof Object[]) {
- assertArrayEquals((Object[])expectedResults[i].get(0), (Object[])cellValue);
- continue;
- }
+ }
}
assertEquals("Row " + i + " does not match expected: ", expectedResults[i], record); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -480,8 +480,8 @@
}
@Test public void testArrayEquality() throws Exception {
- assertEquals(Boolean.TRUE, Evaluator.evaluate(new CompareCriteria(new Array(Arrays.asList((Expression)new Constant(1))), CompareCriteria.EQ, new Array(Arrays.asList((Expression)new Constant(1))))));
- assertNull(new Evaluator(null, null, null).evaluateTVL(new CompareCriteria(new Array(Arrays.asList((Expression)new Constant(1))), CompareCriteria.EQ, new Array(Arrays.asList((Expression)new Constant(null)))), null));
+ assertEquals(Boolean.TRUE, Evaluator.evaluate(new CompareCriteria(new Array(DataTypeManager.DefaultDataClasses.INTEGER, Arrays.asList((Expression)new Constant(1))), CompareCriteria.EQ, new Array(DataTypeManager.DefaultDataClasses.INTEGER, Arrays.asList((Expression)new Constant(1))))));
+ assertNull(new Evaluator(null, null, null).evaluateTVL(new CompareCriteria(new Array(DataTypeManager.DefaultDataClasses.INTEGER, Arrays.asList((Expression)new Constant(1))), CompareCriteria.EQ, new Array(DataTypeManager.DefaultDataClasses.INTEGER, Arrays.asList((Expression)new Constant(null)))), null));
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -2913,5 +2913,15 @@
@Test public void testImplicitTempTableWithExplicitColumns() {
helpResolve("insert into #temp(x, y) select e1, e2 from pm1.g1");
}
+
+ @Test public void testArrayCase() {
+ Command c = helpResolve("select case when e1 is null then array_agg(e4) when e2 is null then array_agg(e4+1) end from pm1.g1 group by e1, e2");
+ assertTrue(c.getProjectedSymbols().get(0).getType().isArray());
+ }
+
+ @Test public void testArrayCase1() {
+ Command c = helpResolve("select case when e1 is null then array_agg(e1) when e2 is null then array_agg(e4+1) end from pm1.g1 group by e1, e2");
+ assertTrue(c.getProjectedSymbols().get(0).getType().isArray());
+ }
}
\ No newline at end of file
Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -35,6 +35,7 @@
import org.junit.Test;
import org.teiid.client.BatchSerializer;
import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.sql.visitor.SQLStringVisitor;
@@ -43,17 +44,17 @@
public class TestArray {
@Test public void testArrayValueCompare() {
- ArrayValue a1 = new ArrayValue(new Object[] {1, 2, 3});
+ ArrayImpl a1 = new ArrayImpl(new Object[] {1, 2, 3});
UnitTestUtil.helpTestEquivalence(0, a1, a1);
- ArrayValue a2 = new ArrayValue(new Object[] {1, 2});
+ ArrayImpl a2 = new ArrayImpl(new Object[] {1, 2});
UnitTestUtil.helpTestEquivalence(1, a1, a2);
}
@Test public void testArrayValueToString() {
- ArrayValue a1 = new ArrayValue(new Object[] {1, "x'2", 3});
+ ArrayImpl a1 = new ArrayImpl(new Object[] {1, "x'2", 3});
assertEquals("(1, 'x''2', 3)", SQLStringVisitor.getSQLString(new Constant(a1)));
}
@@ -64,11 +65,12 @@
Array a1 = array.clone();
assertNotSame(a1, array);
+ assertEquals(a1, array);
assertNotSame(a1.getExpressions().get(0), array.getExpressions().get(0));
}
@Test public void testArrayValueSerialization() throws Exception {
- ArrayValue a1 = new ArrayValue(new Integer[] {1, 2, 3});
+ ArrayImpl a1 = new ArrayImpl(new Integer[] {1, 2, 3});
String[] types = TupleBuffer.getTypeNames(Arrays.asList(new Array(Integer.class, null)));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
@@ -80,4 +82,18 @@
assertEquals(a1, batch.get(0).get(0));
}
+ @Test public void testZeroBasedArray() throws Exception {
+ ArrayImpl a1 = new ArrayImpl(new Integer[] {1, 2, 3});
+ a1.setZeroBased(true);
+ assertEquals(2, java.lang.reflect.Array.get(a1.getArray(1, 1), 0));
+ }
+
+ /**
+ * This is for compatibility with array_get
+ * @throws Exception
+ */
+ @Test(expected=IndexOutOfBoundsException.class) public void testIndexOutOfBounds() throws Exception {
+ ArrayImpl a1 = new ArrayImpl(new Integer[] {1, 2, 3});
+ a1.getArray(-1, 1);
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -21,11 +21,14 @@
*/
package org.teiid.deployers;
+import static org.teiid.odbc.PGUtil.*;
+
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import java.util.Properties;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.types.DataTypeManager;
import org.teiid.metadata.Column;
import org.teiid.metadata.Datatype;
@@ -35,14 +38,11 @@
import org.teiid.metadata.FunctionMethod.PushDown;
import org.teiid.metadata.Table.Type;
import org.teiid.odbc.ODBCServerRemoteImpl;
+import org.teiid.query.resolver.util.ResolverVisitor;
import org.teiid.translator.TranslatorException;
public class PgCatalogMetadataStore extends MetadataFactory {
private static final long serialVersionUID = 2158418324376966987L;
- public static final int PG_TYPE_OIDVECTOR = 30;
- public static final int PG_TYPE_OIDARRAY = 1028;
- public static final int PG_TYPE_CHARARRAY = 1002;
- public static final int PG_TYPE_TEXTARRAY = 1009;
public PgCatalogMetadataStore(String modelName, Map<String, Datatype> dataTypes) throws TranslatorException {
super(modelName, 1, modelName, dataTypes, new Properties(), null);
@@ -62,6 +62,8 @@
addFunction("hasPerm", "has_function_privilege"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("getExpr2", "pg_get_expr"); //$NON-NLS-1$ //$NON-NLS-2$
addFunction("getExpr3", "pg_get_expr"); //$NON-NLS-1$ //$NON-NLS-2$
+ FunctionMethod func = addFunction("asPGVector", "asPGVector"); //$NON-NLS-1$ //$NON-NLS-2$
+ func.setProperty(ResolverVisitor.TEIID_PASS_THROUGH_TYPE, Boolean.TRUE.toString());
}
private Table createView(String name) throws TranslatorException {
@@ -213,7 +215,8 @@
// The OID of the pg_class entry for this index
addColumn("indexrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
// The OID of the pg_class entry for the table this index is for
- addColumn("indrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
+ addColumn("indrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
+ addColumn("indnatts", DataTypeManager.DefaultDataTypes.SHORT, t); //$NON-NLS-1$
// If true, the table was last clustered on this index
addColumn("indisclustered", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$
// If true, this is a unique index
@@ -224,20 +227,24 @@
// column references. This is a list with one element for each zero entry in indkey.
// NULL if all index attributes are simple references
addColumn("indexprs", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
+
// This is an array of indnatts values that indicate which table columns this index indexes.
- addColumn("indkey", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
+ Column c = addColumn("indkey", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
+ c.setRuntimeType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.SHORT)));
+ c.setProperty("pg_type:oid", String.valueOf(PG_TYPE_INT2VECTOR)); //$NON-NLS-1$
addPrimaryKey("pk_pg_index", Arrays.asList("oid"), t); //$NON-NLS-1$ //$NON-NLS-2$
- String transformation = "SELECT t1.OID as oid, " + //$NON-NLS-1$
- "t1.OID as indexrelid, " + //$NON-NLS-1$
+ String transformation = "SELECT min(t1.OID) as oid, " + //$NON-NLS-1$
+ "min(t1.OID) as indexrelid, " + //$NON-NLS-1$
"(SELECT OID FROM SYS.Tables WHERE SchemaName = t1.SchemaName AND Name = t1.TableName) as indrelid, " + //$NON-NLS-1$
+ "cast(count(t1.OID) as short) as indnatts, " + //$NON-NLS-1$
"false indisclustered, " + //$NON-NLS-1$
"(CASE t1.KeyType WHEN 'Unique' THEN true ELSE false END) as indisunique, " + //$NON-NLS-1$
"(CASE t1.KeyType WHEN 'Primary' THEN true ELSE false END) as indisprimary, " + //$NON-NLS-1$
- "'' as indexprs, " + //$NON-NLS-1$
- "'0' as indkey " + //$NON-NLS-1$
- "FROM SYS.KeyColumns as t1"; //$NON-NLS-1$
+ "'' as indexprs, asPGVector(" + //$NON-NLS-1$
+ arrayAgg("(select at.attnum FROM pg_attribute as at WHERE at.attname = t1.Name AND at.attrelid = (SELECT OID FROM SYS.Tables WHERE SchemaName = t1.SchemaName AND Name = t1.TableName))", "t1.position") +") as indkey " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "FROM SYS.KeyColumns as t1 GROUP BY t1.uid, t1.KeyType, t1.SchemaName, t1.TableName, t1.Name"; //$NON-NLS-1$
t.setSelectTransformation(transformation);
t.setMaterialized(true);
return t;
@@ -277,15 +284,20 @@
Column c = addColumn("proargtypes", DataTypeManager.DefaultDataTypes.OBJECT, t); //$NON-NLS-1$
c.setProperty("pg_type:oid", String.valueOf(PG_TYPE_OIDVECTOR)); //$NON-NLS-1$
+ c.setRuntimeType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.INTEGER)));
c = addColumn("proargnames", DataTypeManager.DefaultDataTypes.OBJECT, t); //$NON-NLS-1$
c.setProperty("pg_type:oid", String.valueOf(PG_TYPE_TEXTARRAY)); //$NON-NLS-1$
+ c.setRuntimeType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.STRING)));
c = addColumn("proargmodes", DataTypeManager.DefaultDataTypes.OBJECT, t); //$NON-NLS-1$
c.setProperty("pg_type:oid", String.valueOf(PG_TYPE_CHARARRAY)); //$NON-NLS-1$
+ //TODO: we don't yet understand that we can cast from string[] to char[]
+ c.setRuntimeType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.CHAR)));
c = addColumn("proallargtypes", DataTypeManager.DefaultDataTypes.OBJECT, t); //$NON-NLS-1$
c.setProperty("pg_type:oid", String.valueOf(PG_TYPE_OIDARRAY)); //$NON-NLS-1$
+ c.setRuntimeType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.INTEGER)));
// The OID of the namespace that contains this function
addColumn("pronamespace", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$
@@ -296,9 +308,9 @@
String transformation = "SELECT t1.OID as oid, t1.Name as proname, (SELECT (CASE WHEN count(pp.Type)>0 THEN true else false END) as x FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName and pp.Type='ResultSet') as proretset, " + //$NON-NLS-1$
"CASE WHEN (SELECT count(dt.oid) FROM ProcedureParams pp, matpg_datatype dt WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type IN ('ReturnValue', 'ResultSet') AND dt.Name = pp.DataType) IS NULL THEN (select oid from pg_type WHERE typname = 'void') WHEN (SELECT count(dt.oid) FROM ProcedureParams pp, matpg_datatype dt WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type = 'ResultSet' AND dt.Name = pp.DataType) IS NOT NULL THEN (select oid from pg_type WHERE typname = 'record') ELSE (SELECT dt.oid FROM ProcedureParams pp, matpg_datatype dt WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type = 'ReturnValue' AND dt.Name = pp.DataType) END as prorettype, " + //$NON-NLS-1$
"convert((SELECT count(*) FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type IN ('In', 'InOut')), short) as pronargs, " + //$NON-NLS-1$
- "(select "+arrayAgg("y.oid","y.type, y.position" )+" FROM ("+paramTable("'ResultSet','ReturnValue', 'Out'")+") as y) as proargtypes, " +//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "asPGVector((select "+arrayAgg("y.oid","y.type, y.position" )+" FROM ("+paramTable("'ResultSet','ReturnValue', 'Out'")+") as y)) as proargtypes, " +//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"(select "+arrayAgg("y.name", "y.type, y.position")+" FROM (SELECT pp.Name as name, pp.position as position, pp.Type as type FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue' )) as y) as proargnames, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "(select case WHEN count(distinct(y.type)) = 1 THEN null ELSE "+arrayAgg("CASE WHEN (y.type ='In') THEN 'i' WHEN (y.type = 'Out') THEN 'o' WHEN (y.type = 'InOut') THEN 'b' WHEN (y.type = 'ResultSet') THEN 't' END", "y.type,y.position")+" END FROM (SELECT pp.Type as type, pp.Position as position FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue')) as y) as proargmodes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "(select case WHEN count(distinct(y.type)) = 1 THEN null ELSE "+arrayAgg("CASE WHEN (y.type ='In') THEN cast('i' as char) WHEN (y.type = 'Out') THEN cast('o' as char) WHEN (y.type = 'InOut') THEN cast('b' as char) WHEN (y.type = 'ResultSet') THEN cast('t' as char) END", "y.type,y.position")+" END FROM (SELECT pp.Type as type, pp.Position as position FROM ProcedureParams pp WHERE pp.ProcedureName = t1.Name AND pp.SchemaName = t1.SchemaName AND pp.Type NOT IN ('ReturnValue')) as y) as proargmodes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"(select case WHEN count(distinct(y.oid)) = 1 THEN null ELSE "+arrayAgg("y.oid", "y.type, y.position")+" END FROM ("+paramTable("'ReturnValue'")+") as y) as proallargtypes, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"(SELECT OID FROM SYS.Schemas WHERE Name = t1.SchemaName) as pronamespace " + //$NON-NLS-1$
"FROM SYS.Procedures as t1";//$NON-NLS-1$
@@ -408,9 +420,11 @@
"1182,_date,-1,b,0,-1,0,1082\n" + //$NON-NLS-1$
"1183,_time,-1,b,0,-1,0,1083\n" + //$NON-NLS-1$
"2287,_record,-1,b,0,-1,0,2249\n" + //$NON-NLS-1$
- "2283,anyelement,4,p,0,-1,0,0" + //$NON-NLS-1$
+ "2283,anyelement,4,p,0,-1,0,0\n" + //$NON-NLS-1$
+ "22,int2vector,-1,b,0,-1,0,0" + //$NON-NLS-1$
"' columns oid integer, typname string, typlen short, typtype char, typbasetype integer, typtypmod integer, typrelid integer, typelem integer) AS t"; //$NON-NLS-1$
- t.setSelectTransformation(transformation);
+ t.setSelectTransformation(transformation);
+ t.setMaterialized(true);
return t;
}
@@ -540,5 +554,12 @@
@SuppressWarnings("unused") Boolean prettyPrint) {
return text;
}
+
+ public static Object asPGVector(Object obj) {
+ if (obj instanceof ArrayImpl) {
+ ((ArrayImpl)obj).setZeroBased(true);
+ }
+ return obj;
+ }
}
}
Modified: trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -599,7 +599,9 @@
// this call resolution is ambiguous
return "SELECT ''"; //$NON-NLS-1$
}
-
+ else if (sql.equals("SELECT typinput='array_in'::regproc, typtype FROM pg_catalog.pg_type WHERE typname = $1")) { //$NON-NLS-1$
+ return "SELECT substring(typname,1,1) = '_', typtype FROM pg_catalog.pg_type WHERE typname = ?"; //$NON-NLS-1$
+ }
}
else if (sql.equalsIgnoreCase("show max_identifier_length")){ //$NON-NLS-1$
return "select 63"; //$NON-NLS-1$
Modified: trunk/runtime/src/main/java/org/teiid/odbc/PGUtil.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/odbc/PGUtil.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/runtime/src/main/java/org/teiid/odbc/PGUtil.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -23,8 +23,6 @@
import java.sql.Types;
-import org.teiid.deployers.PgCatalogMetadataStore;
-
public class PGUtil {
public static final int PG_TYPE_VARCHAR = 1043;
@@ -41,10 +39,11 @@
public static final int PG_TYPE_FLOAT8 = 701;
public static final int PG_TYPE_UNKNOWN = 705;
- public static final int PG_TYPE_OIDVECTOR = PgCatalogMetadataStore.PG_TYPE_OIDVECTOR;
- public static final int PG_TYPE_OIDARRAY = PgCatalogMetadataStore.PG_TYPE_OIDARRAY;
- public static final int PG_TYPE_CHARARRAY = PgCatalogMetadataStore.PG_TYPE_CHARARRAY;
- public static final int PG_TYPE_TEXTARRAY = PgCatalogMetadataStore.PG_TYPE_TEXTARRAY;
+ public static final int PG_TYPE_OIDVECTOR = 30;
+ public static final int PG_TYPE_INT2VECTOR = 22;
+ public static final int PG_TYPE_OIDARRAY = 1028;
+ public static final int PG_TYPE_CHARARRAY = 1002;
+ public static final int PG_TYPE_TEXTARRAY = 1009;
public static final int PG_TYPE_DATE = 1082;
public static final int PG_TYPE_TIME = 1083;
Modified: trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -53,6 +53,7 @@
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.ssl.SslHandler;
import org.teiid.client.util.ResultsFuture;
+import org.teiid.core.types.ArrayImpl;
import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.core.util.ReflectionHelper;
import org.teiid.core.util.SqlUtil;
@@ -514,11 +515,11 @@
case PG_TYPE_TEXTARRAY:
case PG_TYPE_OIDARRAY:
{
- Object[] obj = (Object[])rs.getObject(column);
+ ArrayImpl obj = (ArrayImpl)rs.getObject(column);
if (obj != null) {
writer.append("{");
boolean first = true;
- for (Object o:obj) {
+ for (Object o:obj.getValues()) {
if (!first) {
writer.append(",");
}
@@ -538,13 +539,13 @@
}
}
break;
-
+ case PG_TYPE_INT2VECTOR:
case PG_TYPE_OIDVECTOR:
{
- Object[] obj = (Object[])rs.getObject(column);
+ ArrayImpl obj = (ArrayImpl)rs.getObject(column);
if (obj != null) {
boolean first = true;
- for (Object o:obj) {
+ for (Object o:obj.getValues()) {
if (!first) {
writer.append(" ");
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCProceduresSchema.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -23,6 +23,8 @@
import static org.junit.Assert.*;
+import java.sql.Array;
+
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -30,6 +32,7 @@
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.AbstractMMQueryTestCase;
import org.teiid.jdbc.FakeServer;
+import org.teiid.jdbc.TestMMDatabaseMetaData;
@SuppressWarnings("nls")
public class TestODBCProceduresSchema extends AbstractMMQueryTestCase {
@@ -63,10 +66,10 @@
assertEquals(true, this.internalResultSet.getBoolean(3)); //proretset
assertEquals(2249, this.internalResultSet.getInt(4)); //prorettype
assertEquals(14, this.internalResultSet.getInt(5)); //pronargs
- assertArrayEquals(new Object[] {1700,1043,700,20,701,21,1082,1083,1114,16,1043,21,1700,1700}, (Object[])this.internalResultSet.getObject(6)); //proargtypes
- assertArrayEquals(new Object[] {"intNum","stringNum","floatNum","longNum","doubleNum","byteNum","dateValue","timeValue","timestampValue","booValue","charValue","shortNum","bigIntNum","bigdecimalNum","col","col2"}, (Object[])this.internalResultSet.getObject(7)); //proargnames
- assertArrayEquals(new Object[] {"i","i","i","i","i","i","i","i","i","i","i","i","i","i","t","t"}, (Object[])this.internalResultSet.getObject(8)); //proargmodes
- assertArrayEquals(new Object[] {1700,1043,700,20,701,21,1082,1083,1114,16,1043,21,1700,1700,1043,1700}, (Object[])this.internalResultSet.getObject(9)); //proallargtypes
+ assertArrayEquals(new Object[] {1700,1043,700,20,701,21,1082,1083,1114,16,1043,21,1700,1700}, (Object[])((Array)this.internalResultSet.getObject(6)).getArray()); //proargtypes
+ assertArrayEquals(new Object[] {"intNum","stringNum","floatNum","longNum","doubleNum","byteNum","dateValue","timeValue","timestampValue","booValue","charValue","shortNum","bigIntNum","bigdecimalNum","col","col2"}, (Object[])((Array)this.internalResultSet.getObject(7)).getArray()); //proargnames
+ assertArrayEquals(new Object[] {'i','i','i','i','i','i','i','i','i','i','i','i','i','i','t','t'}, (Object[])((Array)this.internalResultSet.getObject(8)).getArray()); //proargmodes
+ assertArrayEquals(new Object[] {1700,1043,700,20,701,21,1082,1083,1114,16,1043,21,1700,1700,1043,1700}, (Object[])((Array)this.internalResultSet.getObject(9)).getArray()); //proallargtypes
assertEquals(1, this.internalResultSet.getInt(10)); //pronamespace
}
@@ -78,10 +81,10 @@
assertEquals(false, this.internalResultSet.getBoolean(3)); //proretset
assertEquals(2278, this.internalResultSet.getInt(4)); //prorettype
assertEquals(2, this.internalResultSet.getInt(5)); //pronargs
- assertArrayEquals(new Object[] {1700,1043}, (Object[])this.internalResultSet.getObject(6)); //proargtypes
- assertArrayEquals(new Object[] {"intNum","stringNum"}, (Object[])this.internalResultSet.getObject(7)); //proargnames
- assertArrayEquals(null, (Object[])this.internalResultSet.getObject(8)); //proargmodes
- assertArrayEquals(new Object[] {1700,1043}, (Object[])this.internalResultSet.getObject(9)); //proallargtypes
+ assertArrayEquals(new Object[] {1700,1043}, (Object[])((Array)this.internalResultSet.getObject(6)).getArray()); //proargtypes
+ assertArrayEquals(new Object[] {"intNum","stringNum"}, (Object[])((Array)this.internalResultSet.getObject(7)).getArray()); //proargnames
+ assertNull(this.internalResultSet.getObject(8)); //proargmodes
+ assertArrayEquals(new Object[] {1700,1043}, (Object[])((Array)this.internalResultSet.getObject(9)).getArray()); //proallargtypes
assertEquals(1, this.internalResultSet.getInt(10)); //pronamespace
}
@@ -93,25 +96,15 @@
assertEquals(false, this.internalResultSet.getBoolean(3)); //proretset
assertEquals(20, this.internalResultSet.getInt(4)); //prorettype
assertEquals(3, this.internalResultSet.getInt(5)); //pronargs
- assertArrayEquals(new Object[] {1700,1043,700}, (Object[])this.internalResultSet.getObject(6)); //proargtypes
- assertArrayEquals(new Object[] {"intNum","stringNum","floatNum"}, (Object[])this.internalResultSet.getObject(7)); //proargnames
- assertArrayEquals(null, (Object[])this.internalResultSet.getObject(8)); //proargmodes
- assertArrayEquals(new Object[] {1700,1043,700}, (Object[])this.internalResultSet.getObject(9)); //proallargtypes
+ assertArrayEquals(new Object[] {1700,1043,700}, (Object[])((Array)this.internalResultSet.getObject(6)).getArray()); //proargtypes
+ assertArrayEquals(new Object[] {"intNum","stringNum","floatNum"}, (Object[])((Array)this.internalResultSet.getObject(7)).getArray()); //proargnames
+ assertNull(this.internalResultSet.getObject(8)); //proargmodes
+ assertArrayEquals(new Object[] {1700,1043,700}, (Object[])((Array)this.internalResultSet.getObject(9)).getArray()); //proallargtypes
assertEquals(1, this.internalResultSet.getInt(10)); //pronamespace
}
@Test public void test_Pg_Proc_with_return_table() throws Exception {
execute("select oid, proname, proretset,prorettype, pronargs, proargtypes, proargnames, proargmodes, proallargtypes, pronamespace FROM pg_proc where proname='ProcedureReturnTable'"); //$NON-NLS-1$
- assertTrue(this.internalResultSet.next());
- assertEquals(2, this.internalResultSet.getInt(1)); //oid
- assertEquals("ProcedureReturnTable", this.internalResultSet.getString(2)); //proname
- assertEquals(true, this.internalResultSet.getBoolean(3)); //proretset
- assertEquals(2249, this.internalResultSet.getInt(4)); //prorettype
- assertEquals(2, this.internalResultSet.getInt(5)); //pronargs
- assertArrayEquals(new Object[] {1700,1700}, (Object[])this.internalResultSet.getObject(6)); //proargtypes
- assertArrayEquals(new Object[] {"intNum","bigDecimalNum","col1","col2"}, (Object[])this.internalResultSet.getObject(7)); //proargnames
- assertArrayEquals(new Object[] {"i","i","t","t"}, (Object[])this.internalResultSet.getObject(8)); //proargmodes
- assertArrayEquals(new Object[] {1700,1700,1043,1114}, (Object[])this.internalResultSet.getObject(9)); //proallargtypes
- assertEquals(1, this.internalResultSet.getInt(10)); //pronamespace
+ TestMMDatabaseMetaData.compareResultSet(this.internalResultSet);
}
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestODBCSchema.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -75,6 +75,11 @@
TestMMDatabaseMetaData.compareResultSet(this.internalResultSet);
}
+ @Test public void testOBIEEColumnQuery() throws Exception {
+ execute("select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class tc, pg_catalog.pg_index i, pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.oid = i.indrelid AND n.oid = tc.relnamespace AND i.indisprimary = 't' AND ia.attrelid = i.indexrelid AND ta.attrelid = i.indrelid AND ta.attnum = i.indkey[ia.attnum-1] AND (NOT ta.attisdropped) AND (NOT ia.attisdropped) AND ic.oid = i.indexrelid order by ia.attnum");
+ TestMMDatabaseMetaData.compareResultSet(this.internalResultSet);
+ }
+
@Test public void testOIDUniquness() throws Exception {
for (String table : new String[] {"Tables", "Columns", "Schemas", "DataTypes", "Keys", "Procedures", "ProcedureParams", "Properties"}) {
execute("select count(distinct oid), count(*) from SYS."+table);
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestSystemVirtualModel.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -266,4 +266,9 @@
assertEquals(cs.getBoolean(1), cs.getBoolean("logged"));
}
+ @Test public void testArrayAggType() throws Exception {
+ String sql = "SELECT array_agg(name) from tables"; //$NON-NLS-1$
+ checkResult("testArrayAggType", sql); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java 2012-08-31 18:45:31 UTC (rev 4388)
@@ -306,6 +306,7 @@
ResultSet rs = stmt.executeQuery("select * from pg_proc");
rs.next();
assertEquals("oid", rs.getArray("proargtypes").getBaseTypeName());
+ TestMMDatabaseMetaData.compareResultSet(rs); //compare the rest
}
// this does not work as JDBC always sends the queries in prepared form
@@ -384,4 +385,10 @@
assertTrue(rs.next());
assertEquals("Columns", rs.getString(1));
}
+
+ @Test public void testInt2Vector() throws Exception {
+ Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("select indkey FROM pg_index");
+ TestMMDatabaseMetaData.compareResultSet(rs);
+ }
}
Added: trunk/test-integration/common/src/test/resources/TestODBCProceduresSchema/test_Pg_Proc_with_return_table.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCProceduresSchema/test_Pg_Proc_with_return_table.expected (rev 0)
+++ trunk/test-integration/common/src/test/resources/TestODBCProceduresSchema/test_Pg_Proc_with_return_table.expected 2012-08-31 18:45:31 UTC (rev 4388)
@@ -0,0 +1,15 @@
+integer string boolean integer short integer[] string[] char[] integer[] integer
+oid proname proretset prorettype pronargs proargtypes proargnames proargmodes proallargtypes pronamespace
+2 ProcedureReturnTable true 2249 2 [1700, 1700] [intNum, bigDecimalNum, col1, col2] [i, i, t, t] [1700, 1700, 1043, 1114] 1
+Row Count : 1
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+oid 4 bqt java.lang.Integer oid integer pg_catalog pg_proc 11 10 0 false false false false 1 true true true false
+proname 12 bqt java.lang.String proname string pg_catalog pg_proc 4000 4000 0 false true false false 1 true true false false
+proretset -7 bqt java.lang.Boolean proretset boolean pg_catalog pg_proc 5 1 0 false false false false 1 true true false false
+prorettype 4 bqt java.lang.Integer prorettype integer pg_catalog pg_proc 11 10 0 false false false false 1 true true true false
+pronargs 5 bqt java.lang.Short pronargs short pg_catalog pg_proc 6 5 0 false false false false 1 true true true false
+proargtypes 2003 bqt java.sql.Array proargtypes integer[] pg_catalog pg_proc 2147483647 2147483647 0 false false false false 1 true false false false
+proargnames 2003 bqt java.sql.Array proargnames string[] pg_catalog pg_proc 2147483647 2147483647 0 false false false false 1 true false false false
+proargmodes 2003 bqt java.sql.Array proargmodes char[] pg_catalog pg_proc 2147483647 2147483647 0 false false false false 1 true false false false
+proallargtypes 2003 bqt java.sql.Array proallargtypes integer[] pg_catalog pg_proc 2147483647 2147483647 0 false false false false 1 true false false false
+pronamespace 4 bqt java.lang.Integer pronamespace integer pg_catalog pg_proc 11 10 0 false false false false 1 true true true false
Added: trunk/test-integration/common/src/test/resources/TestODBCSchema/testOBIEEColumnQuery.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/testOBIEEColumnQuery.expected (rev 0)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/testOBIEEColumnQuery.expected 2012-08-31 18:45:31 UTC (rev 4388)
@@ -0,0 +1,24 @@
+string short string string string
+attname attnum relname nspname relname
+PART_ID 1 PARTSSUPPLIER.PARTS PartsSupplier PARTSSUPPLIER.PARTS
+SHIPPER_ID 1 PARTSSUPPLIER.SHIP_VIA PartsSupplier PARTSSUPPLIER.SHIP_VIA
+STATUS_ID 1 PARTSSUPPLIER.STATUS PartsSupplier PARTSSUPPLIER.STATUS
+SUPPLIER_ID 1 PARTSSUPPLIER.SUPPLIER PartsSupplier PARTSSUPPLIER.SUPPLIER
+SUPPLIER_ID 1 Columns PartsSupplier PARTSSUPPLIER.SUPPLIER_PARTS
+PART_ID 1 DataTypes PartsSupplier PARTSSUPPLIER.SUPPLIER_PARTS
+oid 1 ProcedureParams pg_catalog matpg_datatype
+name 1 Procedures pg_catalog matpg_datatype
+attname 1 Schemas pg_catalog matpg_relatt
+relname 1 Tables pg_catalog matpg_relatt
+nspname 1 VirtualDatabases pg_catalog matpg_relatt
+oid 1 matpg_datatype pg_catalog pg_attribute
+oid 1 matpg_relatt pg_catalog pg_class
+oid 1 pg_am pg_catalog pg_index
+oid 1 pg_attrdef pg_catalog pg_proc
+Row Count : 15
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+attname 12 PartsSupplier java.lang.String attname string pg_catalog pg_attribute 4000 4000 0 false true false false 1 true true false false
+attnum 5 PartsSupplier java.lang.Short attnum short pg_catalog pg_attribute 6 5 0 false false false false 1 true true true false
+relname 12 PartsSupplier java.lang.String relname string pg_catalog pg_class 4000 4000 0 false true false false 1 true true false false
+nspname 12 PartsSupplier java.lang.String nspname string pg_catalog pg_namespace 4000 4000 0 false true false false 1 true true false false
+relname 12 PartsSupplier java.lang.String relname string pg_catalog pg_class 4000 4000 0 false true false false 1 true true false false
Modified: trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/test-integration/common/src/test/resources/TestODBCSchema/test_PG_INDEX.expected 2012-08-31 18:45:31 UTC (rev 4388)
@@ -1,34 +1,35 @@
-integer integer integer boolean boolean boolean string string
-oid indexrelid indrelid indisclustered indisunique indisprimary indexprs indkey
-1 1 1 false false true 0
-2 2 2 false false true 0
-3 3 3 false false true 0
-4 4 4 false false true 0
-5 5 4 false false false 0
-6 6 5 false false true 0
-7 7 5 false false true 0
-8 8 5 false false false 0
-9 9 5 false false false 0
-10 10 19 false false true 0
-11 11 19 false false true 0
-12 12 19 false false false 0
-13 13 19 false false false 0
-14 14 20 false false true 0
-15 15 20 false false true 0
-16 16 20 false false true 0
-17 17 20 false false false 0
-18 18 20 false false false 0
-19 19 23 false false true 0
-20 20 24 false false true 0
-21 21 26 false false true 0
-22 22 28 false false true 0
+integer integer integer short boolean boolean boolean string short[]
+oid indexrelid indrelid indnatts indisclustered indisunique indisprimary indexprs indkey
+1 1 1 1 false false true [1]
+2 2 2 1 false false true [1]
+3 3 3 1 false false true [1]
+4 4 4 1 false false true [1]
+5 5 4 1 false false false [3]
+6 6 5 1 false false true [1]
+7 7 5 1 false false true [2]
+8 8 5 1 false false false [2]
+9 9 5 1 false false false [1]
+10 10 19 1 false false true [1]
+11 11 19 1 false false true [3]
+12 12 19 1 false false false [2]
+13 13 19 1 false false false [1]
+14 14 20 1 false false true [3]
+15 15 20 1 false false true [4]
+16 16 20 1 false false true [5]
+17 17 20 1 false false false [1]
+18 18 20 1 false false false [2]
+19 19 23 1 false false true [1]
+20 20 24 1 false false true [1]
+21 21 26 1 false false true [1]
+22 22 28 1 false false true [1]
Row Count : 22
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
oid 4 PartsSupplier java.lang.Integer oid integer pg_catalog pg_index 11 10 0 false false false false 1 true true true false
indexrelid 4 PartsSupplier java.lang.Integer indexrelid integer pg_catalog pg_index 11 10 0 false false false false 1 true true true false
indrelid 4 PartsSupplier java.lang.Integer indrelid integer pg_catalog pg_index 11 10 0 false false false false 1 true true true false
+indnatts 5 PartsSupplier java.lang.Short indnatts short pg_catalog pg_index 6 5 0 false false false false 1 true true true false
indisclustered -7 PartsSupplier java.lang.Boolean indisclustered boolean pg_catalog pg_index 5 1 0 false false false false 1 true true false false
indisunique -7 PartsSupplier java.lang.Boolean indisunique boolean pg_catalog pg_index 5 1 0 false false false false 1 true true false false
indisprimary -7 PartsSupplier java.lang.Boolean indisprimary boolean pg_catalog pg_index 5 1 0 false false false false 1 true true false false
indexprs 12 PartsSupplier java.lang.String indexprs string pg_catalog pg_index 4000 4000 0 false true false false 1 true true false false
-indkey 12 PartsSupplier java.lang.String indkey string pg_catalog pg_index 4000 4000 0 false true false false 1 true true false false
+indkey 2003 PartsSupplier java.sql.Array indkey short[] pg_catalog pg_index 2147483647 4000 0 false true false false 1 true true false false
Added: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testArrayAggType.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testArrayAggType.expected (rev 0)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testArrayAggType.expected 2012-08-31 18:45:31 UTC (rev 4388)
@@ -0,0 +1,6 @@
+string[]
+expr1
+[PARTSSUPPLIER.PARTS, PARTSSUPPLIER.SHIP_VIA, PARTSSUPPLIER.STATU$
+Row Count : 1
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+expr1 2003 PartsSupplier java.sql.Array expr1 string[] <null> <null> 2147483647 0 0 false false false true 1 false true true true
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProperties.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProperties.expected 2012-08-31 18:16:59 UTC (rev 4387)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProperties.expected 2012-08-31 18:45:31 UTC (rev 4388)
@@ -1,10 +1,11 @@
string string string integer clob
Name Value UID OID ClobValue
-pg_type:oid 30 tid:7ff2755e9621-c69d9997-0000003a 1 Clob[2]
-pg_type:oid 1009 tid:7ff2755e9621-c63e1866-0000003b 2 Clob[4]
-pg_type:oid 1002 tid:7ff2755e9621-c6363c4e-0000003c 3 Clob[4]
-pg_type:oid 1028 tid:7ff2755e9621-f418fbbe-0000003d 4 Clob[4]
-Row Count : 4
+pg_type:oid 22 tid:7ff2755e9621-ef456826-00000030 1 Clob[2]
+pg_type:oid 30 tid:7ff2755e9621-c69d99b6-0000003b 2 Clob[2]
+pg_type:oid 1009 tid:7ff2755e9621-c63e1885-0000003c 3 Clob[4]
+pg_type:oid 1002 tid:7ff2755e9621-c6363c6d-0000003d 4 Clob[4]
+pg_type:oid 1028 tid:7ff2755e9621-f418fbdd-0000003e 5 Clob[4]
+Row Count : 5
getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
Name 12 PartsSupplier java.lang.String Name string SYS Properties 255 255 0 false true false false 0 true true false false
Value 12 PartsSupplier java.lang.String Value string SYS Properties 255 255 0 false true false false 0 true true false false
12 years, 4 months
teiid SVN: r4387 - in trunk/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-31 14:16:59 -0400 (Fri, 31 Aug 2012)
New Revision: 4387
Modified:
trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
Log:
TEIID-2179 correcting the type logic in aggregate symbol to use the descriptor type
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2012-08-31 11:39:54 UTC (rev 4386)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/AggregateSymbol.java 2012-08-31 18:16:59 UTC (rev 4387)
@@ -200,6 +200,11 @@
return DataTypeManager.DefaultDataClasses.OBJECT;
case TEXTAGG:
return DataTypeManager.DefaultDataClasses.BLOB;
+ case USER_DEFINED:
+ if (this.getFunctionDescriptor() == null) {
+ return null;
+ }
+ return this.getFunctionDescriptor().getReturnType();
}
if (isBoolean()) {
return DataTypeManager.DefaultDataClasses.BOOLEAN;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-08-31 11:39:54 UTC (rev 4386)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-08-31 18:16:59 UTC (rev 4387)
@@ -22,6 +22,7 @@
package org.teiid.query.processor;
+import static org.junit.Assert.*;
import static org.teiid.query.processor.TestProcessor.*;
import java.math.BigDecimal;
@@ -46,6 +47,7 @@
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import org.teiid.query.resolver.TestResolver;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -496,28 +498,44 @@
}
+ public static class LongSumAll implements UserDefinedAggregate<Long> {
+
+ private boolean isNull = true;
+ private long result;
+
+ public void addInput(Integer... vals) {
+ isNull = false;
+ for (int i : vals) {
+ result += i;
+ }
+ }
+
+ @Override
+ public Long getResult(org.teiid.CommandContext commandContext) {
+ if (isNull) {
+ return null;
+ }
+ return result;
+ }
+
+ @Override
+ public void reset() {
+ isNull = true;
+ result = 0;
+ }
+
+ }
+
@Test public void testUserDefined() throws Exception {
MetadataStore ms = RealMetadataFactory.example1Store();
Schema s = ms.getSchemas().get("PM1");
- FunctionMethod fm = new FunctionMethod();
- fm.setName("myagg");
- fm.setInvocationClass(SumAll.class.getName());
- fm.setInvocationMethod("addInput");
- FunctionParameter fp = new FunctionParameter();
- fp.setType(DataTypeManager.DefaultDataTypes.INTEGER);
- fp.setName("arg");
- fp.setVarArg(true);
- fm.getInputParameters().add(fp);
- FunctionParameter fpout = new FunctionParameter();
- fp.setType(DataTypeManager.DefaultDataTypes.INTEGER);
- fp.setName("outp");
- fm.setOutputParameter(fpout);
-
- AggregateAttributes aa = new AggregateAttributes();
- fm.setAggregateAttributes(aa);
- s.getFunctions().put(fm.getName(), fm);
+ AggregateAttributes aa = addAgg(s, "myagg", SumAll.class, DataTypeManager.DefaultDataTypes.INTEGER);
+ addAgg(s, "myagg2", LongSumAll.class, DataTypeManager.DefaultDataTypes.LONG);
TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(ms, "test");
+ Command c = TestResolver.helpResolve("select myagg2(distinct e2) from pm1.g1", metadata);
+ assertEquals(DataTypeManager.DefaultDataClasses.LONG, c.getProjectedSymbols().get(0).getType());
+
//must be in agg form
TestValidator.helpValidate("SELECT myagg(e2) from pm1.g1", new String[] {"myagg(e2)"}, metadata);
@@ -553,4 +571,25 @@
helpProcess(plan, dataManager, expected);
}
+ private AggregateAttributes addAgg(Schema s, String name, Class<?> clazz, String returns) {
+ FunctionMethod fm = new FunctionMethod();
+ fm.setName(name);
+ fm.setInvocationClass(clazz.getName());
+ fm.setInvocationMethod("addInput");
+ FunctionParameter fp = new FunctionParameter();
+ fp.setType(DataTypeManager.DefaultDataTypes.INTEGER);
+ fp.setName("arg");
+ fp.setVarArg(true);
+ fm.getInputParameters().add(fp);
+ FunctionParameter fpout = new FunctionParameter();
+ fpout.setType(returns);
+ fpout.setName("outp");
+ fm.setOutputParameter(fpout);
+
+ AggregateAttributes aa = new AggregateAttributes();
+ fm.setAggregateAttributes(aa);
+ s.getFunctions().put(fm.getName(), fm);
+ return aa;
+ }
+
}
12 years, 4 months
teiid SVN: r4386 - in trunk/engine/src: main/java/org/teiid/query/processor/relational and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-31 07:39:54 -0400 (Fri, 31 Aug 2012)
New Revision: 4386
Modified:
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
Log:
TEIID-2178 correctly detecting subqueries in agg expressions
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java 2012-08-30 18:55:26 UTC (rev 4385)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/PlanNode.java 2012-08-31 11:39:54 UTC (rev 4386)
@@ -30,6 +30,7 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.Criteria;
import org.teiid.query.sql.lang.SubqueryContainer;
@@ -404,6 +405,11 @@
}
break;
}
+ case NodeConstants.Types.GROUP: {
+ SymbolMap groupMap = (SymbolMap)this.getProperty(Info.SYMBOL_MAP);
+ toSearch = groupMap.getValues();
+ break;
+ }
}
return ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(toSearch);
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java 2012-08-30 18:55:26 UTC (rev 4385)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/GroupingNode.java 2012-08-31 11:39:54 UTC (rev 4386)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
@@ -47,6 +48,7 @@
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.processor.BatchCollector.BatchProducer;
import org.teiid.query.processor.relational.SortUtility.Mode;
+import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.lang.OrderBy;
import org.teiid.query.sql.lang.OrderByItem;
import org.teiid.query.sql.symbol.AggregateSymbol;
@@ -58,7 +60,7 @@
import org.teiid.query.util.CommandContext;
-public class GroupingNode extends RelationalNode {
+public class GroupingNode extends SubqueryAwareRelationalNode {
static class ProjectingTupleSource extends
BatchCollector.BatchProducerTupleSource {
@@ -106,7 +108,6 @@
private AggregateFunction[] functions;
private List<?> lastRow;
private List<?> currentGroupTuple;
- private Evaluator eval;
private static final int COLLECTION = 1;
private static final int SORT = 2;
@@ -324,11 +325,15 @@
public TupleSource getCollectionTupleSource() {
final RelationalNode sourceNode = this.getChildren()[0];
- return new ProjectingTupleSource(sourceNode, eval, new ArrayList<Expression>(collectedExpressions.keySet()));
+ return new ProjectingTupleSource(sourceNode, getEvaluator(elementMap), new ArrayList<Expression>(collectedExpressions.keySet()));
}
+
+ @Override
+ protected Collection<? extends LanguageObject> getObjects() {
+ return this.getChildren()[0].getOutputElements();
+ }
private void collectionPhase() {
- eval = new Evaluator(elementMap, getDataManager(), getContext());
if(this.orderBy == null) {
// No need to sort
this.groupTupleSource = getCollectionTupleSource();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-08-30 18:55:26 UTC (rev 4385)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java 2012-08-31 11:39:54 UTC (rev 4386)
@@ -141,7 +141,29 @@
// Run query
helpProcess(plan, dataManager, expected);
}
+
+ @Test public void testAggregateSubquery() throws Exception {
+ // Create query
+ String sql = "SELECT IntKey, SUM((select IntNum from bqt1.smallb where intkey = smalla.intkey)) FROM BQT1.SmallA GROUP BY IntKey, IntNum HAVING IntNum > 10 ORDER BY IntKey"; //$NON-NLS-1$
+ // Create expected results
+ List[] expected = new List[] {
+ Arrays.asList(new Object[] { 1, 2l }),
+ Arrays.asList(new Object[] { 2, 3l }) };
+
+ // Construct data manager with data
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ dataManager.addData("SELECT g_0.IntKey, g_0.IntNum FROM BQT1.SmallA AS g_0 WHERE g_0.IntNum > 10", new List<?>[] {Arrays.asList(1, 2), Arrays.asList(2, 3)});
+ dataManager.addData("SELECT g_0.IntNum FROM BQT1.SmallB AS g_0 WHERE g_0.IntKey = 1", new List<?>[] {Arrays.asList(2)});
+ dataManager.addData("SELECT g_0.IntNum FROM BQT1.SmallB AS g_0 WHERE g_0.IntKey = 2", new List<?>[] {Arrays.asList(3)});
+
+ // Plan query
+ ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.exampleBQTCached(), TestOptimizer.getGenericFinder());
+
+ // Run query
+ helpProcess(plan, dataManager, expected);
+ }
+
@Test public void testAggregateOnBQT2() throws Exception {
// Create query
String sql = "SELECT IntNum, IsNotNull FROM (SELECT IntNum, LongNum, COUNT(IntNum) AS IsNotNull FROM BQT1.SmallA GROUP BY IntNum, LongNum HAVING LongNum IS NULL ) AS x ORDER BY IntNum, IsNotNull"; //$NON-NLS-1$
12 years, 4 months
teiid SVN: r4385 - trunk/engine/src/test/java/org/teiid/query/processor/eval.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-30 14:55:26 -0400 (Thu, 30 Aug 2012)
New Revision: 4385
Modified:
trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
Log:
TEIID-2111 fixing unit test
Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-08-30 18:09:32 UTC (rev 4384)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-08-30 18:55:26 UTC (rev 4385)
@@ -77,8 +77,10 @@
elements.put(elementList[i], i);
}
}
-
- List<Object> tuple = Arrays.asList(valueList);
+ List<Object> tuple = null;
+ if (valueList != null) {
+ tuple = Arrays.asList(valueList);
+ }
return new Evaluator(elements, dataMgr, context).evaluate(expr, tuple);
}
12 years, 4 months
teiid SVN: r4384 - in trunk/test-integration/common/src/test/resources: TestPartsDatabaseMetadata and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-30 14:09:32 -0400 (Thu, 30 Aug 2012)
New Revision: 4384
Modified:
trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected
trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected
trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
Log:
TEIID-2111 return params are now forced to be the first param (jdbc convention)
Modified: trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected 2012-08-30 18:08:53 UTC (rev 4383)
+++ trunk/test-integration/common/src/test/resources/TestMMDatabaseMetaData/testGetProcedureColumns.expected 2012-08-30 18:09:32 UTC (rev 4384)
@@ -50,12 +50,12 @@
QT_Ora9DS SYSADMIN logMsg context 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 3 NO logMsg
QT_Ora9DS SYSADMIN logMsg msg 1 2000 object 2147483647 2147483647 0 0 0 <null> <null> <null> <null> <null> 4 NO logMsg
QT_Ora9DS SYSADMIN logMsg logged 5 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 1 NO logMsg
-QT_Ora9DS SYSADMIN refreshMatView ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 1 NO refreshMatView
-QT_Ora9DS SYSADMIN refreshMatView Invalidate 1 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 2 NO refreshMatView
-QT_Ora9DS SYSADMIN refreshMatView RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatView
-QT_Ora9DS SYSADMIN refreshMatViewRow ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 1 NO refreshMatViewRow
-QT_Ora9DS SYSADMIN refreshMatViewRow Key 1 2000 object 2147483647 2147483647 0 0 0 <null> <null> <null> <null> <null> 2 NO refreshMatViewRow
-QT_Ora9DS SYSADMIN refreshMatViewRow RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatViewRow
+QT_Ora9DS SYSADMIN refreshMatView ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 2 NO refreshMatView
+QT_Ora9DS SYSADMIN refreshMatView Invalidate 1 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatView
+QT_Ora9DS SYSADMIN refreshMatView RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 1 NO refreshMatView
+QT_Ora9DS SYSADMIN refreshMatViewRow ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 2 NO refreshMatViewRow
+QT_Ora9DS SYSADMIN refreshMatViewRow Key 1 2000 object 2147483647 2147483647 0 0 0 <null> <null> <null> <null> <null> 3 NO refreshMatViewRow
+QT_Ora9DS SYSADMIN refreshMatViewRow RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 1 NO refreshMatViewRow
QT_Ora9DS SYSADMIN setColumnStats tableName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 1 NO setColumnStats
QT_Ora9DS SYSADMIN setColumnStats columnName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 2 NO setColumnStats
QT_Ora9DS SYSADMIN setColumnStats distinctCount 1 4 integer 10 4 0 10 1 <null> <null> <null> <null> <null> 3 YES setColumnStats
Modified: trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected 2012-08-30 18:08:53 UTC (rev 4383)
+++ trunk/test-integration/common/src/test/resources/TestPartsDatabaseMetadata/testProcedureColumns.expected 2012-08-30 18:09:32 UTC (rev 4384)
@@ -9,12 +9,12 @@
PartsSupplier SYSADMIN logMsg context 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 3 NO logMsg
PartsSupplier SYSADMIN logMsg msg 1 2000 object 2147483647 2147483647 0 0 0 <null> <null> <null> <null> <null> 4 NO logMsg
PartsSupplier SYSADMIN logMsg logged 5 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 1 NO logMsg
-PartsSupplier SYSADMIN refreshMatView ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 1 NO refreshMatView
-PartsSupplier SYSADMIN refreshMatView Invalidate 1 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 2 NO refreshMatView
-PartsSupplier SYSADMIN refreshMatView RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatView
-PartsSupplier SYSADMIN refreshMatViewRow ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 1 NO refreshMatViewRow
-PartsSupplier SYSADMIN refreshMatViewRow Key 1 2000 object 2147483647 2147483647 0 0 0 <null> <null> <null> <null> <null> 2 NO refreshMatViewRow
-PartsSupplier SYSADMIN refreshMatViewRow RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatViewRow
+PartsSupplier SYSADMIN refreshMatView ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 2 NO refreshMatView
+PartsSupplier SYSADMIN refreshMatView Invalidate 1 -7 boolean 1 1 0 10 0 <null> <null> <null> <null> <null> 3 NO refreshMatView
+PartsSupplier SYSADMIN refreshMatView RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 1 NO refreshMatView
+PartsSupplier SYSADMIN refreshMatViewRow ViewName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 2 NO refreshMatViewRow
+PartsSupplier SYSADMIN refreshMatViewRow Key 1 2000 object 2147483647 2147483647 0 0 0 <null> <null> <null> <null> <null> 3 NO refreshMatViewRow
+PartsSupplier SYSADMIN refreshMatViewRow RowsUpdated 5 4 integer 10 4 0 10 0 <null> <null> <null> <null> <null> 1 NO refreshMatViewRow
PartsSupplier SYSADMIN setColumnStats tableName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 1 NO setColumnStats
PartsSupplier SYSADMIN setColumnStats columnName 1 12 string 4000 4000 0 0 0 <null> <null> <null> <null> <null> 2 NO setColumnStats
PartsSupplier SYSADMIN setColumnStats distinctCount 1 4 integer 10 4 0 10 1 <null> <null> <null> <null> <null> 3 YES setColumnStats
Modified: trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected 2012-08-30 18:08:53 UTC (rev 4383)
+++ trunk/test-integration/common/src/test/resources/TestSystemVirtualModel/testProcedureParams.expected 2012-08-30 18:09:32 UTC (rev 4384)
@@ -1,15 +1,15 @@
string string string string string integer string boolean integer integer integer integer string string string integer
VDBName SchemaName ProcedureName Name DataType Position Type Optional Precision TypeLength Scale Radix NullType UID Description OID
-PartsSupplier SYSADMIN refreshMatView Invalidate boolean 2 In false 1 1 0 10 No Nulls tid:60b87e792634-09a20d5b-00000019 <null> 11
-PartsSupplier SYSADMIN refreshMatViewRow Key object 2 In false 0 2147483647 0 0 No Nulls tid:60b87e792634-0001263f-0000001d <null> 14
+PartsSupplier SYSADMIN refreshMatView Invalidate boolean 3 In false 1 1 0 10 No Nulls tid:60b87e792634-09a20d5b-0000001a <null> 12
+PartsSupplier SYSADMIN refreshMatViewRow Key object 3 In false 0 2147483647 0 0 No Nulls tid:60b87e792634-0001263f-0000001e <null> 15
PartsSupplier SYSADMIN setProperty Name string 3 In false 0 4000 0 0 No Nulls tid:60b87e792634-0024eeab-00000029 <null> 24
PartsSupplier SYSADMIN setProperty OldValue clob 1 ReturnValue false 0 2097152 0 0 No Nulls tid:60b87e792634-0f2c17aa-00000027 <null> 22
-PartsSupplier SYSADMIN refreshMatView RowsUpdated integer 3 ReturnValue false 10 4 0 10 No Nulls tid:60b87e792634-884f8882-0000001a <null> 12
-PartsSupplier SYSADMIN refreshMatViewRow RowsUpdated integer 3 ReturnValue false 10 4 0 10 No Nulls tid:60b87e792634-884f8882-0000001e <null> 15
+PartsSupplier SYSADMIN refreshMatView RowsUpdated integer 1 ReturnValue false 10 4 0 10 No Nulls tid:60b87e792634-884f8882-00000018 <null> 10
+PartsSupplier SYSADMIN refreshMatViewRow RowsUpdated integer 1 ReturnValue false 10 4 0 10 No Nulls tid:60b87e792634-884f8882-0000001c <null> 13
PartsSupplier SYSADMIN setProperty UID string 2 In false 0 50 0 0 No Nulls tid:60b87e792634-00014830-00000028 <null> 23
PartsSupplier SYSADMIN setProperty Value clob 4 In false 0 2097152 0 0 Nullable tid:60b87e792634-04e9a151-0000002a <null> 25
-PartsSupplier SYSADMIN refreshMatView ViewName string 1 In false 0 4000 0 0 No Nulls tid:60b87e792634-4b1eb2f0-00000018 <null> 10
-PartsSupplier SYSADMIN refreshMatViewRow ViewName string 1 In false 0 4000 0 0 No Nulls tid:60b87e792634-4b1eb2f0-0000001c <null> 13
+PartsSupplier SYSADMIN refreshMatView ViewName string 2 In false 0 4000 0 0 No Nulls tid:60b87e792634-4b1eb2f0-00000019 <null> 11
+PartsSupplier SYSADMIN refreshMatViewRow ViewName string 2 In false 0 4000 0 0 No Nulls tid:60b87e792634-4b1eb2f0-0000001d <null> 14
PartsSupplier SYSADMIN setTableStats cardinality integer 2 In false 10 4 0 10 No Nulls tid:60b87e792634-3260ed8e-0000002d <null> 27
PartsSupplier SYSADMIN setColumnStats columnName string 2 In false 0 4000 0 0 No Nulls tid:60b87e792634-827e2701-00000021 <null> 17
PartsSupplier SYSADMIN isLoggable context string 3 In false 0 4000 0 0 No Nulls tid:60b87e792634-38b735af-00000011 <null> 5
12 years, 4 months
teiid SVN: r4383 - in trunk: client/src/test/java/org/teiid/client and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-30 14:08:53 -0400 (Thu, 30 Aug 2012)
New Revision: 4383
Removed:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SerializableTupleBatch.java
Modified:
trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
trunk/client/src/test/java/org/teiid/client/TestBatchSerializer.java
trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
Log:
TEIID-2171 various cleanups/performance tweaks
Modified: trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/client/src/main/java/org/teiid/jdbc/BaseDataSource.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -241,8 +241,8 @@
props.setProperty(ExecutionProperties.NOEXEC, String.valueOf(this.isNoExec()));
}
- if ( this.getTransactionAutoWrap() != null && this.getTransactionAutoWrap().trim().length() != 0 ) {
- props.setProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP, this.getTransactionAutoWrap());
+ if ( this.getAutoCommitTxn() != null && this.getAutoCommitTxn().trim().length() != 0 ) {
+ props.setProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP, this.getAutoCommitTxn());
}
if (this.getDisableLocalTxn() != null) {
@@ -250,7 +250,7 @@
}
if (!this.getUseJDBC4ColumnNameAndLabelSemantics()) {
- props.setProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS, "false");
+ props.setProperty(ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS, Boolean.FALSE.toString());
}
if (this.additionalProperties != null) {
Modified: trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -124,11 +124,6 @@
private void setExecutionProperties(Properties info) {
this.propInfo = new Properties();
- String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
- if ( overrideProp == null || overrideProp.trim().length() == 0 ) {
- propInfo.put(ExecutionProperties.PROP_TXN_AUTO_WRAP, ExecutionProperties.TXN_WRAP_DETECT);
- }
-
String defaultFetchSize = info.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
if (defaultFetchSize != null) {
propInfo.put(ExecutionProperties.PROP_FETCH_SIZE, defaultFetchSize);
@@ -158,11 +153,9 @@
}
for (String key : info.stringPropertyNames()) {
- for (String prop : JDBCURL.EXECUTION_PROPERTIES) {
- if (prop.equalsIgnoreCase(key)) {
- propInfo.setProperty(key, info.getProperty(key));
- break;
- }
+ String actualKey = JDBCURL.EXECUTION_PROPERTIES.get(key);
+ if (actualKey != null) {
+ propInfo.setProperty(actualKey, info.getProperty(key));
}
}
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -32,6 +32,7 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -47,20 +48,27 @@
static final String URL_PATTERN = JDBC_PROTOCOL + "([\\w-\\.]+)(?:@([^;]*))?(;.*)?"; //$NON-NLS-1$
static Pattern urlPattern = Pattern.compile(URL_PATTERN);
- public static final Set<String> EXECUTION_PROPERTIES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
- ExecutionProperties.PROP_TXN_AUTO_WRAP,
- ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
- ExecutionProperties.RESULT_SET_CACHE_MODE,
- ExecutionProperties.ANSI_QUOTED_IDENTIFIERS,
- ExecutionProperties.SQL_OPTION_SHOWPLAN,
- ExecutionProperties.NOEXEC,
- ExecutionProperties.PROP_FETCH_SIZE,
- ExecutionProperties.PROP_XML_FORMAT,
- ExecutionProperties.PROP_XML_VALIDATION,
- EmbeddedProfile.USE_CALLING_THREAD,
- ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS,
- ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS)));
-
+ public static final Map<String, String> EXECUTION_PROPERTIES = Collections.unmodifiableMap(buildProps());
+
+ private static Map<String, String> buildProps() {
+ Map<String, String> result = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
+ for (String key : new String[] {ExecutionProperties.PROP_TXN_AUTO_WRAP,
+ ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
+ ExecutionProperties.RESULT_SET_CACHE_MODE,
+ ExecutionProperties.ANSI_QUOTED_IDENTIFIERS,
+ ExecutionProperties.SQL_OPTION_SHOWPLAN,
+ ExecutionProperties.NOEXEC,
+ ExecutionProperties.PROP_FETCH_SIZE,
+ ExecutionProperties.PROP_XML_FORMAT,
+ ExecutionProperties.PROP_XML_VALIDATION,
+ EmbeddedProfile.USE_CALLING_THREAD,
+ ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS,
+ ExecutionProperties.JDBC4COLUMNNAMEANDLABELSEMANTICS}) {
+ result.put(key, key);
+ }
+ return result;
+ }
+
public static final Set<String> KNOWN_PROPERTIES = getKnownProperties();
private static Set<String> getKnownProperties() {
@@ -78,7 +86,7 @@
TeiidURL.CONNECTION.JAAS_NAME,
TeiidURL.CONNECTION.KERBEROS_SERVICE_PRINCIPLE_NAME,
TeiidURL.CONNECTION.ENCRYPT_REQUESTS));
- props.addAll(EXECUTION_PROPERTIES);
+ props.addAll(EXECUTION_PROPERTIES.keySet());
return Collections.unmodifiableSet(props);
}
Modified: trunk/client/src/test/java/org/teiid/client/TestBatchSerializer.java
===================================================================
--- trunk/client/src/test/java/org/teiid/client/TestBatchSerializer.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/client/src/test/java/org/teiid/client/TestBatchSerializer.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -22,6 +22,8 @@
package org.teiid.client;
+import static org.junit.Assert.*;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -32,19 +34,16 @@
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.teiid.core.types.BinaryType;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.TimestampWithTimezone;
-
-
/**
* @since 4.2
*/
-public class TestBatchSerializer extends TestCase {
+public class TestBatchSerializer {
private static void helpTestSerialization(String[] types, List<?>[] batch) throws IOException, ClassNotFoundException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
@@ -117,7 +116,7 @@
return batch;
}
- public void testSerializeBasicTypes() throws Exception {
+ @Test public void testSerializeBasicTypes() throws Exception {
// The number 8 is important here because boolean isNull information is packed into bytes,
// so we want to make sure the boundary cases are handled correctly
helpTestSerialization(sampleBatchTypes, sampleBatchWithNulls(1)); // Less than 8 rows
@@ -128,16 +127,16 @@
helpTestSerialization(sampleBatchTypes, sampleBatchWithNulls(4096)); // A bunch of rows. This should also test large strings
}
- public void testSerializeLargeStrings() throws Exception {
+ @Test public void testSerializeLargeStrings() throws Exception {
List<?> row = Arrays.asList(new Object[] {sampleString(66666)});
helpTestSerialization(new String[] {DataTypeManager.DefaultDataTypes.STRING}, new List[] {row});
}
- public void testSerializeNoData() throws Exception {
+ @Test public void testSerializeNoData() throws Exception {
helpTestSerialization(sampleBatchTypes, new List[0]);
}
- public void testSerializeDatatypeMismatch() throws Exception {
+ @Test public void testSerializeDatatypeMismatch() throws Exception {
try {
helpTestSerialization(new String[] {DataTypeManager.DefaultDataTypes.DOUBLE}, new List[] {Arrays.asList(new Object[] {"Hello!"})}); //$NON-NLS-1$
} catch (RuntimeException e) {
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDataSource.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -26,6 +26,7 @@
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.Properties;
import junit.framework.TestCase;
@@ -71,7 +72,7 @@
dataSource.setDatabaseName(STD_DATABASE_NAME);
dataSource.setPortNumber(STD_PORT_NUMBER);
dataSource.setDataSourceName(STD_DATA_SOURCE_NAME);
- dataSource.setTransactionAutoWrap(STD_TXN_WRAP);
+ dataSource.setAutoCommitTxn(STD_TXN_WRAP);
dataSource.setPartialResultsMode(STD_PARTIAL_MODE);
dataSource.setSecure(true);
dataSource.setAlternateServers(STD_ALTERNATE_SERVERS);
@@ -161,7 +162,7 @@
ds.setDatabaseName(vdbName);
ds.setPortNumber(portNumber);
ds.setFetchSize(fetchSize);
- ds.setTransactionAutoWrap(txnAutoWrap);
+ ds.setAutoCommitTxn(txnAutoWrap);
ds.setPartialResultsMode(partialMode);
if(showPlan) {
ds.setShowPlan(ShowPlan.ON.toString());
@@ -196,7 +197,7 @@
ds.setUser(user);
ds.setPassword(password);
ds.setDataSourceName(dataSourceName);
- ds.setTransactionAutoWrap(txnAutoWrap);
+ ds.setAutoCommitTxn(txnAutoWrap);
ds.setPartialResultsMode(partialMode);
ds.setAlternateServers(alternateServers);
ds.setUseJDBC4ColumnNameAndLabelSemantics(true);
@@ -272,7 +273,9 @@
}
public void testGetTransactionAutoWrap() {
- final String result = dataSource.getTransactionAutoWrap();
+ final String result = dataSource.getAutoCommitTxn();
+ Properties p = dataSource.buildProperties("foo", "bar");
+ assertEquals(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP), STD_TXN_WRAP);
assertEquals(result,STD_TXN_WRAP);
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/BufferManagerImpl.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -55,7 +55,6 @@
import org.teiid.core.types.Streamable;
import org.teiid.core.types.DataTypeManager.WeakReferenceHashedValueCache;
import org.teiid.dqp.internal.process.DQPConfiguration;
-import org.teiid.dqp.internal.process.SerializableTupleBatch;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
@@ -998,6 +997,7 @@
try {
ObjectOutputStream out = new ObjectOutputStream(ostream);
getTupleBufferState(out, buffer);
+ out.flush();
} catch (TeiidComponentException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30054, e);
} catch (IOException e) {
@@ -1012,7 +1012,7 @@
out.writeObject(buffer.getTypes());
for (int row = 1; row <= buffer.getRowCount(); row+=buffer.getBatchSize()) {
TupleBatch b = buffer.getBatch(row);
- out.writeObject(new SerializableTupleBatch(b, buffer.getTypes()));
+ BatchSerializer.writeBatch(out, buffer.getTypes(), b.getTuples());
}
}
@@ -1053,13 +1053,15 @@
buffer.setId(state_id);
for (int row = 1; row <= rowCount; row+=batchSize) {
- TupleBatch batch = (TupleBatch)in.readObject();
- if (batch == null) {
- buffer.remove();
- throw new IOException(QueryPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
- }
- buffer.addTupleBatch(batch, true);
+ List<List<Object>> batch = BatchSerializer.readBatch(in, types);
+ for (int i = 0; i < batch.size(); i++) {
+ buffer.addTuple(batch.get(i));
+ }
}
+ if (buffer.getRowCount() != rowCount) {
+ buffer.remove();
+ throw new IOException(QueryPlugin.Util.getString("not_found_cache")); //$NON-NLS-1$
+ }
buffer.close();
addTupleBuffer(buffer);
}
Deleted: trunk/engine/src/main/java/org/teiid/dqp/internal/process/SerializableTupleBatch.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/SerializableTupleBatch.java 2012-08-30 17:48:02 UTC (rev 4382)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/SerializableTupleBatch.java 2012-08-30 18:08:53 UTC (rev 4383)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.List;
-
-import org.teiid.client.BatchSerializer;
-import org.teiid.common.buffer.TupleBatch;
-import org.teiid.core.util.ExternalizeUtil;
-
-public class SerializableTupleBatch extends TupleBatch implements Externalizable {
-
- private String[] types;
-
- public SerializableTupleBatch() {
- //for Externalizable
- }
-
- public SerializableTupleBatch(TupleBatch batch, String[] types) {
- super(batch.getBeginRow(), batch.getTuples());
- this.types = types;
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- String[] types = ExternalizeUtil.readStringArray(in);
- this.setRowOffset(in.readInt());
- this.setTerminationFlag(in.readBoolean());
- this.tuples = (List)BatchSerializer.readBatch(in, types);
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- ExternalizeUtil.writeArray(out, types);
- out.writeInt(this.getBeginRow());
- out.writeBoolean(this.getTerminationFlag());
- BatchSerializer.writeBatch(out, types, this.getTuples());
- }
-
-}
12 years, 4 months
teiid SVN: r4382 - in trunk: api/src/main/java/org/teiid/metadata and 27 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-30 13:48:02 -0400 (Thu, 30 Aug 2012)
New Revision: 4382
Modified:
trunk/api/src/main/java/org/teiid/language/SQLConstants.java
trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java
trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java
trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java
trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadata.java
trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadataWrapper.java
trunk/engine/src/main/java/org/teiid/query/metadata/DDLStringVisitor.java
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/engine/src/main/java/org/teiid/query/metadata/QueryMetadataInterface.java
trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java
trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/SPParameter.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
trunk/engine/src/main/resources/org/teiid/metadata/SYSADMIN.sql
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/query/metadata/TestDDLStringVisitor.java
trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java
trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
trunk/engine/src/test/java/org/teiid/query/resolver/CheckNoTempMetadataIDsVisitor.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java
trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java
Log:
TEIID-2111 adding support for procedure varargs
Modified: trunk/api/src/main/java/org/teiid/language/SQLConstants.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/SQLConstants.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/api/src/main/java/org/teiid/language/SQLConstants.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -119,11 +119,12 @@
public static final String TRIM = "TRIM"; //$NON-NLS-1$
public static final String RESULT = "RESULT"; //$NON-NLS-1$
- public static final Object OBJECTTABLE = "OBJECTTABLE"; //$NON-NLS-1$
- public static final Object VERSION = "VERSION"; //$NON-NLS-1$
- public static final Object INCLUDING = "INCLUDING"; //$NON-NLS-1$
- public static final Object EXCLUDING = "EXCLUDING"; //$NON-NLS-1$
- public static final Object XMLDECLARATION = "XMLDECLARATION"; //$NON-NLS-1$
+ public static final String OBJECTTABLE = "OBJECTTABLE"; //$NON-NLS-1$
+ public static final String VERSION = "VERSION"; //$NON-NLS-1$
+ public static final String INCLUDING = "INCLUDING"; //$NON-NLS-1$
+ public static final String EXCLUDING = "EXCLUDING"; //$NON-NLS-1$
+ public static final String XMLDECLARATION = "XMLDECLARATION"; //$NON-NLS-1$
+ public static final String VARIADIC = "VARIADIC"; //$NON-NLS-1$
}
public interface Reserved {
Modified: trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/api/src/main/java/org/teiid/metadata/FunctionMethod.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -485,14 +485,14 @@
FunctionMethod function) {
String deterministic = procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "deterministic", true); //$NON-NLS-1$
boolean nullOnNull = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "null-on-null", true)); //$NON-NLS-1$
- boolean varargs = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "varargs", true)); //$NON-NLS-1$
+ String varargs = procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "varargs", true); //$NON-NLS-1$
boolean aggregate = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "aggregate", true)); //$NON-NLS-1$
if (deterministic != null) {
function.setDeterminism(Boolean.valueOf(deterministic)?Determinism.DETERMINISTIC:Determinism.NONDETERMINISTIC);
}
function.setNullOnNull(nullOnNull);
- if (varargs && !function.getInputParameters().isEmpty()) {
- function.getInputParameters().get(function.getInputParameterCount() - 1).setVarArg(varargs);
+ if (varargs != null && !function.getInputParameters().isEmpty()) {
+ function.getInputParameters().get(function.getInputParameterCount() - 1).setVarArg(Boolean.valueOf(varargs));
}
if (aggregate) {
boolean analytic = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "analytic", true)); //$NON-NLS-1$
Modified: trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -31,6 +31,7 @@
import java.util.TreeMap;
import org.teiid.connector.DataPlugin;
+import org.teiid.metadata.ProcedureParameter.Type;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.TypeFacility;
@@ -297,8 +298,15 @@
param.setType(parameterType);
param.setProcedure(procedure);
setColumnType(type, param);
- procedure.getParameters().add(param);
- param.setPosition(procedure.getParameters().size()); //1 based indexing
+ if (parameterType == Type.ReturnValue) {
+ procedure.getParameters().add(0, param);
+ for (int i = 0; i < procedure.getParameters().size(); i++) {
+ procedure.getParameters().get(i).setPosition(i+1); //1 based indexing
+ }
+ } else {
+ procedure.getParameters().add(param);
+ param.setPosition(procedure.getParameters().size()); //1 based indexing
+ }
return param;
}
Modified: trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/common-core/src/main/java/org/teiid/core/types/DataTypeManager.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -23,6 +23,7 @@
package org.teiid.core.types;
import java.lang.ref.WeakReference;
+import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Blob;
@@ -65,6 +66,7 @@
*/
public class DataTypeManager {
+ private static final String ARRAY_SUFFIX = "[]"; //$NON-NLS-1$
private static final boolean USE_VALUE_CACHE = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.useValueCache", false); //$NON-NLS-1$
private static final boolean COMPARABLE_LOBS = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.comparableLobs", false); //$NON-NLS-1$
private static final boolean COMPARABLE_OBJECT = PropertiesUtils.getBooleanProperty(System.getProperties(), "org.teiid.comparableObject", false); //$NON-NLS-1$
@@ -377,6 +379,9 @@
}
if (dataTypeClass == null) {
+ if (name.endsWith(ARRAY_SUFFIX)) {
+ return getArrayType(getDataTypeClass(name.substring(0, name.length() - 2)));
+ }
dataTypeClass = DefaultDataClasses.OBJECT;
}
return dataTypeClass;
@@ -386,9 +391,11 @@
if (typeClass == null) {
return DefaultDataTypes.NULL;
}
-
String result = dataTypeClasses.get(typeClass);
if (result == null) {
+ if (typeClass.isArray()) {
+ return getDataTypeName(typeClass.getComponentType()) + ARRAY_SUFFIX;
+ }
result = DefaultDataTypes.OBJECT;
}
@@ -905,4 +912,8 @@
|| type == DataTypeManager.DefaultDataClasses.OBJECT);
}
+ public static Class<?> getArrayType(Class<?> classType) {
+ return Array.newInstance(classType, 0).getClass();
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -551,7 +551,7 @@
}
org.teiid.language.Array translate(Array array) {
- return new org.teiid.language.Array(array.getBaseType(), translateExpressionList(array.getExpressions()));
+ return new org.teiid.language.Array(array.getComponentType(), translateExpressionList(array.getExpressions()));
}
org.teiid.language.WindowFunction translate(WindowFunction windowFunction) {
@@ -819,6 +819,14 @@
//we can assume for now that all arguments will be literals, which may be multivalued
Literal value = null;
if (direction != Direction.OUT) {
+ if (param.isVarArg()) {
+ ArrayValue av = (ArrayValue) ((Constant)param.getExpression()).getValue();
+ for (Object obj : av.getValues()) {
+ Argument arg = new Argument(direction, new Literal(obj, param.getClassType().getComponentType()), param.getClassType().getComponentType(), metadataParam);
+ translatedParameters.add(arg);
+ }
+ break;
+ }
value = (Literal)translate(param.getExpression());
}
Argument arg = new Argument(direction, value, param.getClassType(), metadataParam);
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -344,7 +344,7 @@
for (Procedure proc : schema.getProcedures().values()) {
for (ProcedureParameter param : proc.getParameters()) {
Datatype dt = param.getDatatype();
- rows.add(Arrays.asList(vdbName, proc.getParent().getName(), proc.getName(), param.getName(), dt!=null?dt.getRuntimeTypeName():null, param.getPosition(), param.getType().toString(), param.isOptional(),
+ rows.add(Arrays.asList(vdbName, proc.getParent().getName(), proc.getName(), param.getName(), dt!=null?dt.getRuntimeTypeName():null, param.getPosition(), param.getType().name(), param.isOptional(),
param.getPrecision(), param.getLength(), param.getScale(), param.getRadix(), param.getNullType().toString(), param.getUUID(), param.getAnnotation(), oid++));
}
if (proc.getResultSet() != null) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -22,6 +22,7 @@
package org.teiid.dqp.internal.process;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -178,7 +179,7 @@
if (originalCommand instanceof StoredProcedure) {
StoredProcedure sp = (StoredProcedure)originalCommand;
paramMap = new HashMap<Reference, String>();
- List<SPParameter> params = sp.getParameters();
+ Collection<SPParameter> params = sp.getParameters();
for (SPParameter spParameter : params) {
if (spParameter.getParameterType() != SPParameter.INOUT
&& spParameter.getParameterType() != SPParameter.IN
@@ -190,7 +191,7 @@
ex = ((Function)ex).getArg(0);
}
if (ex instanceof Reference) {
- paramMap.put((Reference)ex, Symbol.getShortName(spParameter.getName()));
+ paramMap.put((Reference)ex, spParameter.getParameterSymbol().getShortName());
}
}
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -74,56 +74,15 @@
@Override
protected void checkReferences(List<Reference> references)
throws QueryValidatorException {
+ for (Iterator<Reference> i = references.iterator(); i.hasNext();) {
+ if (i.next().isOptional()) {
+ i.remove(); //remove any optional parameter, which accounts for out params - the client does not send any bindings
+ }
+ }
prepPlan.setReferences(references);
}
/**
- * @see org.teiid.dqp.internal.process.Request#resolveCommand(org.teiid.query.sql.lang.Command)
- */
- @Override
- protected void resolveCommand(Command command) throws QueryResolverException,
- TeiidComponentException {
- handleCallableStatement(command);
-
- super.resolveCommand(command);
- }
-
- /**
- * TODO: this is a hack that maintains pre 5.6 behavior, which ignores output parameters for resolving
- * @param command
- * @param references
- */
- private void handleCallableStatement(Command command) {
- if (!this.requestMsg.isCallableStatement() || !(command instanceof StoredProcedure)) {
- return;
- }
- StoredProcedure proc = (StoredProcedure)command;
- if (!proc.isCallableStatement()) {
- return;
- }
- List<?> values = requestMsg.getParameterValues();
- List<SPParameter> spParams = proc.getParameters();
- proc.clearParameters();
- int inParameterCount = values.size();
- if (this.requestMsg.isBatchedUpdate() && values.size() > 0) {
- inParameterCount = ((List)values.get(0)).size();
- }
- int index = 1;
- for (Iterator<SPParameter> params = spParams.iterator(); params.hasNext();) {
- SPParameter param = params.next();
- if (param.getParameterType() == SPParameter.RETURN_VALUE) {
- inParameterCount++;
- } else if (param.getExpression() instanceof Reference && index > inParameterCount) {
- //assume it's an output parameter
- this.prepPlan.getReferences().remove(param.getExpression());
- continue;
- }
- param.setIndex(index++);
- proc.setParameter(param);
- }
- }
-
- /**
* @throws TeiidComponentException
* @throws TeiidProcessingException
* @see org.teiid.dqp.internal.process.Request#generatePlan()
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -386,12 +386,12 @@
List<Reference> references = ReferenceCollectorVisitor.getReferences(command);
- checkReferences(references);
-
this.analysisRecord = new AnalysisRecord(requestMsg.getShowPlan() != ShowPlan.OFF, requestMsg.getShowPlan() == ShowPlan.DEBUG);
resolveCommand(command);
+ checkReferences(references);
+
validateAccess(requestMsg.getCommands(), command, CommandType.USER);
this.userCommand = (Command) command.clone();
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/multisource/MultiSourcePlanToProcessConverter.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -65,7 +65,6 @@
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.Symbol;
import org.teiid.query.util.CommandContext;
@@ -247,7 +246,7 @@
if (param.getParameterType() != SPParameter.IN) {
continue;
}
- String shortName = Symbol.getShortName(param.getName());
+ String shortName = param.getParameterSymbol().getShortName();
if(shortName.equalsIgnoreCase(MultiSourceElement.MULTI_SOURCE_ELEMENT_NAME)) {
Constant source = (Constant)param.getExpression();
params.remove();
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -529,5 +529,7 @@
TEIID31109, //invalid scripting language
TEIID31110, //invalid script
TEIID31111, //invalid teiid script
+ TEIID31112, //invalid vararg
+ TEIID31113
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -539,7 +539,21 @@
public static Boolean compare(AbstractCompareCriteria criteria, Object leftValue,
Object value) throws AssertionError {
- int compare = Constant.COMPARATOR.compare(leftValue, value);
+ int compare = 0;
+ //TODO: we follow oracle style array comparison
+ //semantics. each element is treated as an individual comparison,
+ //so null implies unknown. h2 (and likely other dbms) allow for null
+ //array element equality
+ if (leftValue instanceof ArrayValue) {
+ ArrayValue av = (ArrayValue)leftValue;
+ try {
+ compare = av.compareTo((ArrayValue)value, true);
+ } catch (ArrayValue.NullException e) {
+ return null;
+ }
+ } else {
+ compare = Constant.COMPARATOR.compare(leftValue, value);
+ }
// Compare two non-null values using specified operator
Boolean result = null;
switch(criteria.getOperator()) {
@@ -653,9 +667,6 @@
Object[] result = new Object[exprs.size()];
for (int i = 0; i < exprs.size(); i++) {
result[i] = internalEvaluate(exprs.get(i), tuple);
- if (result[i] == null) {
- return null; //TODO: this is a hack
- }
}
return new ArrayValue(result);
} else {
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -38,6 +38,7 @@
import org.teiid.metadata.FunctionMethod.Determinism;
import org.teiid.metadata.FunctionMethod.PushDown;
import org.teiid.query.QueryPlugin;
+import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.util.CommandContext;
@@ -57,6 +58,7 @@
private String schema; //TODO: remove me - we need to create a proper schema for udf and system functions
private Object metadataID;
private boolean hasWrappedArgs;
+ private boolean calledWithVarArgArrayParam; //TODO: could store this on the function and pass to invoke
// This is transient as it would be useless to invoke this method in
// a different VM. This function descriptor can be used to look up
@@ -154,9 +156,9 @@
}
@Override
- public Object clone() {
+ public FunctionDescriptor clone() {
try {
- return super.clone();
+ return (FunctionDescriptor) super.clone();
} catch (CloneNotSupportedException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30381, e);
}
@@ -221,20 +223,46 @@
}
}
if (method.isVarArgs()) {
- int i = invocationMethod.getParameterTypes().length;
- Object[] newValues = Arrays.copyOf(values, i);
- Object varArgs = null;
- if (invocationMethod.getParameterTypes()[i - 1].getComponentType() != Object.class) {
- int varArgCount = values.length - i + 1;
- varArgs = Array.newInstance(invocationMethod.getParameterTypes()[i - 1].getComponentType(), varArgCount);
- for (int j = 0; j < varArgCount; j++) {
- Array.set(varArgs, j, values[i-1+j]);
+ if (calledWithVarArgArrayParam) {
+ ArrayValue av = (ArrayValue)values[values.length -1];
+ if (av != null) {
+ Object[] vals = av.getValues();
+ values[values.length - 1] = vals;
+ if (hasWrappedArgs && types[types.length - 1] == DataTypeManager.DefaultDataClasses.VARBINARY) {
+ vals = Arrays.copyOf(vals, vals.length);
+ for (int i = 0; i < vals.length; i++) {
+ if (vals[i] != null) {
+ vals[i] = ((BinaryType)vals[i]).getBytesDirect();
+ }
+ }
+ values[values.length - 1] = vals;
+ }
+ Class<?> arrayType = invocationMethod.getParameterTypes()[types.length - 1];
+ if (arrayType.getComponentType() != Object.class
+ && vals.getClass() != arrayType) {
+ Object varArgs = Array.newInstance(arrayType.getComponentType(), vals.length);
+ for (int i = 0; i < vals.length; i++) {
+ Array.set(varArgs, i, vals[i]);
+ }
+ values[values.length -1] = varArgs;
+ }
+ }
+ } else {
+ int i = invocationMethod.getParameterTypes().length;
+ Object[] newValues = Arrays.copyOf(values, i);
+ Object varArgs = null;
+ if (invocationMethod.getParameterTypes()[i - 1].getComponentType() != Object.class) {
+ int varArgCount = values.length - i + 1;
+ varArgs = Array.newInstance(invocationMethod.getParameterTypes()[i - 1].getComponentType(), varArgCount);
+ for (int j = 0; j < varArgCount; j++) {
+ Array.set(varArgs, j, values[i-1+j]);
+ }
+ } else {
+ varArgs = Arrays.copyOfRange(values, i - 1, values.length);
}
- } else {
- varArgs = Arrays.copyOfRange(values, i - 1, values.length);
+ newValues[i - 1] = varArgs;
+ values = newValues;
}
- newValues[i - 1] = varArgs;
- values = newValues;
}
Object result = invocationMethod.invoke(functionTarget, values);
if (context != null && getDeterministic().ordinal() <= Determinism.USER_DETERMINISTIC.ordinal()) {
@@ -277,4 +305,13 @@
}
return result;
}
+
+ public boolean isCalledWithVarArgArrayParam() {
+ return calledWithVarArgArrayParam;
+ }
+
+ public void setCalledWithVarArgArrayParam(boolean calledWithVarArgArrayParam) {
+ this.calledWithVarArgArrayParam = calledWithVarArgArrayParam;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -92,6 +92,7 @@
public static final String COALESCE = "coalesce"; //$NON-NLS-1$
public static final String SPACE = "space"; //$NON-NLS-1$
+ public static final String ARRAY_GET = "array_get"; //$NON-NLS-1$
// Function tree for system functions (never reloaded)
private FunctionTree systemFunctions;
@@ -237,7 +238,6 @@
//no implicit conversion is possible
int i = 0;
for(; i < types.length; i++) {
- //treat all varags as the same type
final String tmpTypeName = methodTypes.get(Math.min(i, methodTypes.size() - 1)).getType();
Class<?> targetType = DataTypeManager.getDataTypeClass(tmpTypeName);
@@ -246,7 +246,14 @@
currentScore++;
continue;
}
-
+ if (sourceType.isArray()) {
+ if (isVarArgArrayParam(nextMethod, types, i, targetType)) {
+ //vararg array parameter
+ continue;
+ }
+ //treat the array as object type until proper type handling is added
+ sourceType = DataTypeManager.DefaultDataClasses.OBJECT;
+ }
try {
Transform t = getConvertFunctionDescriptor(sourceType, targetType);
if (t != null) {
@@ -320,11 +327,21 @@
if (sourceType == null) {
result[i] = findTypedConversionFunction(DataTypeManager.DefaultDataClasses.NULL, targetType);
} else if (sourceType != targetType){
+ if (isVarArgArrayParam(method, types, i, targetType)) {
+ //vararg array parameter
+ continue;
+ }
result[i] = findTypedConversionFunction(sourceType, targetType);
}
}
return result;
}
+
+ public boolean isVarArgArrayParam(FunctionMethod method, Class<?>[] types,
+ int i, Class<?> targetType) {
+ return i == types.length - 1 && method.isVarArgs() && i == method.getInputParameterCount() - 1
+ && types[i].getComponentType() == targetType;
+ }
private Transform getConvertFunctionDescriptor(Class<?> sourceType, Class<?> targetType) throws InvalidFunctionException {
//If exact match no conversion necessary
@@ -345,7 +362,8 @@
* @param targetType The target type class
* @return A CONVERT function descriptor or null if not possible
*/
- public FunctionDescriptor findTypedConversionFunction(Class<?> sourceType, Class<?> targetType) {
+ public FunctionDescriptor findTypedConversionFunction(Class<?> sourceType, Class<?> targetType) {
+ //TODO: should array to string be prohibited?
FunctionDescriptor fd = findFunction(CONVERT, new Class[] {sourceType, DataTypeManager.DefaultDataClasses.STRING});
if (fd != null) {
return copyFunctionChangeReturnType(fd, targetType);
@@ -362,7 +380,7 @@
public FunctionDescriptor copyFunctionChangeReturnType(FunctionDescriptor fd, Class<?> returnType) {
if(fd != null) {
FunctionDescriptor fdImpl = fd;
- FunctionDescriptor copy = (FunctionDescriptor)fdImpl.clone();
+ FunctionDescriptor copy = fdImpl.clone();
copy.setReturnType(returnType);
return copy;
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -59,6 +59,7 @@
import org.teiid.language.SQLConstants;
import org.teiid.language.SQLConstants.NonReserved;
import org.teiid.query.QueryPlugin;
+import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.util.CommandContext;
/**
@@ -1407,6 +1408,9 @@
if (array instanceof java.sql.Array) {
return Array.get(((java.sql.Array)array).getArray(index, 1), 0);
}
+ if (array instanceof ArrayValue) {
+ return ((ArrayValue)array).getValues()[index - 1];
+ }
} catch (ArrayIndexOutOfBoundsException e) {
throw new FunctionExecutionException(QueryPlugin.Event.TEIID30415, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30415, index));
}
@@ -1420,6 +1424,9 @@
if (array instanceof java.sql.Array) {
return Array.getLength(((java.sql.Array)array).getArray());
}
+ if (array instanceof ArrayValue) {
+ return ((ArrayValue)array).getValues().length;
+ }
throw new FunctionExecutionException(QueryPlugin.Event.TEIID30416, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30416, array.getClass()));
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionTree.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -22,7 +22,6 @@
package org.teiid.query.function;
-import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -33,6 +32,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import org.teiid.UserDefinedAggregate;
import org.teiid.core.CoreConstants;
@@ -62,18 +62,18 @@
public class FunctionTree {
// Constant used to look up the special descriptor key in a node map
- private static final Integer DESCRIPTOR_KEY = new Integer(-1);
+ private static final Integer DESCRIPTOR_KEY = -1;
private Map<String, Set<String>> categories = new HashMap<String, Set<String>>();
- private Map<String, List<FunctionMethod>> functionsByName = new HashMap<String, List<FunctionMethod>>();
+ private Map<String, List<FunctionMethod>> functionsByName = new TreeMap<String, List<FunctionMethod>>(String.CASE_INSENSITIVE_ORDER);
private Set<FunctionMethod> allFunctions = new HashSet<FunctionMethod>();
/**
* Function lookup and invocation use: Function name (uppercase) to Map (recursive tree)
*/
- private Map treeRoot = new HashMap();
+ private Map<String, Map<Object, Object>> treeRoot = new TreeMap<String, Map<Object, Object>>(String.CASE_INSENSITIVE_ORDER);
private boolean validateClass;
/**
@@ -176,7 +176,7 @@
*/
List<FunctionMethod> findFunctionMethods(String name, int args) {
final List<FunctionMethod> allMatches = new ArrayList<FunctionMethod>();
- List<FunctionMethod> methods = functionsByName.get(name.toUpperCase());
+ List<FunctionMethod> methods = functionsByName.get(name);
if(methods == null || methods.size() == 0) {
return allMatches;
}
@@ -248,17 +248,23 @@
}
knownMethods.add(method);
- Map node = treeRoot;
- Object[] path = buildPath(methodName, types);
- for(int pathIndex = 0; pathIndex < path.length; pathIndex++) {
- Object pathPart = path[pathIndex];
- Map children = (Map) node.get(pathPart);
+ Map<Object, Object> node = treeRoot.get(methodName);
+ if (node == null) {
+ node = new HashMap<Object, Object>(2);
+ treeRoot.put(methodName, node);
+ }
+ for(int pathIndex = 0; pathIndex < types.length; pathIndex++) {
+ Class<?> pathPart = types[pathIndex];
+ Map<Object, Object> children = (Map<Object, Object>) node.get(pathPart);
if(children == null) {
- children = new HashMap();
+ children = new HashMap<Object, Object>(2);
node.put(pathPart, children);
}
- if (method.isVarArgs() && pathIndex == path.length - 1) {
+ if (method.isVarArgs() && pathIndex == types.length - 1) {
node.put(DESCRIPTOR_KEY, descriptor);
+ Map<Object, Object> alternate = new HashMap<Object, Object>(2);
+ alternate.put(DESCRIPTOR_KEY, descriptor);
+ node.put(DataTypeManager.getArrayType(pathPart), alternate);
}
node = children;
}
@@ -300,7 +306,7 @@
}
}
if (method.isVarArgs()) {
- inputTypes.set(inputTypes.size() - 1, Array.newInstance(inputTypes.get(inputTypes.size() - 1), 0).getClass());
+ inputTypes.set(inputTypes.size() - 1, DataTypeManager.getArrayType(inputTypes.get(inputTypes.size() - 1)));
}
Method invocationMethod = null;
@@ -368,16 +374,23 @@
* @return Descriptor which can be used to invoke the function
*/
FunctionDescriptor getFunction(String name, Class<?>[] argTypes) {
- // Build search path
- Object[] path = buildPath(name, argTypes);
-
// Walk path in tree
- Map node = treeRoot;
- for(int i=0; i<path.length; i++) {
- node = (Map)node.get(path[i]);
- if (node == null) {
- return null;
+ Map<Object, Object> node = treeRoot.get(name);
+ if (node == null) {
+ return null;
+ }
+ for(int i=0; i<argTypes.length; i++) {
+ Map<Object, Object> nextNode = (Map<Object, Object>)node.get(argTypes[i]);
+ if (nextNode == null) {
+ if (argTypes[i].isArray()) {
+ //array types are not yet considered in the function typing logic
+ nextNode = (Map<Object, Object>) node.get(DataTypeManager.DefaultDataClasses.OBJECT);
+ }
+ if (nextNode == null) {
+ return null;
+ }
}
+ node = nextNode;
}
// Look for key at the end
@@ -389,17 +402,4 @@
return null;
}
- /**
- * Build the path in the function storage tree. The path for a function consists
- * of it's name (uppercased) and each of the argument classes.
- * @param name Name of function
- * @param argTypes Types of each arguments
- * @return Path in function storage tree
- */
- private Object[] buildPath(String name, Class<?>[] argTypes) {
- Object[] path = new Object[argTypes.length + 1];
- path[0] = name.toUpperCase();
- System.arraycopy(argTypes, 0, path, 1, argTypes.length);
- return path;
- }
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadata.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadata.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -33,9 +33,11 @@
import org.teiid.api.exception.query.QueryMetadataException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.query.eval.TeiidScriptEngine;
import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.mapping.relational.QueryNode;
import org.teiid.query.mapping.xml.MappingNode;
+import org.teiid.query.sql.lang.ObjectTable;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -524,8 +526,26 @@
}
@Override
- public ScriptEngine getScriptEngine(String langauge) throws TeiidProcessingException {
+ public ScriptEngine getScriptEngine(String language) throws TeiidProcessingException {
+ if (language == null || ObjectTable.DEFAULT_LANGUAGE.equals(language)) {
+ return new TeiidScriptEngine();
+ }
+ return getScriptEngineDirect(language);
+ }
+
+ /**
+ *
+ * @param language
+ * @return
+ * @throws TeiidProcessingException
+ */
+ public ScriptEngine getScriptEngineDirect(String language) throws TeiidProcessingException {
return null;
}
+ @Override
+ public boolean isVariadic(Object metadataID) {
+ return false;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadataWrapper.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadataWrapper.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/BasicQueryMetadataWrapper.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -402,4 +402,9 @@
return actualMetadata.getScriptEngine(langauge);
}
+ @Override
+ public boolean isVariadic(Object metadataID) {
+ return actualMetadata.isVariadic(metadataID);
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/DDLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/DDLStringVisitor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/DDLStringVisitor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -586,9 +586,22 @@
private void visit(ProcedureParameter param) {
Type type = param.getType();
- String typeStr = type.name().toUpperCase();
- if (type == Type.ReturnValue) {
- typeStr = Type.Out.name().toUpperCase();
+ String typeStr = null;
+ switch (type) {
+ case InOut:
+ typeStr = INOUT;
+ break;
+ case ReturnValue:
+ case Out:
+ typeStr = OUT;
+ break;
+ case In:
+ if (param.isVarArg()) {
+ typeStr = NonReserved.VARIADIC;
+ } else {
+ typeStr = IN;
+ }
+ break;
}
buffer.append(typeStr).append(SPACE);
appendColumn(buffer, param, true, true);
@@ -666,6 +679,9 @@
}
private void visit(FunctionParameter param) {
+ if (param.isVarArg()) {
+ buffer.append(NonReserved.VARIADIC).append(SPACE);
+ }
buffer.append(SQLStringVisitor.escapeSinglePart(param.getName())).append(SPACE).append(param.getType());
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -119,6 +119,9 @@
boolean hasReturn = false;
names.clear();
for (ProcedureParameter param : p.getParameters()) {
+ if (param.isVarArg() && param != p.getParameters().get(p.getParameters().size() -1)) {
+ metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31112, p.getFullName()));
+ }
if (param.getType() == ProcedureParameter.Type.ReturnValue) {
if (hasReturn) {
metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31107, p.getFullName()));
@@ -135,6 +138,11 @@
}
for (FunctionMethod func:schema.getFunctions().values()) {
+ for (FunctionParameter param : func.getInputParameters()) {
+ if (param.isVarArg() && param != func.getInputParameters().get(func.getInputParameterCount() -1)) {
+ metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31112, func.getFullName()));
+ }
+ }
if (func.getPushdown().equals(FunctionMethod.PushDown.MUST_PUSHDOWN) && !model.isSource()) {
metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31078, func.getName(), model.getName()));
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/QueryMetadataInterface.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/QueryMetadataInterface.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/QueryMetadataInterface.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -657,4 +657,6 @@
QueryMetadataInterface getSessionMetadata();
Set<String> getImportedModels();
+
+ boolean isVariadic(Object metadataID);
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -47,20 +47,11 @@
import org.teiid.core.util.LRUCache;
import org.teiid.core.util.ObjectConverterUtil;
import org.teiid.core.util.StringUtil;
-import org.teiid.metadata.AbstractMetadataRecord;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.ColumnSet;
-import org.teiid.metadata.ForeignKey;
-import org.teiid.metadata.KeyRecord;
-import org.teiid.metadata.Procedure;
-import org.teiid.metadata.ProcedureParameter;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
+import org.teiid.metadata.*;
import org.teiid.metadata.BaseColumn.NullType;
import org.teiid.metadata.Column.SearchType;
import org.teiid.metadata.ProcedureParameter.Type;
import org.teiid.query.QueryPlugin;
-import org.teiid.query.eval.TeiidScriptEngine;
import org.teiid.query.function.FunctionLibrary;
import org.teiid.query.function.FunctionTree;
import org.teiid.query.mapping.relational.QueryNode;
@@ -363,6 +354,10 @@
SPParameter spParam = new SPParameter(paramRecord.getPosition(), direction, paramRecord.getFullName());
spParam.setMetadataID(paramRecord);
spParam.setClassType(DataTypeManager.getDataTypeClass(runtimeType));
+ if (paramRecord.isVarArg()) {
+ spParam.setVarArg(true);
+ spParam.setClassType(DataTypeManager.getArrayType(spParam.getClassType()));
+ }
procInfo.addParameter(spParam);
}
@@ -1116,13 +1111,11 @@
}
@Override
- public ScriptEngine getScriptEngine(String language) throws TeiidProcessingException {
+ public ScriptEngine getScriptEngineDirect(String language)
+ throws TeiidProcessingException {
if (this.scriptEngineManager == null) {
this.scriptEngineManager = new ScriptEngineManager();
}
- if (language == null || ObjectTable.DEFAULT_LANGUAGE.equals(language)) {
- return new TeiidScriptEngine();
- }
ScriptEngine engine = null;
if (allowedLanguages == null || allowedLanguages.contains(language)) {
/*
@@ -1155,4 +1148,15 @@
return engine;
}
+ @Override
+ public boolean isVariadic(Object metadataID) {
+ if (metadataID instanceof ProcedureParameter) {
+ return ((ProcedureParameter)metadataID).isVarArg();
+ }
+ if (metadataID instanceof FunctionParameter) {
+ return ((FunctionParameter)metadataID).isVarArg();
+ }
+ return false;
+ }
+
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/QueryOptimizer.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -33,8 +33,8 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.id.IDGenerator;
import org.teiid.dqp.internal.process.PreparedPlan;
+import org.teiid.metadata.Procedure;
import org.teiid.metadata.FunctionMethod.Determinism;
-import org.teiid.metadata.Procedure;
import org.teiid.query.QueryPlugin;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.metadata.QueryMetadataInterface;
Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -71,6 +71,7 @@
import org.teiid.query.sql.ProcedureReservedWords;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Criteria;
+import org.teiid.query.sql.symbol.ArrayValue;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.util.VariableContext;
@@ -245,9 +246,20 @@
private void checkNotNull(ElementSymbol param, Object value)
throws TeiidComponentException, QueryMetadataException,
QueryValidatorException {
- if (value == null && !metadata.elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
+ if (metadata.elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
+ return;
+ }
+ if (value == null) {
throw new QueryValidatorException(QueryPlugin.Event.TEIID30164, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30164, param));
}
+ if (value instanceof ArrayValue && metadata.isVariadic(param.getMetadataID())) {
+ ArrayValue av = (ArrayValue)value;
+ for (Object o : av.getValues()) {
+ if (o == null) {
+ throw new QueryValidatorException(QueryPlugin.Event.TEIID30164, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30164, param));
+ }
+ }
+ }
}
protected void setParameterValue(ElementSymbol param,
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -121,7 +121,7 @@
int index = 0;
Class<?> type = null;
if (valueExpression instanceof Array) {
- type = ((Array)valueExpression).getBaseType();
+ type = ((Array)valueExpression).getComponentType();
} else {
if (valueExpression != null) {
index = schema.indexOf(valueExpression);
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -23,6 +23,7 @@
package org.teiid.query.resolver.command;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -51,8 +52,10 @@
import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.SubqueryContainer;
+import org.teiid.query.sql.symbol.Array;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Reference;
import org.teiid.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
@@ -93,7 +96,7 @@
// Get old parameters as they may have expressions set on them - collect
// those expressions to copy later into the resolved parameters
- List<SPParameter> oldParams = storedProcedureCommand.getParameters();
+ Collection<SPParameter> oldParams = storedProcedureCommand.getParameters();
boolean namedParameters = storedProcedureCommand.displayNamedParameters();
@@ -110,7 +113,7 @@
// the procedure was parsed with named or unnamed parameters, the keys
// for this map will either be the String names of the parameters or
// the Integer indices, as entered in the user query
- Map<Integer, Expression> postionalExpressions = new HashMap<Integer, Expression>();
+ Map<Integer, Expression> positionalExpressions = new HashMap<Integer, Expression>();
Map<String, Expression> namedExpressions = new TreeMap<String, Expression>(String.CASE_INSENSITIVE_ORDER);
int adjustIndex = 0;
for (SPParameter param : oldParams) {
@@ -121,16 +124,16 @@
continue;
}
if (namedParameters && param.getParameterType() != SPParameter.RETURN_VALUE) {
- if (namedExpressions.put(param.getName(), param.getExpression()) != null) {
- throw new QueryResolverException(QueryPlugin.Event.TEIID30138, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30138, param.getName().toUpperCase()));
+ if (namedExpressions.put(param.getParameterSymbol().getShortName(), param.getExpression()) != null) {
+ throw new QueryResolverException(QueryPlugin.Event.TEIID30138, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30138, param.getName()));
}
} else {
- postionalExpressions.put(param.getIndex() + adjustIndex, param.getExpression());
+ positionalExpressions.put(param.getIndex() + adjustIndex, param.getExpression());
}
}
storedProcedureCommand.clearParameters();
- int origInputs = postionalExpressions.size() + namedExpressions.size();
+ int origInputs = positionalExpressions.size() + namedExpressions.size();
/*
* Take the values set from the stored procedure implementation, and match up with the
* types of parameter it is from the metadata and then reset the newly joined parameters
@@ -144,10 +147,12 @@
int outParams = 0;
boolean hasReturnValue = false;
boolean optional = false;
- for (SPParameter metadataParameter : metadataParams) {
+ boolean varargs = false;
+ for (int i = 0; i < metadataParams.size(); i++) {
+ SPParameter metadataParameter = metadataParams.get(i);
if( (metadataParameter.getParameterType()==ParameterInfo.IN) ||
(metadataParameter.getParameterType()==ParameterInfo.INOUT)){
- if (ResolverUtil.hasDefault(metadataParameter.getMetadataID(), metadata)) {
+ if (ResolverUtil.hasDefault(metadataParameter.getMetadataID(), metadata) || metadataParameter.isVarArg()) {
optional = true;
optionalParams++;
} else {
@@ -158,6 +163,9 @@
optionalParams = 0;
}
}
+ if (metadataParameter.isVarArg()) {
+ varargs = true;
+ }
} else if (metadataParameter.getParameterType() == ParameterInfo.OUT) {
outParams++;
/*
@@ -178,8 +186,8 @@
throw new QueryResolverException(QueryPlugin.Event.TEIID30139, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30139, storedProcedureCommand.getGroup()));
}
- if(!namedParameters && (inputParams > postionalExpressions.size())) {
- throw new QueryResolverException(QueryPlugin.Event.TEIID30140, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30140, inputParams, origInputs, storedProcedureCommand.getGroup()));
+ if(!namedParameters && (inputParams > positionalExpressions.size()) ) {
+ throw new QueryResolverException(QueryPlugin.Event.TEIID30140, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30140, inputParams, inputParams + optionalParams + (varargs?"+":""), origInputs, storedProcedureCommand.getGroup())); //$NON-NLS-1$ //$NON-NLS-2$
}
// Walk through the resolved parameters and set the expressions from the
@@ -189,7 +197,7 @@
if (storedProcedureCommand.isCalledWithReturn() && hasReturnValue) {
for (SPParameter param : clonedMetadataParams) {
if (param.getParameterType() == SPParameter.RETURN_VALUE) {
- Expression expr = postionalExpressions.remove(exprIndex++);
+ Expression expr = positionalExpressions.remove(exprIndex++);
param.setExpression(expr);
break;
}
@@ -210,14 +218,45 @@
}
param.setExpression(expr);
} else {
- if(param.getParameterType() == SPParameter.OUT) {
+ Expression expr = positionalExpressions.remove(exprIndex++);
+ if(param.getParameterType() == SPParameter.OUT) {
+ if (expr != null) {
+ boolean isRef = expr instanceof Reference;
+ if (!isRef || exprIndex <= inputParams + 1) {
+ //for backwards compatibility, this should be treated instead as an input
+ exprIndex--;
+ positionalExpressions.put(exprIndex, expr);
+ } else if (isRef) {
+ //mimics the hack that was in PreparedStatementRequest.
+ Reference ref = (Reference)expr;
+ ref.setOptional(true); //may be an out
+ /*
+ * Note that there is a corner case here with out parameters intermixed with optional parameters
+ * there's not a good way around this.
+ */
+ }
+ }
continue;
}
- Expression expr = postionalExpressions.remove(exprIndex++);
if (expr == null) {
- expr = ResolverUtil.getDefault(param.getParameterSymbol(), metadata);
+ if (!param.isVarArg()) {
+ expr = ResolverUtil.getDefault(param.getParameterSymbol(), metadata);
+ }
param.setUsingDefault(true);
}
+ if (param.isVarArg()) {
+ List<Expression> exprs = new ArrayList<Expression>(positionalExpressions.size() + 1);
+ if (expr != null) {
+ exprs.add(expr);
+ }
+ exprs.addAll(positionalExpressions.values());
+ positionalExpressions.clear();
+ Array array = new Array(exprs);
+ array.setImplicit(true);
+ array.setType(param.getClassType());
+ param.setExpression(array);
+ break;
+ }
param.setExpression(expr);
}
}
@@ -226,8 +265,8 @@
if (!namedExpressions.isEmpty()) {
throw new QueryResolverException(QueryPlugin.Event.TEIID30141, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30141, namedExpressions.keySet(), expected));
}
- if (!postionalExpressions.isEmpty()) {
- throw new QueryResolverException(QueryPlugin.Event.TEIID30140, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30140, inputParams, origInputs, storedProcedureCommand.getGroup().toString()));
+ if (!positionalExpressions.isEmpty()) {
+ throw new QueryResolverException(QueryPlugin.Event.TEIID31113, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31113, positionalExpressions.size(), origInputs, storedProcedureCommand.getGroup().toString()));
}
// Create temporary metadata that defines a group based on either the stored proc
@@ -267,7 +306,14 @@
QueryResolver.resolveCommand(container.getCommand(), metadata.getMetadata());
}
- ResolverVisitor.resolveLanguageObject(expr, null, externalGroups, metadata);
+ try {
+ ResolverVisitor.resolveLanguageObject(expr, null, externalGroups, metadata);
+ } catch (QueryResolverException e) {
+ if (!checkForArray(param, expr)) {
+ throw e;
+ }
+ continue;
+ }
Class<?> paramType = param.getClassType();
ResolverUtil.setDesiredType(expr, paramType, storedProcedureCommand);
@@ -290,12 +336,32 @@
try {
result = ResolverUtil.convertExpression(expr, tgtType, metadata);
} catch (QueryResolverException e) {
- throw new QueryResolverException(QueryPlugin.Event.TEIID30145, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30145, new Object[] { srcType, tgtType}));
+ throw new QueryResolverException(QueryPlugin.Event.TEIID30145, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30145, new Object[] { param.getParameterSymbol(), srcType, tgtType}));
}
param.setExpression(result);
}
}
}
+
+ /**
+ * The param resolving always constructs an array, which is
+ * not appropriate if passing an array directly
+ * @return
+ */
+ private boolean checkForArray(SPParameter param, Expression expr) {
+ if (!param.isVarArg() || !(expr instanceof Array)) {
+ return false;
+ }
+ Array array = (Array)expr;
+ if (array.getExpressions().size() == 1) {
+ Expression first = array.getExpressions().get(0);
+ if (first.getType() != null && first.getType() == array.getType()) {
+ param.setExpression(first);
+ return true;
+ }
+ }
+ return false;
+ }
protected void resolveGroup(TempMetadataAdapter metadata,
ProcedureContainer procCommand) throws TeiidComponentException,
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverVisitor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -320,6 +320,30 @@
handleException(e);
}
}
+
+ @Override
+ public void visit(Array array) {
+ try {
+ if (array.getComponentType() != null) {
+ String type = DataTypeManager.getDataTypeName(array.getComponentType());
+ for (int i = 0; i < array.getExpressions().size(); i++) {
+ Expression expr = array.getExpressions().get(i);
+ setDesiredType(expr, array.getComponentType(), array);
+ array.getExpressions().set(i, ResolverUtil.convertExpression(expr, type, metadata));
+ }
+ } else {
+ String[] types = new String[array.getExpressions().size()];
+ for (int i = 0; i < array.getExpressions().size(); i++) {
+ Expression expr = array.getExpressions().get(i);
+ types[i] = DataTypeManager.getDataTypeName(expr.getType());
+ }
+ String commonType = ResolverUtil.getCommonType(types);
+ array.setComponentType(DataTypeManager.getDataTypeClass(commonType));
+ }
+ } catch (QueryResolverException e) {
+ handleException(e);
+ }
+ }
public void visit(CaseExpression obj) {
try {
@@ -492,6 +516,13 @@
throw new QueryResolverException(QueryPlugin.Event.TEIID30070, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30070, function));
}
+ if (fd.getMethod().isVarArgs()
+ && fd.getTypes().length == types.length
+ && library.isVarArgArrayParam(fd.getMethod(), types, types.length - 1, fd.getTypes()[types.length - 1])) {
+ fd = fd.clone();
+ fd.setCalledWithVarArgArrayParam(true);
+ }
+
if(fd.getName().equalsIgnoreCase(FunctionLibrary.CONVERT) || fd.getName().equalsIgnoreCase(FunctionLibrary.CAST)) {
String dataType = (String) ((Constant)args[1]).getValue();
Class<?> dataTypeClass = DataTypeManager.getDataTypeClass(dataType);
@@ -508,7 +539,10 @@
} else if(fd.getName().equalsIgnoreCase(FunctionLibrary.LOOKUP)) {
ResolverUtil.ResolvedLookup lookup = ResolverUtil.resolveLookup(function, metadata);
fd = library.copyFunctionChangeReturnType(fd, lookup.getReturnElement().getType());
- }
+ } else if (FunctionLibrary.ARRAY_GET.equalsIgnoreCase(fd.getName()) && args[0].getType().isArray()) {
+ //hack to use typed array values
+ fd = library.copyFunctionChangeReturnType(fd, args[0].getType().getComponentType());
+ }
function.setFunctionDescriptor(fd);
function.setType(fd.getReturnType());
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/SPParameter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/SPParameter.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/SPParameter.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -22,7 +22,6 @@
package org.teiid.query.sql.lang;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -42,7 +41,7 @@
* The connector will utilize this class to set the appropriate values at the
* datasource layer.
*/
-public class SPParameter implements Serializable, Cloneable {
+public class SPParameter implements Cloneable {
/** Constant identifying an IN parameter */
public static final int IN = ParameterInfo.IN;
@@ -60,15 +59,14 @@
public static final int RESULT_SET = ParameterInfo.RESULT_SET;
// Basic state
- private String name; // Param name, qualified by full procedure name
private int parameterType = ParameterInfo.IN;
- private Class classType;
private Expression expression;
private int index;
- private List resultSetColumns; //contains List of columns if it is result set
- private List resultSetIDs; // contains List of metadataIDs for each column in the result set
- private Object metadataID; // metadataID for the actual metadata ID
+ private List<ElementSymbol> resultSetColumns; //contains List of columns if it is result set
+ private List<Object> resultSetIDs; // contains List of metadataIDs for each column in the result set
private boolean usingDefault;
+ private boolean varArg;
+ private ElementSymbol parameterSymbol;
/**
* Constructor used when constructing a parameter during execution. In this case we
@@ -80,6 +78,7 @@
public SPParameter(int index, Expression expression){
setIndex(index);
setExpression(expression);
+ this.parameterSymbol = new ElementSymbol(""); //$NON-NLS-1$
}
/**
@@ -94,15 +93,19 @@
public SPParameter(int index, int parameterType, String name) {
setIndex(index);
setParameterType(parameterType);
- setName(name);
+ this.parameterSymbol = new ElementSymbol(name);
}
+
+ private SPParameter() {
+
+ }
/**
* Get full parameter name,. If unknown, null is returned.
* @return Parameter name
*/
public String getName() {
- return this.name;
+ return this.parameterSymbol.getName();
}
/**
@@ -110,7 +113,10 @@
* @param name Parameter name
*/
public void setName(String name) {
- this.name = name;
+ ElementSymbol es = new ElementSymbol(name);
+ es.setMetadataID(parameterSymbol.getMetadataID());
+ es.setType(parameterSymbol.getType());
+ this.parameterSymbol = es;
}
/**
@@ -148,16 +154,16 @@
* @param classType See {@link org.teiid.core.types.DataTypeManager.DefaultDataClasses}
* for types
*/
- public void setClassType(Class classType){
- this.classType = classType;
+ public void setClassType(Class<?> classType){
+ this.parameterSymbol.setType(classType);
}
/**
* Get class type - MetaMatrix runtime types.
* @return MetaMatrix runtime type description
*/
- public Class getClassType(){
- return this.classType;
+ public Class<?> getClassType(){
+ return this.parameterSymbol.getType();
}
/**
@@ -195,16 +201,16 @@
/**
* Add a result set column if this parameter is a return
* result set.
- * @param name Name of column
+ * @param colName Name of column
* @param type Type of column
*/
- public void addResultSetColumn(String name, Class type, Object id) {
+ public void addResultSetColumn(String colName, Class<?> type, Object id) {
if(resultSetColumns == null){
- resultSetColumns = new ArrayList();
- resultSetIDs = new ArrayList();
+ resultSetColumns = new ArrayList<ElementSymbol>();
+ resultSetIDs = new ArrayList<Object>();
}
- ElementSymbol rsColumn = new ElementSymbol(name);
+ ElementSymbol rsColumn = new ElementSymbol(colName);
rsColumn.setType(type);
rsColumn.setMetadataID(id);
@@ -217,9 +223,9 @@
* Get the result set columns. If none exist, return empty list.
* @return List of ElementSymbol representing result set columns
*/
- public List getResultSetColumns(){
+ public List<ElementSymbol> getResultSetColumns(){
if(resultSetColumns == null){
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
return resultSetColumns;
}
@@ -228,9 +234,9 @@
* Get the result set metadata IDs. If none exist, return empty list.
* @return List of Object representing result set metadata IDs
*/
- public List getResultSetIDs() {
+ public List<Object> getResultSetIDs() {
if(resultSetIDs == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
return this.resultSetIDs;
}
@@ -249,7 +255,7 @@
//position is 1 based
position--;
if(position >= 0 && position < resultSetColumns.size()) {
- return (ElementSymbol) resultSetColumns.get(position);
+ return resultSetColumns.get(position);
}
throw new IllegalArgumentException(QueryPlugin.Util.getString("ERR.015.010.0010", new Integer(position + 1))); //$NON-NLS-1$
}
@@ -259,7 +265,7 @@
* @return Actual metadata ID for this parameter
*/
public Object getMetadataID() {
- return this.metadataID;
+ return this.parameterSymbol.getMetadataID();
}
/**
@@ -267,7 +273,7 @@
* @param metadataID Actual metadataID
*/
public void setMetadataID(Object metadataID) {
- this.metadataID = metadataID;
+ this.parameterSymbol.setMetadataID(metadataID);
}
/**
@@ -285,10 +291,7 @@
* @return Element symbol representing the parameter
*/
public ElementSymbol getParameterSymbol() {
- ElementSymbol symbol = new ElementSymbol(this.name);
- symbol.setType(this.classType);
- symbol.setMetadataID(this.metadataID);
- return symbol;
+ return parameterSymbol;
}
/**
@@ -325,23 +328,23 @@
* @see java.lang.Object#clone()
*/
public Object clone() {
- SPParameter copy = new SPParameter(this.index, this.parameterType, this.name);
- copy.setClassType(this.classType);
+ SPParameter copy = new SPParameter();
+ copy.index = this.index;
+ copy.parameterType = this.parameterType;
+ copy.parameterSymbol = this.parameterSymbol.clone();
if(this.expression != null) {
copy.setExpression((Expression)this.expression.clone());
}
if(this.resultSetColumns != null) {
- Iterator iter = this.resultSetColumns.iterator();
- Iterator idIter = this.resultSetIDs.iterator();
+ Iterator<ElementSymbol> iter = this.resultSetColumns.iterator();
+ Iterator<Object> idIter = this.resultSetIDs.iterator();
while(iter.hasNext()) {
- ElementSymbol column = (ElementSymbol) iter.next();
+ ElementSymbol column = iter.next();
copy.addResultSetColumn(column.getName(), column.getType(), idIter.next());
}
}
-
- copy.setMetadataID(this.getMetadataID());
copy.setUsingDefault(this.usingDefault);
-
+ copy.varArg = this.varArg;
return copy;
}
@@ -363,4 +366,12 @@
this.usingDefault = usingDefault;
}
+ public void setVarArg(boolean varArg) {
+ this.varArg = varArg;
+ }
+
+ public boolean isVarArg() {
+ return varArg;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/StoredProcedure.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -23,6 +23,7 @@
package org.teiid.query.sql.lang;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -146,7 +147,7 @@
throw new IllegalArgumentException(QueryPlugin.Util.getString("ERR.015.010.0011")); //$NON-NLS-1$
}
- Integer key = new Integer(parameter.getIndex());
+ Integer key = parameter.getIndex();
if(parameter.getParameterType() == ParameterInfo.RESULT_SET){
resultSetParameterKey = key;
}
@@ -158,9 +159,8 @@
* Returns a List of SPParameter objects for this stored procedure
*
*/
- public List<SPParameter> getParameters(){
- List<SPParameter> listOfParameters = new ArrayList<SPParameter>(mapOfParameters.values());
- return listOfParameters;
+ public Collection<SPParameter> getParameters(){
+ return mapOfParameters.values();
}
public Map<Integer, SPParameter> getMapOfParameters() {
@@ -168,7 +168,7 @@
}
public SPParameter getParameter(int index){
- return mapOfParameters.get(new Integer(index));
+ return mapOfParameters.get(index);
}
public int getNumberOfColumns(){
@@ -214,9 +214,9 @@
copy.setGroup(getGroup().clone());
copy.callableName = callableName;
copy.calledWithReturn = calledWithReturn;
- List<SPParameter> params = getParameters();
- for(int i=0; i<params.size(); i++) {
- copy.setParameter((SPParameter)params.get(i).clone());
+ Collection<SPParameter> params = getParameters();
+ for (SPParameter spParameter : params) {
+ copy.setParameter((SPParameter)spParameter.clone());
}
copy.resultSetParameterKey = resultSetParameterKey;
this.copyMetadataState(copy);
@@ -350,23 +350,8 @@
this.displayNamedParameters = displayNamedParameters;
}
- /**
- * Return the full parameter name for
- * the indicated parameter of this stored procedure.
- * @param param
- * @return
- * @since 4.3
- */
- public String getParamFullName(SPParameter param) {
- String paramName = param.getName();
- if(paramName.lastIndexOf(".") < 0) { //$NON-NLS-1$
- paramName = this.getProcedureName() + "." + paramName; //$NON-NLS-1$
- }
- return paramName;
- }
-
public List<SPParameter> getInputParameters() {
- List<SPParameter> parameters = getParameters();
+ List<SPParameter> parameters = new ArrayList<SPParameter>(getParameters());
Iterator<SPParameter> params = parameters.iterator();
while (params.hasNext()) {
SPParameter param = params.next();
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Array.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -25,6 +25,7 @@
import java.util.List;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.Assertion;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.HashCodeUtil;
import org.teiid.query.sql.LanguageObject;
@@ -33,18 +34,30 @@
public class Array implements Expression {
- private Class<?> baseType;
+ private Class<?> type;
private List<Expression> expressions;
+ private boolean implicit;
+ public Array(List<Expression> expressions) {
+ this.expressions = expressions;
+ }
+
public Array(Class<?> baseType, List<Expression> expresssions) {
- this.baseType = baseType;
+ setComponentType(baseType);
this.expressions = expresssions;
}
@Override
public Class<?> getType() {
- return DataTypeManager.DefaultDataClasses.OBJECT;
+ return type;
}
+
+ public void setType(Class<?> type) {
+ if (type != null) {
+ Assertion.assertTrue(type.isArray());
+ }
+ this.type = type;
+ }
@Override
public void acceptVisitor(LanguageVisitor visitor) {
@@ -53,15 +66,24 @@
@Override
public Array clone() {
- return new Array(baseType, LanguageObject.Util.deepClone(getExpressions(), Expression.class));
+ Array clone = new Array(type, LanguageObject.Util.deepClone(getExpressions(), Expression.class));
+ clone.implicit = implicit;
+ return clone;
}
- public Class<?> getBaseType() {
- return baseType;
+ public Class<?> getComponentType() {
+ if (this.type != null) {
+ return this.type.getComponentType();
+ }
+ return null;
}
- public void setBaseType(Class<?> baseType) {
- this.baseType = baseType;
+ public void setComponentType(Class<?> baseType) {
+ if (baseType != null) {
+ this.type = DataTypeManager.getArrayType(baseType);
+ } else {
+ this.type = null;
+ }
}
public List<Expression> getExpressions() {
@@ -82,12 +104,24 @@
return false;
}
Array other = (Array) obj;
- return EquivalenceUtil.areEqual(baseType, other.baseType) && EquivalenceUtil.areEqual(expressions, other.expressions);
+ return EquivalenceUtil.areEqual(type, other.type) && EquivalenceUtil.areEqual(expressions, other.expressions);
}
@Override
public String toString() {
return SQLStringVisitor.getSQLString(this);
}
+
+ public void setImplicit(boolean implicit) {
+ this.implicit = implicit;
+ }
+ /**
+ * If the array has been implicitly constructed, such as with vararg parameters
+ * @return
+ */
+ public boolean isImplicit() {
+ return implicit;
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/ArrayValue.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -22,17 +22,29 @@
package org.teiid.query.sql.symbol;
+import java.io.Serializable;
import java.util.Arrays;
-public class ArrayValue implements Comparable<ArrayValue> {
+import org.teiid.query.sql.visitor.SQLStringVisitor;
+
+public class ArrayValue implements Comparable<ArrayValue>, Serializable {
+ private static final long serialVersionUID = 517794153664734815L;
private Object[] values;
+ @SuppressWarnings("serial")
+ public final static class NullException extends RuntimeException {};
+ private final static NullException ex = new NullException();
+
public ArrayValue(Object[] values) {
this.values = values;
}
@Override
public int compareTo(ArrayValue o) {
+ return compareTo(o, false);
+ }
+
+ public int compareTo(ArrayValue o, boolean noNulls) {
int len1 = values.length;
int len2 = o.values.length;
int lim = Math.min(len1, len2);
@@ -40,11 +52,17 @@
Object object1 = values[k];
Object object2 = o.values[k];
if (object1 == null) {
+ if (noNulls) {
+ throw ex;
+ }
if (object2 != null) {
return -1;
}
continue;
} else if (object2 == null) {
+ if (noNulls) {
+ throw ex;
+ }
return 1;
}
int comp = Constant.COMPARATOR.compare(object1, object2);
@@ -76,4 +94,9 @@
return values;
}
+ @Override
+ public String toString() {
+ return SQLStringVisitor.getSQLString(new Constant(this));
+ }
+
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Constant.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -134,11 +134,15 @@
if(type == null) {
throw new IllegalArgumentException(QueryPlugin.Util.getString("ERR.015.010.0014")); //$NON-NLS-1$
}
+ Class<?> originalType = type;
+ while (type.isArray()) {
+ type = type.getComponentType();
+ }
if(! DataTypeManager.getAllDataTypeClasses().contains(type)) {
throw new IllegalArgumentException(QueryPlugin.Util.getString("ERR.015.010.0015", type.getName())); //$NON-NLS-1$
}
- assert value == null || type.isAssignableFrom(value.getClass()) : "Invalid value for specified type."; //$NON-NLS-1$
- this.type = type;
+ assert value == null || originalType.isArray() || originalType.isAssignableFrom(value.getClass()) : "Invalid value for specified type."; //$NON-NLS-1$
+ this.type = originalType;
}
/**
@@ -150,10 +154,20 @@
this.value = DataTypeManager.convertToRuntimeType(value);
if (this.value == null) {
this.type = DataTypeManager.DefaultDataClasses.NULL;
- } else if (DataTypeManager.getAllDataTypeClasses().contains(this.value.getClass())) {
+ } else {
this.type = this.value.getClass();
- } else {
- this.type = DataTypeManager.DefaultDataClasses.OBJECT;
+ Class<?> originalType = type;
+ while (type.isArray()) {
+ type = type.getComponentType();
+ }
+ if (DataTypeManager.getAllDataTypeClasses().contains(type)) {
+ //array of a runtime-type
+ this.type = originalType;
+ } else if (originalType.isArray()) {
+ this.type = DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.OBJECT);
+ } else {
+ this.type = DataTypeManager.DefaultDataClasses.OBJECT;
+ }
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/Reference.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -41,6 +41,7 @@
}
private boolean positional;
+ private boolean optional;
private int refIndex;
private Class<?> type;
@@ -81,6 +82,7 @@
this.expression = ref.expression.clone();
}
this.constraint = ref.constraint;
+ this.optional = ref.optional;
}
public int getIndex() {
@@ -186,5 +188,13 @@
assert this.expression != null && !this.positional;
this.expression = expression;
}
+
+ public boolean isOptional() {
+ return optional;
+ }
+
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -1138,44 +1138,65 @@
public void visit( Constant obj ) {
Class<?> type = obj.getType();
- String[] constantParts = null;
- if (obj.isMultiValued()) {
+ boolean multiValued = obj.isMultiValued();
+ Object value = obj.getValue();
+ outputLiteral(type, multiValued, value);
+ }
+
+ private void outputLiteral(Class<?> type,
+ boolean multiValued, Object value) throws AssertionError {
+ String[] constantParts = null;
+ if (multiValued) {
constantParts = new String[] {"?"}; //$NON-NLS-1$
- } else if (obj.isNull()) {
- if (type.equals(DataTypeManager.DefaultDataClasses.BOOLEAN)) {
- constantParts = new String[] {UNKNOWN};
- } else {
- constantParts = new String[] {"null"}; //$NON-NLS-1$
- }
- } else {
- if (Number.class.isAssignableFrom(type)) {
- constantParts = new String[] {obj.getValue().toString()};
- } else if (type.equals(DataTypeManager.DefaultDataClasses.BOOLEAN)) {
- constantParts = new String[] {obj.getValue().equals(Boolean.TRUE) ? TRUE : FALSE};
- } else if (type.equals(DataTypeManager.DefaultDataClasses.TIMESTAMP)) {
- constantParts = new String[] {"{ts'", obj.getValue().toString(), "'}"}; //$NON-NLS-1$ //$NON-NLS-2$
- } else if (type.equals(DataTypeManager.DefaultDataClasses.TIME)) {
- constantParts = new String[] {"{t'", obj.getValue().toString(), "'}"}; //$NON-NLS-1$ //$NON-NLS-2$
- } else if (type.equals(DataTypeManager.DefaultDataClasses.DATE)) {
- constantParts = new String[] {"{d'", obj.getValue().toString(), "'}"}; //$NON-NLS-1$ //$NON-NLS-2$
- } else if (type.equals(DataTypeManager.DefaultDataClasses.VARBINARY)) {
- constantParts = new String[] {"X'", obj.getValue().toString(), "'"}; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (constantParts == null) {
- if (DataTypeManager.isLOB(type)) {
- constantParts = new String[] {"?"}; //$NON-NLS-1$
- } else {
- String strValue = obj.getValue().toString();
- strValue = escapeStringValue(strValue, "'"); //$NON-NLS-1$
- constantParts = new String[] {"'", strValue, "'"}; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
+ } else if (value == null) {
+ if (type.equals(DataTypeManager.DefaultDataClasses.BOOLEAN)) {
+ constantParts = new String[] {UNKNOWN};
+ } else {
+ constantParts = new String[] {"null"}; //$NON-NLS-1$
+ }
+ } else {
+ if (value.getClass() == ArrayValue.class) {
+ ArrayValue av = (ArrayValue)value;
+ append(Tokens.LPAREN);
+ for (int i = 0; i < av.getValues().length; i++) {
+ if (i > 0) {
+ append(Tokens.COMMA);
+ append(SPACE);
+ }
+ Object value2 = av.getValues()[i];
+ outputLiteral(value2!=null?value2.getClass():av.getValues().getClass().getComponentType(), multiValued, value2);
+ }
+ append(Tokens.RPAREN);
+ return;
+ }
+ if (Number.class.isAssignableFrom(type)) {
+ constantParts = new String[] {value.toString()};
+ } else if (type.equals(DataTypeManager.DefaultDataClasses.BOOLEAN)) {
+ constantParts = new String[] {value.equals(Boolean.TRUE) ? TRUE : FALSE};
+ } else if (type.equals(DataTypeManager.DefaultDataClasses.TIMESTAMP)) {
+ constantParts = new String[] {"{ts'", value.toString(), "'}"}; //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (type.equals(DataTypeManager.DefaultDataClasses.TIME)) {
+ constantParts = new String[] {"{t'", value.toString(), "'}"}; //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (type.equals(DataTypeManager.DefaultDataClasses.DATE)) {
+ constantParts = new String[] {"{d'", value.toString(), "'}"}; //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (type.equals(DataTypeManager.DefaultDataClasses.VARBINARY)) {
+ constantParts = new String[] {"X'", value.toString(), "'"}; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (constantParts == null) {
+ if (DataTypeManager.isLOB(type)) {
+ constantParts = new String[] {"?"}; //$NON-NLS-1$
+ } else {
+ String strValue = value.toString();
+ strValue = escapeStringValue(strValue, "'"); //$NON-NLS-1$
+ constantParts = new String[] {"'", strValue, "'"}; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
for (String string : constantParts) {
append(string);
}
- }
+ }
/**
* Take a string literal and escape it as necessary. By default, this converts ' to ''.
@@ -2111,9 +2132,13 @@
@Override
public void visit(Array array) {
- append(Tokens.LPAREN);
+ if (!array.isImplicit()) {
+ append(Tokens.LPAREN);
+ }
registerNodes(array.getExpressions(), 0);
- append(Tokens.RPAREN);
+ if (!array.isImplicit()) {
+ append(Tokens.RPAREN);
+ }
}
public static String escapeSinglePart( String part ) {
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -286,12 +286,12 @@
QueryMetadataInterface metadata = context.getMetadata();
GlobalTableStore globalStore = context.getGlobalTableStore();
if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEW)) {
- Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(1).getExpression()).getValue());
+ Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue());
Object matTableId = globalStore.getGlobalTempTableMetadataId(groupID);
String matViewName = metadata.getFullName(groupID);
String matTableName = metadata.getFullName(matTableId);
LogManager.logDetail(LogConstants.CTX_MATVIEWS, "processing refreshmatview for", matViewName); //$NON-NLS-1$
- boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(2).getExpression()).getValue());
+ boolean invalidate = Boolean.TRUE.equals(((Constant)proc.getParameter(3).getExpression()).getValue());
boolean needsLoading = globalStore.needsLoading(matTableName, globalStore.getAddress(), true, true, invalidate);
if (!needsLoading) {
return CollectionTupleSource.createUpdateCountTupleSource(-1);
@@ -301,7 +301,7 @@
int rowCount = loadGlobalTable(context, matTable, matTableName, globalStore);
return CollectionTupleSource.createUpdateCountTupleSource(rowCount);
} else if (StringUtil.endsWithIgnoreCase(proc.getProcedureCallableName(), REFRESHMATVIEWROW)) {
- Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(1).getExpression()).getValue());
+ Object groupID = validateMatView(metadata, (String)((Constant)proc.getParameter(2).getExpression()).getValue());
Object pk = metadata.getPrimaryKey(groupID);
String matViewName = metadata.getFullName(groupID);
if (pk == null) {
@@ -320,7 +320,7 @@
if (!tempTable.isUpdatable()) {
throw new QueryProcessingException(QueryPlugin.Event.TEIID30232, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30232, matViewName));
}
- Constant key = (Constant)proc.getParameter(2).getExpression();
+ Constant key = (Constant)proc.getParameter(3).getExpression();
LogManager.logInfo(LogConstants.CTX_MATVIEWS, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30012, matViewName, key));
Object id = ids.iterator().next();
String targetTypeName = metadata.getElementType(id);
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -367,13 +367,20 @@
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.multisource_constant", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$
continue;
}
- if (EvaluatableVisitor.isFullyEvaluatable(param.getExpression(), true)) {
+ if (!getMetadata().elementSupports(param.getMetadataID(), SupportConstants.Element.NULL) && EvaluatableVisitor.isFullyEvaluatable(param.getExpression(), true)) {
try {
// If nextValue is an expression, evaluate it before checking for null
Object evaluatedValue = Evaluator.evaluate(param.getExpression());
- if(evaluatedValue == null && ! getMetadata().elementSupports(param.getMetadataID(), SupportConstants.Element.NULL)) {
+ if(evaluatedValue == null) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$
- }
+ } else if (evaluatedValue instanceof ArrayValue && getMetadata().isVariadic(param.getMetadataID())) {
+ ArrayValue av = (ArrayValue)evaluatedValue;
+ for (Object o : av.getValues()) {
+ if (o == null) {
+ handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0055", param.getParameterSymbol()), param.getParameterSymbol()); //$NON-NLS-1$
+ }
+ }
+ }
} catch(ExpressionEvaluationException e) {
//ignore for now, we don't have the context which could be the problem
}
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-08-30 17:48:02 UTC (rev 4382)
@@ -454,6 +454,7 @@
| <INCLUDING: "including">
| <EXCLUDING: "excluding">
| <XMLDECLARATION: "xmldeclaration">
+| <VARIADIC: "variadic">
}
/*
@@ -561,7 +562,7 @@
|<TO_BYTES>|<TIMESTAMPADD>|<TIMESTAMPDIFF>|<QUERYSTRING>|<NAMESPACE>|<RESULT>|<INDEX>|<ACCESSPATTERN>|<AUTO_INCREMENT>|<WELLFORMED>|<SQL_TSI_FRAC_SECOND>
|<SQL_TSI_SECOND>|<SQL_TSI_MINUTE>|<SQL_TSI_HOUR>|<SQL_TSI_DAY>|<SQL_TSI_WEEK>|<SQL_TSI_MONTH>|<SQL_TSI_QUARTER>|<SQL_TSI_YEAR>|<TEXTTABLE>|<ARRAYTABLE>
|<SELECTOR>|<SKIP_KEYWORD>|<WIDTH>|<PASSING>|<NAME>|<ENCODING>|<COLUMNS>|<DELIMITER>|<QUOTE>|<HEADER>|<NULLS>|<OBJECTTABLE>
- |<VERSION>|<INCLUDING>|<EXCLUDING>|<XMLDECLARATION>)
+ |<VERSION>|<INCLUDING>|<EXCLUDING>|<XMLDECLARATION>|<VARIADIC>)
{
return getToken(0);
}
@@ -4609,11 +4610,13 @@
ProcedureParameter param = null;
String defaultValue = null;
boolean notNull = false;
+ boolean vararg = false;
}
{
- [((<IN> {ppType = ProcedureParameter.Type.In ;})
+ [LOOKAHEAD(1) ((<IN> {ppType = ProcedureParameter.Type.In ;})
|(<OUT> {ppType = ProcedureParameter.Type.Out;})
- |(<INOUT> {ppType = ProcedureParameter.Type.InOut;}))]
+ |(<INOUT> {ppType = ProcedureParameter.Type.InOut;})
+ |(<VARIADIC> {ppType = ProcedureParameter.Type.In ; vararg = true;}))]
name = id()
type = parseDataType()
[<NOT> <NULL> {notNull = true;}]
@@ -4632,6 +4635,9 @@
if (notNull) {
param.setNullType(Column.NullType.No_Nulls);
}
+ if (vararg) {
+ param.setVarArg(vararg);
+ }
} catch (TranslatorException e){
throw new ParseException(e.getMessage());
}
Modified: trunk/engine/src/main/resources/org/teiid/metadata/SYSADMIN.sql
===================================================================
--- trunk/engine/src/main/resources/org/teiid/metadata/SYSADMIN.sql 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/resources/org/teiid/metadata/SYSADMIN.sql 2012-08-30 17:48:02 UTC (rev 4382)
@@ -21,10 +21,10 @@
CREATE FOREIGN PROCEDURE logMsg(OUT logged boolean NOT NULL RESULT, IN level string NOT NULL DEFAULT 'DEBUG', IN context string NOT NULL DEFAULT 'org.teiid.PROCESSOR', IN msg object NOT NULL)
OPTIONS (UPDATECOUNT 0)
-CREATE FOREIGN PROCEDURE refreshMatView(IN ViewName string NOT NULL, IN Invalidate boolean NOT NULL DEFAULT 'false', OUT RowsUpdated integer NOT NULL RESULT)
+CREATE FOREIGN PROCEDURE refreshMatView(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, IN Invalidate boolean NOT NULL DEFAULT 'false')
OPTIONS (UPDATECOUNT 0)
-CREATE FOREIGN PROCEDURE refreshMatViewRow(IN ViewName string NOT NULL, IN Key object NOT NULL, OUT RowsUpdated integer NOT NULL RESULT)
+CREATE FOREIGN PROCEDURE refreshMatViewRow(OUT RowsUpdated integer NOT NULL RESULT, IN ViewName string NOT NULL, IN Key object NOT NULL)
OPTIONS (UPDATECOUNT 0)
CREATE FOREIGN PROCEDURE setColumnStats(IN tableName string NOT NULL, IN columnName string NOT NULL, IN distinctCount integer, IN nullCount integer, IN max string, IN min string)
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-08-30 17:48:02 UTC (rev 4382)
@@ -649,7 +649,7 @@
XMLSerialize.resolvingError=XMLSerialize is valid only for XML expressions: {0}
TEIID30336=XMLSerialize: data exception - not an xml document
TEIID30333=Error evaluating XMLQuery: {0}
-TEIID30145=Unable to convert procedural parameter of type {0} to expected type {1}
+TEIID30145=Unable to convert procedural parameter {0} of type {1} to expected type {2}
TEIID30139=Procedure {0} does not have a return value.
TEIID30144=OUT/RETURN parameter {0} with type {1} cannot be converted to {2}
TEIID30100=Expected dynamic command sql to be of type STRING instead of type {0}.
@@ -943,7 +943,7 @@
TEIID30098= Unable to resolve return element referred to by LOOKUP function: {0}
TEIID30118=Cannot create temporary table "{0}". An object with the same name already exists.
TEIID30121=Variable "{0}" is read only and cannot be assigned a value.
-TEIID30140= Incorrect number of parameters specified on the stored procedure {2} - expected {0} but got {1}
+TEIID30140= Incorrect number of parameters specified on the stored procedure {2} - expected between {0} and {1} but got {2}
TEIID30146= No procedure plan exists for {0}.
TEIID30183=Text parse error: Non-whitespace character found between the qualifier and the delimiter in text line {0} in {1}.
TEIID30227=Table {0} is locked by pending transaction update.
@@ -1027,6 +1027,8 @@
TEIID31109=Invalid language {0}. Supported and allowed language names are {1}.
TEIID31110=Invalid script {0}. Scrpting engine reported: {1}
TEIID31111=No such accessible property/method {0} on {1}.
+TEIID31112=Only the last parameter of {0} may be VARIADIC.
+TEIID31113={0} extra positional parameter(s) passed to {2}.
SQLParser.proc_type_conflict=Result type {1} conflicts with return type {2} for procedure {0}
SQLParser.param_out=Procedure {0} RESULT param {1} must be of type OUT.
Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestDDLStringVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestDDLStringVisitor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestDDLStringVisitor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -241,7 +241,15 @@
private void helpTest(String ddl, String expected) throws ParseException {
Schema s = TestDDLParser.helpParse(ddl, "model").getSchema();
String metadataDDL = DDLStringVisitor.getDDLString(s, null, null);
- //System.out.println(metadataDDL);
assertEquals(expected, metadataDDL);
}
+
+ @Test
+ public void testSourceProcedureVariadic() throws Exception {
+ String ddl = "CREATE FOREIGN PROCEDURE myProc(OUT p1 boolean, VARIADIC p3 decimal) " +
+ "RETURNS (r1 varchar, r2 decimal);";
+
+ String expected = "CREATE FOREIGN PROCEDURE myProc(OUT p1 boolean, VARIADIC p3 bigdecimal) RETURNS TABLE (r1 string, r2 bigdecimal)";
+ helpTest(ddl, expected);
+ }
}
Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -64,6 +64,7 @@
DDLMetadataRepository repo = new DDLMetadataRepository();
MetadataFactory mf = new MetadataFactory("myVDB",1, modelName, TestDDLParser.getDataTypes(), new Properties(), ddl);
+ mf.setBuiltinDataTypes(SystemMetadata.getInstance().getSystemStore().getDatatypes());
mf.getSchema().setPhysical(physical);
repo.loadMetadata(mf, null, null);
mf.mergeInto(store);
@@ -312,4 +313,17 @@
ValidatorReport report = new MetadataValidator().validate(this.vdb, this.store);
assertFalse(printError(report), report.hasItems());
}
+
+ @Test public void testInvalidVarArgs() throws Exception {
+ // note here the unique here does not matter for non-existent reference columns, only primary key counted.
+ String ddl = "CREATE FOREIGN FUNCTION f1(VARIADIC e1 integer, e2 varchar) RETURNS varchar;";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = new MetadataValidator().validate(this.vdb, this.store);
+ assertTrue(printError(report), report.hasItems());
+ }
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -27,6 +27,7 @@
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -47,19 +48,12 @@
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.resolver.TestFunctionResolving;
import org.teiid.query.sql.lang.CollectionValueIterator;
+import org.teiid.query.sql.lang.CompareCriteria;
import org.teiid.query.sql.lang.IsNullCriteria;
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.symbol.CaseExpression;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.TestCaseExpression;
-import org.teiid.query.sql.symbol.TestSearchedCaseExpression;
+import org.teiid.query.sql.symbol.*;
import org.teiid.query.sql.util.ValueIterator;
import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.query.util.CommandContext;
@@ -77,19 +71,14 @@
}
public Object helpEval(Expression expr, Expression[] elementList, Object[] valueList, ProcessorDataManager dataMgr, CommandContext context) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
- Map elements = new HashMap();
+ Map<Expression, Integer> elements = new HashMap<Expression, Integer>();
if (elementList != null) {
for(int i=0; i<elementList.length; i++) {
- elements.put(elementList[i], new Integer(i));
+ elements.put(elementList[i], i);
}
}
- List tuple = new ArrayList();
- if (valueList != null) {
- for(int i=0; i<valueList.length; i++) {
- tuple.add(valueList[i]);
- }
- }
+ List<Object> tuple = Arrays.asList(valueList);
return new Evaluator(elements, dataMgr, context).evaluate(expr, tuple);
}
@@ -488,4 +477,9 @@
assertEquals(Boolean.TRUE, Evaluator.evaluate(ex));
}
+ @Test public void testArrayEquality() throws Exception {
+ assertEquals(Boolean.TRUE, Evaluator.evaluate(new CompareCriteria(new Array(Arrays.asList((Expression)new Constant(1))), CompareCriteria.EQ, new Array(Arrays.asList((Expression)new Constant(1))))));
+ assertNull(new Evaluator(null, null, null).evaluateTVL(new CompareCriteria(new Array(Arrays.asList((Expression)new Constant(1))), CompareCriteria.EQ, new Array(Arrays.asList((Expression)new Constant(null)))), null));
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -63,6 +63,7 @@
import org.teiid.query.processor.xml.TestXMLPlanningEnhancements;
import org.teiid.query.processor.xml.TestXMLProcessor;
import org.teiid.query.resolver.QueryResolver;
+import org.teiid.query.resolver.TestProcedureResolving;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.SPParameter;
@@ -2004,7 +2005,60 @@
Mockito.verify(ts, Mockito.times(0)).commit(tc);
Mockito.verify(ts).rollback(tc);
}
+
+ @Test public void testVarArgs() throws Exception {
+ String ddl = "create foreign procedure proc (x integer, VARIADIC z integer); create virtual procedure vproc (x integer, VARIADIC z integer) returns integer as begin \"return\" = z[2] + array_length(z); call proc(x, z); end;";
+ TransformationMetadata tm = TestProcedureResolving.createMetadata(ddl);
+ String sql = "call vproc(1, 2, 3)"; //$NON-NLS-1$
+ ProcessorPlan plan = getProcedurePlan(sql, tm);
+
+ HardcodedDataManager dataManager = new HardcodedDataManager(tm);
+ dataManager.addData("EXEC proc(1, 2, 3)", new List<?>[0]);
+ // Create expected results
+ List[] expected = new List[] { Arrays.asList(5) }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataManager, tm);
+ }
+
+ @Test public void testVarArgsVirtNotNull() throws Exception {
+ String ddl = "create virtual procedure vproc (x integer, VARIADIC z integer NOT NULL) returns (y integer) as begin select array_length(z); end;";
+ TransformationMetadata tm = TestProcedureResolving.createMetadata(ddl);
+
+ String sql = "call vproc(1, null, 3)"; //$NON-NLS-1$
+
+ try {
+ getProcedurePlan(sql, tm);
+ fail();
+ } catch (QueryValidatorException e) {
+
+ }
+
+ sql = "call vproc(1, (select cast(null as integer)), 3)"; //$NON-NLS-1$
+
+ ProcessorPlan plan = getProcedurePlan(sql, tm);
+
+ HardcodedDataManager dataManager = new HardcodedDataManager();
+ try {
+ helpTestProcess(plan, null, dataManager, tm);
+ fail();
+ } catch (QueryValidatorException e) {
+
+ }
+ }
+
+ @Test public void testVarArgsFunctionInVirt() throws Exception {
+ String ddl = "create virtual procedure proc (VARIADIC z STRING) returns string as \"return\" = coalesce(null, null, z);";
+ TransformationMetadata tm = TestProcedureResolving.createMetadata(ddl);
+ String sql = "call proc(1, 2, 3)"; //$NON-NLS-1$
+
+ ProcessorPlan plan = getProcedurePlan(sql, tm);
+
+ HardcodedDataManager dataManager = new HardcodedDataManager(tm);
+ // note that we're properly cast to string, even though we called with int
+ List[] expected = new List[] { Arrays.asList("1") }; //$NON-NLS-1$
+ helpTestProcess(plan, expected, dataManager, tm);
+ }
+
private static final boolean DEBUG = false;
}
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/CheckNoTempMetadataIDsVisitor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/CheckNoTempMetadataIDsVisitor.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/CheckNoTempMetadataIDsVisitor.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -22,12 +22,16 @@
package org.teiid.query.resolver;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
import org.teiid.query.metadata.TempMetadataID;
-import org.teiid.query.sql.*;
+import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.navigator.DeepPreOrderNavigator;
-import org.teiid.query.sql.symbol.*;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Symbol;
/**
@@ -37,16 +41,14 @@
*/
public class CheckNoTempMetadataIDsVisitor extends LanguageVisitor {
- private Collection symbolsWithTempMetadataIDs;
- private Collection ignoreTheseSymbols;
+ private Collection<Symbol> symbolsWithTempMetadataIDs;
/**
* By default, this visitor deeply traverses all commands, and there are
* no symbols to ignore
*/
public CheckNoTempMetadataIDsVisitor() {
- symbolsWithTempMetadataIDs = new ArrayList();
- this.ignoreTheseSymbols = Collections.EMPTY_LIST;
+ symbolsWithTempMetadataIDs = new ArrayList<Symbol>();
}
/**
@@ -54,7 +56,7 @@
* @return Collection of any unresolved Symbols; may
* be empty but never null
*/
- public Collection getSymbols(){
+ public Collection<Symbol> getSymbols(){
return this.symbolsWithTempMetadataIDs;
}
@@ -62,7 +64,7 @@
* By default, this visitor deeply traverses all commands, and there are
* no symbols to ignore
*/
- public static final Collection checkSymbols(LanguageObject obj){
+ public static final Collection<Symbol> checkSymbols(LanguageObject obj){
CheckNoTempMetadataIDsVisitor visitor = new CheckNoTempMetadataIDsVisitor();
DeepPreOrderNavigator.doVisit(obj, visitor);
return visitor.getSymbols();
@@ -71,13 +73,13 @@
// visitor methods
public void visit(ElementSymbol obj) {
- if (obj.getMetadataID() instanceof TempMetadataID && !(this.ignoreTheseSymbols.contains(obj))){
+ if (obj.getMetadataID() instanceof TempMetadataID){
this.symbolsWithTempMetadataIDs.add(obj);
}
}
public void visit(GroupSymbol obj) {
- if (obj.getMetadataID() instanceof TempMetadataID && !(this.ignoreTheseSymbols.contains(obj))){
+ if (obj.getMetadataID() instanceof TempMetadataID){
this.symbolsWithTempMetadataIDs.add(obj);
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -24,6 +24,7 @@
import static org.junit.Assert.*;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
@@ -48,6 +49,7 @@
import org.teiid.query.sql.lang.Command;
import org.teiid.query.sql.lang.Insert;
import org.teiid.query.sql.lang.ProcedureContainer;
+import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.proc.AssignmentStatement;
import org.teiid.query.sql.proc.Block;
@@ -55,12 +57,14 @@
import org.teiid.query.sql.proc.CreateProcedureCommand;
import org.teiid.query.sql.proc.LoopStatement;
import org.teiid.query.sql.proc.TriggerAction;
+import org.teiid.query.sql.symbol.Array;
import org.teiid.query.sql.symbol.Constant;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.visitor.CommandCollectorVisitor;
import org.teiid.query.sql.visitor.ElementCollectorVisitor;
import org.teiid.query.unittest.RealMetadataFactory;
+import org.teiid.query.validator.ValidatorReport;
@SuppressWarnings("nls")
public class TestProcedureResolving {
@@ -1024,14 +1028,8 @@
}
@Test public void testOptionalParams() throws Exception {
- VDBMetaData vdb = new VDBMetaData();
- MetadataStore store = new MetadataStore();
String ddl = "create foreign procedure proc (x integer, y string);\n";
- TestMetadataValidator.buildModel("x", true, vdb, store, ddl);
- TransformationMetadata tm = new TransformationMetadata(vdb, new CompositeMetadataStore(Arrays.asList(store)), null, RealMetadataFactory.SFM.getSystemFunctions(), null);
- vdb.addAttchment(TransformationMetadata.class, tm);
- vdb.addAttchment(QueryMetadataInterface.class, tm);
- new MetadataValidator().validate(vdb, store);
+ TransformationMetadata tm = createMetadata(ddl);
String sql = "call proc (1)"; //$NON-NLS-1$
@@ -1045,16 +1043,24 @@
assertEquals(new Constant("a", DataTypeManager.DefaultDataClasses.STRING), sp.getParameter(2).getExpression());
}
-
- @Test public void testOptionalParams1() throws Exception {
- VDBMetaData vdb = new VDBMetaData();
+
+ public static TransformationMetadata createMetadata(String ddl) throws Exception {
+ VDBMetaData vdb = new VDBMetaData();
MetadataStore store = new MetadataStore();
- String ddl = "create foreign procedure proc (x integer, y string NOT NULL, z integer);\n";
TestMetadataValidator.buildModel("x", true, vdb, store, ddl);
TransformationMetadata tm = new TransformationMetadata(vdb, new CompositeMetadataStore(Arrays.asList(store)), null, RealMetadataFactory.SFM.getSystemFunctions(), null);
vdb.addAttchment(TransformationMetadata.class, tm);
vdb.addAttchment(QueryMetadataInterface.class, tm);
- new MetadataValidator().validate(vdb, store);
+ ValidatorReport report = new MetadataValidator().validate(vdb, store);
+ if (report.hasItems()) {
+ throw new RuntimeException(report.getFailureMessage());
+ }
+ return tm;
+ }
+
+ @Test public void testOptionalParams1() throws Exception {
+ String ddl = "create foreign procedure proc (x integer, y string NOT NULL, z integer);\n";
+ TransformationMetadata tm = createMetadata(ddl);
String sql = "call proc (1, 'a')"; //$NON-NLS-1$
@@ -1063,4 +1069,21 @@
assertEquals(new Constant("a", DataTypeManager.DefaultDataClasses.STRING), sp.getParameter(2).getExpression());
}
+ @Test public void testVarArgs() throws Exception {
+ String ddl = "create foreign procedure proc (x integer, VARIADIC z integer) returns (x string);\n";
+ TransformationMetadata tm = createMetadata(ddl);
+ String sql = "call proc (1, 2, 3)"; //$NON-NLS-1$
+
+ StoredProcedure sp = (StoredProcedure) TestResolver.helpResolve(sql, tm);
+ assertEquals("EXEC proc(1, 2, 3)", sp.toString());
+ assertEquals(new Constant(1), sp.getParameter(1).getExpression());
+ assertEquals(new Array(DataTypeManager.DefaultDataClasses.INTEGER, Arrays.asList((Expression)new Constant(2), new Constant(3))), sp.getParameter(2).getExpression());
+ assertEquals(SPParameter.RESULT_SET, sp.getParameter(3).getParameterType());
+
+ sql = "call proc (1)"; //$NON-NLS-1$
+ sp = (StoredProcedure) TestResolver.helpResolve(sql, tm);
+ assertEquals("EXEC proc(1)", sp.toString());
+ assertEquals(new Array(DataTypeManager.DefaultDataClasses.INTEGER, new ArrayList<Expression>(0)), sp.getParameter(2).getExpression());
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -129,7 +129,7 @@
if (variableNames.length == 0){
//There should be no TempMetadataIDs
- Collection symbols = CheckNoTempMetadataIDsVisitor.checkSymbols(query);
+ Collection<Symbol> symbols = CheckNoTempMetadataIDsVisitor.checkSymbols(query);
assertTrue("Expected no symbols with temp metadataIDs, but got " + symbols, symbols.isEmpty()); //$NON-NLS-1$
}
@@ -315,7 +315,7 @@
StoredProcedure proc = (StoredProcedure)helpResolve(sql);
- List<SPParameter> params = proc.getParameters();
+ Collection<SPParameter> params = proc.getParameters();
// Check remaining params against expected expressions
int i = 0;
@@ -852,14 +852,14 @@
StoredProcedure proc = (StoredProcedure) helpResolve("EXEC pm1.sq2('abc')"); //$NON-NLS-1$
// Check number of resolved parameters
- List<SPParameter> params = proc.getParameters();
+ Map<Integer, SPParameter> params = proc.getMapOfParameters();
assertEquals("Did not get expected parameter count", 2, params.size()); //$NON-NLS-1$
// Check resolved parameters
- SPParameter param1 = params.get(1);
+ SPParameter param1 = params.get(2);
helpCheckParameter(param1, ParameterInfo.RESULT_SET, 2, "pm1.sq2.ret", java.sql.ResultSet.class, null); //$NON-NLS-1$
- SPParameter param2 = params.get(0);
+ SPParameter param2 = params.get(1);
helpCheckParameter(param2, ParameterInfo.IN, 1, "pm1.sq2.in", DataTypeManager.DefaultDataClasses.STRING, new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -876,14 +876,14 @@
StoredProcedure proc = (StoredProcedure) helpResolve("EXEC pm1.sq3a('abc', 123)"); //$NON-NLS-1$
// Check number of resolved parameters
- List<SPParameter> params = proc.getParameters();
+ Map<Integer, SPParameter> params = proc.getMapOfParameters();
assertEquals("Did not get expected parameter count", 3, params.size()); //$NON-NLS-1$
// Check resolved parameters
- SPParameter param1 = params.get(0);
+ SPParameter param1 = params.get(1);
helpCheckParameter(param1, ParameterInfo.IN, 1, "pm1.sq3a.in", DataTypeManager.DefaultDataClasses.STRING, new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
- SPParameter param2 = params.get(1);
+ SPParameter param2 = params.get(2);
helpCheckParameter(param2, ParameterInfo.IN, 2, "pm1.sq3a.in2", DataTypeManager.DefaultDataClasses.INTEGER, new Constant(new Integer(123))); //$NON-NLS-1$
}
@@ -2049,9 +2049,7 @@
while(iter.hasNext()) {
SubqueryFromClause clause = (SubqueryFromClause) iter.next();
StoredProcedure proc = (StoredProcedure) clause.getCommand();
- List procParams = proc.getParameters();
- for(int i=0; i<procParams.size(); i++) {
- SPParameter param = (SPParameter) procParams.get(i);
+ for (SPParameter param : proc.getParameters()) {
if(param.getParameterType() == ParameterInfo.IN) {
if(params[0] == null) {
params[0] = param;
@@ -2115,7 +2113,7 @@
}
@Test public void testParameterError() throws Exception {
- helpResolveException("EXEC pm1.sp2(1, 2)", metadata, "TEIID30140 Incorrect number of parameters specified on the stored procedure pm1.sp2 - expected 1 but got 2"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpResolveException("EXEC pm1.sp2(1, 2)", metadata, "TEIID31113 1 extra positional parameter(s) passed to pm1.sp2."); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testUnionOfAliasedLiteralsGetsModified() {
@@ -2601,7 +2599,7 @@
@Test public void testCallableStatementTooManyParameters() throws Exception {
String sql = "{call pm4.spTest9(?, ?)}"; //$NON-NLS-1$
- TestResolver.helpResolveException(sql, RealMetadataFactory.exampleBQTCached(), "TEIID30140 Incorrect number of parameters specified on the stored procedure pm4.spTest9 - expected 1 but got 2"); //$NON-NLS-1$
+ TestResolver.helpResolveException(sql, RealMetadataFactory.exampleBQTCached(), "TEIID31113 1 extra positional parameter(s) passed to pm4.spTest9."); //$NON-NLS-1$
}
@Test public void testUpdateSetClauseReferenceType() {
Modified: trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
@@ -868,7 +869,7 @@
// rewrite
Command rewriteCommand = QueryRewriter.rewrite(command, metadata, null);
- List<SPParameter> parameters = ((StoredProcedure)rewriteCommand).getParameters();
+ Collection<SPParameter> parameters = ((StoredProcedure)rewriteCommand).getParameters();
for (SPParameter param : parameters) {
if(param.getParameterType() == ParameterInfo.IN || param.getParameterType() == ParameterInfo.INOUT){
Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestArray.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -24,11 +24,20 @@
import static org.junit.Assert.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import org.junit.Test;
+import org.teiid.client.BatchSerializer;
+import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.sql.visitor.SQLStringVisitor;
@SuppressWarnings("nls")
public class TestArray {
@@ -43,6 +52,12 @@
UnitTestUtil.helpTestEquivalence(1, a1, a2);
}
+ @Test public void testArrayValueToString() {
+ ArrayValue a1 = new ArrayValue(new Object[] {1, "x'2", 3});
+
+ assertEquals("(1, 'x''2', 3)", SQLStringVisitor.getSQLString(new Constant(a1)));
+ }
+
@Test public void testArrayClone() {
Array array = new Array(DataTypeManager.DefaultDataClasses.OBJECT, Arrays.asList((Expression)new ElementSymbol("e1")));
@@ -52,4 +67,17 @@
assertNotSame(a1.getExpressions().get(0), array.getExpressions().get(0));
}
+ @Test public void testArrayValueSerialization() throws Exception {
+ ArrayValue a1 = new ArrayValue(new Integer[] {1, 2, 3});
+ String[] types = TupleBuffer.getTypeNames(Arrays.asList(new Array(Integer.class, null)));
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ BatchSerializer.writeBatch(oos, types, Collections.singletonList(Arrays.asList((a1))));
+ oos.close();
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ List<List<Object>> batch = BatchSerializer.readBatch(ois, types);
+ assertEquals(a1, batch.get(0).get(0));
+ }
+
}
Modified: trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java 2012-08-29 23:32:18 UTC (rev 4381)
+++ trunk/engine/src/test/java/org/teiid/query/sql/symbol/TestConstant.java 2012-08-30 17:48:02 UTC (rev 4382)
@@ -171,5 +171,10 @@
assertEquals(0, c.compare("a ", "a"));
}
+
+ @Test public void testVarBinaryTyping() {
+ Constant c = new Constant(new byte[1]);
+ assertEquals(DataTypeManager.DefaultDataClasses.VARBINARY, c.getType());
+ }
}
12 years, 4 months
teiid SVN: r4381 - in trunk: engine/src/main/java/org/teiid/query/metadata and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-08-29 19:32:18 -0400 (Wed, 29 Aug 2012)
New Revision: 4381
Modified:
trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java
trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java
trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
Log:
TEIID-2174 fix for case sensitive ddl types
Modified: trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java 2012-08-28 20:03:45 UTC (rev 4380)
+++ trunk/api/src/main/java/org/teiid/metadata/FunctionParameter.java 2012-08-29 23:32:18 UTC (rev 4381)
@@ -24,6 +24,8 @@
import java.io.Serializable;
+import org.teiid.core.types.DataTypeManager;
+
/**
* A function parameter defines the name and description of an input or output
* parameter for a function. The name should not be null, but that is not
@@ -124,7 +126,7 @@
if(type == null) {
this.type = null;
} else {
- this.type = type.toLowerCase();
+ this.type = DataTypeManager.getCanonicalString(type.toLowerCase());
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java 2012-08-28 20:03:45 UTC (rev 4380)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/SystemMetadata.java 2012-08-29 23:32:18 UTC (rev 4381)
@@ -27,10 +27,10 @@
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.TreeMap;
import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
@@ -57,7 +57,7 @@
}
private List<Datatype> dataTypes = new ArrayList<Datatype>();
- private Map<String, Datatype> typeMap = new HashMap<String, Datatype>();
+ private Map<String, Datatype> typeMap = new TreeMap<String, Datatype>(String.CASE_INSENSITIVE_ORDER);
private MetadataStore systemStore;
public SystemMetadata() {
Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java 2012-08-28 20:03:45 UTC (rev 4380)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java 2012-08-29 23:32:18 UTC (rev 4381)
@@ -496,6 +496,15 @@
assertTrue( fm.getInputParameters().get(0).isVarArg());
}
+ @Test public void testMixedCaseTypes() throws Exception {
+ String ddl = "CREATE FUNCTION SourceFunc(flag Boolean) RETURNS varchaR options (UUID 'z')";
+
+ Schema s = helpParse(ddl, "model").getSchema();
+
+ FunctionMethod fm = s.getFunction("z");
+ assertEquals("boolean", fm.getInputParameters().get(0).getType());
+ }
+
@Test(expected=ParseException.class) public void testInvalidFunctionBody() throws Exception {
String ddl = "CREATE FUNCTION SourceFunc(flag boolean) RETURNS varchar AS SELECT 'a';";
12 years, 4 months