teiid SVN: r3767 - in branches/7.4.x: client/src/main/java/org/teiid/net/socket and 2 other directories.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-01-04 10:08:03 -0500 (Wed, 04 Jan 2012)
New Revision: 3767
Modified:
branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
branches/7.4.x/client/src/main/java/org/teiid/jdbc/TeiidDriver.java
branches/7.4.x/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java
branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
Log:
SOA-3685 / TEIID-1883 Query timeout is superceded by synch ttl
Modified: branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2012-01-03 22:02:42 UTC (rev 3766)
+++ branches/7.4.x/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2012-01-04 15:08:03 UTC (rev 3767)
@@ -40,6 +40,8 @@
import java.util.Properties;
import java.util.TimeZone;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
@@ -536,16 +538,21 @@
});
if (synch) {
try {
- pendingResult.get();
+ pendingResult.get(queryTimeoutMS==0?Integer.MAX_VALUE:queryTimeoutMS, TimeUnit.MILLISECONDS);
result.get(); //throw an exception if needed
return result;
} catch (ExecutionException e) {
if (e.getCause() instanceof SQLException) {
throw (SQLException)e.getCause();
}
+ if (e.getCause() != null) {
+ throw TeiidSQLException.create(e.getCause());
+ }
throw TeiidSQLException.create(e);
} catch (InterruptedException e) {
timeoutOccurred();
+ } catch (TimeoutException e) {
+ timeoutOccurred();
}
throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Timeout_before_complete")); //$NON-NLS-1$
}
Modified: branches/7.4.x/client/src/main/java/org/teiid/jdbc/TeiidDriver.java
===================================================================
--- branches/7.4.x/client/src/main/java/org/teiid/jdbc/TeiidDriver.java 2012-01-03 22:02:42 UTC (rev 3766)
+++ branches/7.4.x/client/src/main/java/org/teiid/jdbc/TeiidDriver.java 2012-01-04 15:08:03 UTC (rev 3767)
@@ -70,7 +70,7 @@
}
}
- private static SocketProfile SOCKET_PROFILE = new SocketProfile();
+ private ConnectionProfile socketProfile = new SocketProfile();
private ConnectionProfile embeddedProfile = new EmbeddedProfile();
public static TeiidDriver getInstance() {
@@ -104,7 +104,7 @@
if (conn == ConnectionType.Embedded) {
myConnection = embeddedProfile.connect(url, info);
} else {
- myConnection = SOCKET_PROFILE.connect(url, info);
+ myConnection = socketProfile.connect(url, info);
}
} catch (TeiidSQLException e) {
logger.log(Level.SEVERE, "Could not create connection", e); //$NON-NLS-1$
@@ -122,6 +122,10 @@
this.embeddedProfile = embeddedProfile;
}
+ public void setSocketProfile(ConnectionProfile socketProfile) {
+ this.socketProfile = socketProfile;
+ }
+
/**
* Returns true if the driver thinks that it can open a connection to the given URL.
* Expected URL format for server mode is
Modified: branches/7.4.x/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java
===================================================================
--- branches/7.4.x/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java 2012-01-03 22:02:42 UTC (rev 3766)
+++ branches/7.4.x/client/src/main/java/org/teiid/net/socket/SocketServerInstanceImpl.java 2012-01-04 15:08:03 UTC (rev 3767)
@@ -267,7 +267,7 @@
timeoutMillis -= now - start;
start = now;
if (timeoutMillis <= 0) {
- throw new TimeoutException();
+ throw new TimeoutException("Read timeout after " + timeout + " milliseconds."); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@@ -330,7 +330,7 @@
@Override
public Object get() throws InterruptedException, ExecutionException {
try {
- return this.get(SocketServerConnectionFactory.getInstance().getSynchronousTtl(), TimeUnit.MILLISECONDS);
+ return this.get(instance.getSynchTimeout(), TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
throw new ExecutionException(e);
}
Modified: branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-01-03 22:02:42 UTC (rev 3766)
+++ branches/7.4.x/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-01-04 15:08:03 UTC (rev 3767)
@@ -28,7 +28,6 @@
import java.util.Properties;
import org.jboss.deployers.spi.DeploymentException;
-import org.mockito.Mockito;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.VDB;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -92,13 +91,24 @@
this.dqp.setCacheFactory(new DefaultCacheFactory());
this.dqp.setTransactionService(new FakeTransactionService());
- cmr = Mockito.mock(ConnectorManagerRepository.class);
- Mockito.stub(cmr.getConnectorManager("source")).toReturn(new ConnectorManager("x", "x") {
+ cmr = new ConnectorManagerRepository() {
@Override
- public SourceCapabilities getCapabilities() {
- return new BasicSourceCapabilities();
+ public ConnectorManager getConnectorManager(String connectorName) {
+ ConnectorManager cm = super.getConnectorManager(connectorName);
+ if (cm != null) {
+ return cm;
+ }
+ if (connectorName.equalsIgnoreCase("source")) {
+ return new ConnectorManager("x", "x") {
+ @Override
+ public SourceCapabilities getCapabilities() {
+ return new BasicSourceCapabilities();
+ }
+ };
+ }
+ return null;
}
- });
+ };
config.setResultsetCacheConfig(new CacheConfiguration(Policy.LRU, 60, 250, "resultsetcache")); //$NON-NLS-1$
this.dqp.setCacheFactory(new DefaultCacheFactory() {
@@ -114,6 +124,14 @@
registerClientService(DQP.class, dqp, null);
}
+ public DQPCore getDqp() {
+ return dqp;
+ }
+
+ public ConnectorManagerRepository getConnectorManagerRepository() {
+ return cmr;
+ }
+
public void setConnectorManagerRepository(ConnectorManagerRepository cmr) {
this.cmr = cmr;
}
Modified: branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
===================================================================
--- branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2012-01-03 22:02:42 UTC (rev 3766)
+++ branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2012-01-04 15:08:03 UTC (rev 3767)
@@ -36,16 +36,26 @@
import org.junit.Test;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.dqp.internal.process.DQPConfiguration;
+import org.teiid.dqp.service.AutoGenDataService;
+import org.teiid.jdbc.ConnectionImpl;
+import org.teiid.jdbc.ConnectionProfile;
import org.teiid.jdbc.FakeServer;
import org.teiid.jdbc.TeiidDriver;
+import org.teiid.jdbc.TeiidSQLException;
import org.teiid.jdbc.TestMMDatabaseMetaData;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.socket.SocketServerConnectionFactory;
+import org.teiid.translator.TranslatorException;
@SuppressWarnings("nls")
public class TestJDBCSocketTransport {
static InetSocketAddress addr;
static SocketListener jdbcTransport;
+ static FakeServer server;
@BeforeClass public static void oneTimeSetup() throws Exception {
SocketConfiguration config = new SocketConfiguration();
@@ -56,7 +66,7 @@
DQPConfiguration dqpConfig = new DQPConfiguration();
dqpConfig.setMaxActivePlans(2);
- FakeServer server = new FakeServer(dqpConfig);
+ server = new FakeServer(dqpConfig);
server.setUseCallingThread(false);
server.deployVDB("parts", UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
@@ -67,6 +77,7 @@
if (jdbcTransport != null) {
jdbcTransport.stop();
}
+ server.stop();
}
Connection conn;
@@ -103,4 +114,46 @@
}
}
+ @Test public void testSyncTimeout() throws Exception {
+ TeiidDriver td = new TeiidDriver();
+ td.setSocketProfile(new ConnectionProfile() {
+
+ @Override
+ public ConnectionImpl connect(String url, Properties info)
+ throws TeiidSQLException {
+ SocketServerConnectionFactory sscf = new SocketServerConnectionFactory();
+ sscf.initialize(info);
+ try {
+ return new ConnectionImpl(sscf.getConnection(info), info, url);
+ } catch (CommunicationException e) {
+ throw TeiidSQLException.create(e);
+ } catch (ConnectionException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+ });
+ Properties p = new Properties();
+ p.setProperty("user", "testuser");
+ p.setProperty("password", "testpassword");
+ p.setProperty("org.teiid.sockets.soTimeout", "50");
+ p.setProperty("org.teiid.sockets.SynchronousTtl", "50");
+ ConnectorManagerRepository cmr = server.getConnectorManagerRepository();
+ AutoGenDataService agds = new AutoGenDataService() {
+ @Override
+ protected Object getConnectionFactory()
+ throws TranslatorException {
+ return null;
+ }
+ };
+ agds.setSleep(100);
+ cmr.addConnectorManager("source", agds);
+ try {
+ conn = td.connect("jdbc:teiid:parts@mm://"+addr.getHostName()+":" +jdbcTransport.getPort(), p);
+ Statement s = conn.createStatement();
+ assertTrue(s.execute("select * from parts"));
+ } finally {
+ server.setConnectorManagerRepository(cmr);
+ }
+ }
+
}
12 years, 11 months
teiid SVN: r3766 - in branches/7.4.x: test-integration/common/src/test/java/org/teiid/systemmodel and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-01-03 17:02:42 -0500 (Tue, 03 Jan 2012)
New Revision: 3766
Added:
branches/7.4.x/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java
Modified:
branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
Log:
SOA-3687 TEIID-1868 fix for partial remapping of a temp table query
Modified: branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-01-03 21:29:22 UTC (rev 3765)
+++ branches/7.4.x/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-01-03 22:02:42 UTC (rev 3766)
@@ -86,6 +86,7 @@
import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.StoredProcedure;
+import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.lang.Update;
import org.teiid.query.sql.navigator.PostOrderNavigator;
import org.teiid.query.sql.symbol.Constant;
@@ -444,17 +445,36 @@
throws TeiidComponentException, QueryMetadataException,
TeiidProcessingException, ExpressionEvaluationException,
QueryProcessingException {
- final GroupSymbol group = query.getFrom().getGroups().get(0);
+ GroupSymbol group = query.getFrom().getGroups().get(0);
if (!group.isTempGroupSymbol()) {
return null;
}
String viewName = null;
final String tableName = group.getNonCorrelationName().toUpperCase();
- boolean remapColumns = !tableName.equalsIgnoreCase(group.getName());
- TempMetadataID groupID = (TempMetadataID)group.getMetadataID();
- if (groupID.getOriginalMetadataID() != null) {
- viewName = context.getMetadata().getFullName(groupID.getOriginalMetadataID());
- }
+
+ if (!tableName.equalsIgnoreCase(group.getName())) {
+ group = group.clone();
+ group.setName(tableName);
+ group.setDefinition(null);
+ query.getFrom().getClauses().clear();
+ query.getFrom().addClause(new UnaryFromClause(group));
+ final GroupSymbol newGroup = group;
+ //convert to the actual table symbols (this is typically handled by the languagebridgefactory
+ ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
+ @Override
+ public Expression replaceExpression(Expression element) {
+ if (element instanceof ElementSymbol) {
+ ElementSymbol es = (ElementSymbol)element;
+ es = es.clone();
+ es.setGroupSymbol(newGroup);
+ return es;
+ }
+ return element;
+ }
+ };
+ PostOrderNavigator.doVisit(query, emv);
+ }
+
TempTable table = null;
if (group.isGlobalTable()) {
final TempTableStore globalStore = context.getGlobalTableStore();
@@ -496,21 +516,6 @@
}
}
}
- if (remapColumns) {
- //convert to the actual table symbols (this is typically handled by the languagebridgefactory
- ExpressionMappingVisitor emv = new ExpressionMappingVisitor(null) {
- @Override
- public Expression replaceExpression(Expression element) {
- if (element instanceof ElementSymbol) {
- ElementSymbol es = (ElementSymbol)element;
- es.getGroupSymbol().setName(tableName);
- es.getGroupSymbol().setDefinition(null);
- }
- return element;
- }
- };
- PostOrderNavigator.doVisit(query, emv);
- }
return table.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
}
Added: branches/7.4.x/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java
===================================================================
--- branches/7.4.x/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java (rev 0)
+++ branches/7.4.x/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java 2012-01-03 22:02:42 UTC (rev 3766)
@@ -0,0 +1,95 @@
+/*
+ * 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.systemmodel;
+
+import static org.junit.Assert.*;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.LinkedHashMap;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.deployers.VDBRepository;
+import org.teiid.jdbc.FakeServer;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.index.VDBMetadataFactory;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
+
+@SuppressWarnings("nls")
+public class TestMatViewAliasing {
+
+ private static final String MATVIEWS = "matviews";
+ private Connection conn;
+ private FakeServer server;
+
+ @Before public void setUp() throws Exception {
+ server = new FakeServer();
+
+ VDBRepository vdbRepository = new VDBRepository();
+ vdbRepository.setSystemStore(VDBMetadataFactory.getSystem());
+ MetadataFactory mf = new MetadataFactory("foo", vdbRepository.getBuiltinDatatypes(), new Properties());
+
+ Table mat = mf.addTable("mat");
+ mat.setVirtual(true);
+ mat.setMaterialized(true);
+ mat.setSelectTransformation("/*+ cache(ttl:0) */ select 1 as x, 'y' as Name");
+
+ mf.addColumn("x", DataTypeManager.DefaultDataTypes.INTEGER, mat);
+ mf.addColumn("Name", DataTypeManager.DefaultDataTypes.STRING, mat);
+
+ MetadataStore ms = mf.getMetadataStore();
+
+ server.deployVDB(MATVIEWS, ms, new LinkedHashMap<String, Resource>());
+ conn = server.createConnection("jdbc:teiid:"+MATVIEWS);
+ }
+
+ @After public void tearDown() throws Exception {
+ server.stop();
+ conn.close();
+ }
+
+ @Test public void testSystemMatViewsWithImplicitLoad() throws Exception {
+ Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("select * from MatViews order by name");
+ assertTrue(rs.next());
+ assertEquals("NEEDS_LOADING", rs.getString("loadstate"));
+ assertEquals(false, rs.getBoolean("valid"));
+
+ rs = s.executeQuery("select * from mat order by x");
+ assertTrue(rs.next());
+ rs = s.executeQuery("select * from MatViews where name = 'mat'");
+ assertTrue(rs.next());
+ assertEquals("LOADED", rs.getString("loadstate"));
+
+ rs = s.executeQuery("select * from mat as a, mat as b where a.x = b.name order by a.x");
+ assertFalse(rs.next());
+ }
+
+}
12 years, 12 months
teiid SVN: r3765 - in branches/7.4.x/connectors/translator-jdbc/src: test/java/org/teiid/translator/jdbc/netezza and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-01-03 16:29:22 -0500 (Tue, 03 Jan 2012)
New Revision: 3765
Modified:
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java
Log:
SOA-3684 / TEIID-1876 changing the bit methods to int4, rather than intn
Modified: branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java 2012-01-03 20:04:59 UTC (rev 3764)
+++ branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/netezza/NetezzaExecutionFactory.java 2012-01-03 21:29:22 UTC (rev 3765)
@@ -22,11 +22,10 @@
@Translator(name = "netezza", description = "A translator for Netezza Database")
public class NetezzaExecutionFactory extends JDBCExecutionFactory {
- private static final String TIME_FORMAT = "HH24:MI:SS";
- private static final String DATE_FORMAT = "YYYY-MM-DD";
- private static final String DATETIME_FORMAT = DATE_FORMAT + " "
- + TIME_FORMAT;
- private static final String TIMESTAMP_FORMAT = DATETIME_FORMAT + ".MS";
+ private static final String TIME_FORMAT = "HH24:MI:SS"; //$NON-NLS-1$
+ private static final String DATE_FORMAT = "YYYY-MM-DD"; //$NON-NLS-1$
+ private static final String DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT; //$NON-NLS-1$
+ private static final String TIMESTAMP_FORMAT = DATETIME_FORMAT + ".MS"; //$NON-NLS-1$
public NetezzaExecutionFactory() {
setSupportsFullOuterJoins(true);
@@ -39,179 +38,107 @@
public void start() throws TranslatorException {
super.start();
- // STRING FUNCTION MODIFIERS
- // //////////////////////////////////
- registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier(
- "chr"));
- registerFunctionModifier(SourceSystemFunctions.LCASE,
- new AliasModifier("lower"));
- registerFunctionModifier(SourceSystemFunctions.UCASE,
- new AliasModifier("upper"));
- registerFunctionModifier(SourceSystemFunctions.LOCATE,
- new LocateFunctionModifier(getLanguageFactory(), "INSTR", true));
- registerFunctionModifier(SourceSystemFunctions.CONCAT,
- new AliasModifier("||"));
- // /NUMERIC FUNCTION MODIFIERS
- // //////////////////////////////////
- registerFunctionModifier(SourceSystemFunctions.CEILING,
- new AliasModifier("ceil"));
- registerFunctionModifier(SourceSystemFunctions.POWER,
- new AliasModifier("pow"));
- registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier(
- "LN"));
- // /BIT FUNCTION MODIFIERS
- // //////////////////////////////////
- registerFunctionModifier(SourceSystemFunctions.BITAND,
- new AliasModifier("intNand"));
- registerFunctionModifier(SourceSystemFunctions.BITNOT,
- new AliasModifier("intNnot"));
- registerFunctionModifier(SourceSystemFunctions.BITOR,
- new AliasModifier("intNor"));
- registerFunctionModifier(SourceSystemFunctions.BITXOR,
- new AliasModifier("intNxor"));
- // DATE FUNCTION MODIFIERS
- // ////////////////////////////////////////
- registerFunctionModifier(SourceSystemFunctions.YEAR,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR,
- new ExtractModifier("DOY"));
- registerFunctionModifier(SourceSystemFunctions.QUARTER,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.MONTH,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH,
- new ExtractModifier("DAY"));
- registerFunctionModifier(SourceSystemFunctions.WEEK,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK,
- new ExtractModifier("DOW"));
- registerFunctionModifier(SourceSystemFunctions.HOUR,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.MINUTE,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.SECOND,
- new ExtractFunctionModifier());
- registerFunctionModifier(SourceSystemFunctions.CURDATE,
- new AliasModifier("CURRENT_DATE"));
- registerFunctionModifier(SourceSystemFunctions.CURTIME,
- new AliasModifier("CURRENT_TIME"));
- // SYSTEM FUNCTIONS
- // //////////////////////////////////
- registerFunctionModifier(SourceSystemFunctions.IFNULL,
- new AliasModifier("NVL"));
+ //STRING FUNCTION MODIFIERS
+ ////////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LCASE,new AliasModifier("lower")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.UCASE,new AliasModifier("upper")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory(), "INSTR", true)); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("||")); //$NON-NLS-1$
+ ///NUMERIC FUNCTION MODIFIERS
+ ////////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.CEILING, new AliasModifier("ceil")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.POWER, new AliasModifier("pow")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("LN")); //$NON-NLS-1$
+ ///BIT FUNCTION MODIFIERS
+ ////////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.BITAND, new AliasModifier("int4and")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.BITNOT, new AliasModifier("int4not")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.BITOR, new AliasModifier("int4or")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.BITXOR, new AliasModifier("int4xor")); //$NON-NLS-1$
+ //DATE FUNCTION MODIFIERS
+ //////////////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new ExtractModifier("DOY")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.QUARTER, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractModifier("DAY")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.WEEK, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new ExtractModifier("DOW")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.HOUR, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier());
+ registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("CURRENT_DATE")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("CURRENT_TIME")); //$NON-NLS-1$
+ //SYSTEM FUNCTIONS
+ ////////////////////////////////////
+ registerFunctionModifier(SourceSystemFunctions.IFNULL,new AliasModifier("NVL")); //$NON-NLS-1$
// DATA TYPE CONVERSION
// /////////////////////////////////////////
ConvertModifier convertModifier = new ConvertModifier();
- convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR);
- convertModifier.addTypeMapping("byteint", FunctionModifier.BYTE);
- convertModifier.addTypeMapping("smallint", FunctionModifier.SHORT);
- convertModifier.addTypeMapping("bigint", FunctionModifier.LONG);
- convertModifier.addTypeMapping("numeric(38)",
- FunctionModifier.BIGINTEGER);
- convertModifier.addTypeMapping("numeric(38,18)",
- FunctionModifier.BIGDECIMAL);
- convertModifier
- .addTypeMapping("varchar(4000)", FunctionModifier.STRING);
+ convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR); //$NON-NLS-1$
+ convertModifier.addTypeMapping("byteint", FunctionModifier.BYTE); //$NON-NLS-1$
+ convertModifier.addTypeMapping("smallint", FunctionModifier.SHORT); //$NON-NLS-1$
+ convertModifier.addTypeMapping("bigint", FunctionModifier.LONG); //$NON-NLS-1$
+ convertModifier.addTypeMapping("numeric(38)", FunctionModifier.BIGINTEGER); //$NON-NLS-1$
+ convertModifier.addTypeMapping("numeric(38,18)", FunctionModifier.BIGDECIMAL); //$NON-NLS-1$
+ convertModifier.addTypeMapping("varchar(4000)", FunctionModifier.STRING); //$NON-NLS-1$
+ //convertModifier.addTypeMapping("nvarchar(5)", FunctionModifier.BOOLEAN);
- // /NO BOOLEAN, INTEGER, FLOAT, DATE, TIME, TIMESTAMP, as they are
- // directly available in netezza
- // /NO NULL, CLOB, BLOB, OBJECT, XML
-
- // /BOOLEAN--BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, BIGINTEGER,
- // BIGDECIMAL--AS IT DOESN'T WORK IMPLICITLY IN NETEZZA
-
-
+ ///NO BOOLEAN, INTEGER, FLOAT, DATE, TIME, TIMESTAMP, as they are directly available in netezza
+ ///NO NULL, CLOB, BLOB, OBJECT, XML
convertModifier.addConvert(FunctionModifier.FLOAT, FunctionModifier.BIGDECIMAL, new CastModifier("numeric"));
convertModifier.addConvert(FunctionModifier.DOUBLE, FunctionModifier.BIGDECIMAL, new CastModifier("numeric"));
-
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.INTEGER,
- new BooleanToNumericConversionModifier());
- convertModifier
- .addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BYTE,
- new BooleanToNumericConversionModifier());
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.SHORT,
- new BooleanToNumericConversionModifier());
- convertModifier
- .addConvert(FunctionModifier.BOOLEAN, FunctionModifier.LONG,
- new BooleanToNumericConversionModifier());
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.FLOAT,
- new BooleanToNumericConversionModifier());
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.DOUBLE,
- new BooleanToNumericConversionModifier());
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.BIGINTEGER,
- new BooleanToNumericConversionModifier());
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.BIGDECIMAL,
- new BooleanToNumericConversionModifier());
- convertModifier.addConvert(FunctionModifier.BOOLEAN,
- FunctionModifier.STRING,
- new BooleanToStringConversionModifier());
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.BOOLEAN, new FunctionModifier() {
- @Override
- public List<?> translate(Function function) {
- Expression stringValue = function.getParameters()
- .get(0);
- return Arrays.asList("CASE WHEN ", stringValue,
- " IN ('false', '0') THEN '0' WHEN ",
- stringValue, " IS NOT NULL THEN '1' END");
- }
- });
+
+ ///BOOLEAN--BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, BIGINTEGER, BIGDECIMAL--AS IT DOESN'T WORK IMPLICITLY IN NETEZZA
+
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.INTEGER, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BYTE, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.SHORT, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.LONG, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.FLOAT, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.DOUBLE, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BIGINTEGER, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.BIGDECIMAL, new BooleanToNumericConversionModifier());
+ convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new BooleanToStringConversionModifier());
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.BOOLEAN, new FunctionModifier() {
+ @Override
+ public List<?> translate(Function function) {
+ Expression stringValue = function.getParameters().get(0);
+ return Arrays.asList("CASE WHEN ", stringValue, " IN ('false', '0') THEN '0' WHEN ", stringValue, " IS NOT NULL THEN '1' END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ });
convertModifier.addTypeConversion(new FunctionModifier() {
@Override
public List<?> translate(Function function) {
Expression stringValue = function.getParameters().get(0);
- return Arrays.asList("CASE WHEN ", stringValue,
- " = 0 THEN '0' WHEN ", stringValue,
- " IS NOT NULL THEN '1' END");
+ return Arrays.asList("CASE WHEN ", stringValue, " = 0 THEN '0' WHEN ", stringValue, " IS NOT NULL THEN '1' END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}, FunctionModifier.BOOLEAN);
- // //////STRING TO DATATYPE CONVERSION OTHER THAN DATE/TIME
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.INTEGER, new CastModifier("integer"));
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.FLOAT, new CastModifier("float"));
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.DOUBLE, new CastModifier("double"));
- // /// STRING --> CHAR, BYTE, SHORT, LONG, BIGI, BIGD, BOOLEAN is taken
- // care by Type Mapping
- // /// NO conversion support for NULL, CLOB, BLOB, OBJECT, XML
- // //STRING TO DATE/TIME CONVERSION////
- // ////////////////////////////////////
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.DATE, new ConvertModifier.FormatModifier(
- "to_date", DATE_FORMAT));
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.TIME, new ConvertModifier.FormatModifier(
- "to_timestamp", TIME_FORMAT));
- convertModifier.addConvert(FunctionModifier.STRING,
- FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier(
- "to_timestamp", TIMESTAMP_FORMAT));
- // ////DATE/TIME INTERNAL CONVERSION/////////
- convertModifier.addConvert(FunctionModifier.TIMESTAMP,
- FunctionModifier.TIME, new CastModifier("TIME"));
- convertModifier.addConvert(FunctionModifier.TIMESTAMP,
- FunctionModifier.DATE, new CastModifier("DATE"));
- convertModifier.addConvert(FunctionModifier.DATE,
- FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP"));
- // convertModifier.addConvert(FunctionModifier.TIME,
- // FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP")); //TIME
- // --> TIMESTAMP --DOESN't WORK IN NETEZZA-NO FUNCTION SUPPORT
+ ////////STRING TO DATATYPE CONVERSION OTHER THAN DATE/TIME
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.INTEGER, new CastModifier("integer")); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.FLOAT, new CastModifier("float")); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DOUBLE, new CastModifier("double")); //$NON-NLS-1$
+ ///// STRING --> CHAR, BYTE, SHORT, LONG, BIGI, BIGD, BOOLEAN is taken care by Type Mapping
+ ///// NO conversion support for NULL, CLOB, BLOB, OBJECT, XML
+ ////STRING TO DATE/TIME CONVERSION////
+ //////////////////////////////////////
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DATE, new ConvertModifier.FormatModifier("to_date", DATE_FORMAT)); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIME, new ConvertModifier.FormatModifier("to_timestamp", TIME_FORMAT)); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier("to_timestamp", TIMESTAMP_FORMAT)); //$NON-NLS-1$
+ //////DATE/TIME INTERNAL CONVERSION/////////
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new CastModifier("TIME")); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.DATE, new CastModifier("DATE")); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP")); //$NON-NLS-1$
+ //convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.TIMESTAMP, new CastModifier("TIMESTAMP")); //TIME --> TIMESTAMP --DOESN't WORK IN NETEZZA-NO FUNCTION SUPPORT
+
+ ////DATE/TIME to STRING CONVERION////
+ /////////////////////////////////////
+ convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", TIMESTAMP_FORMAT)); //$NON-NLS-1$
+ ///NO NETEZAA FUNCTION for DATE, TIME to STRING
- // //DATE/TIME to STRING CONVERION////
- // ///////////////////////////////////
- convertModifier.addConvert(FunctionModifier.TIMESTAMP,
- FunctionModifier.STRING, new ConvertModifier.FormatModifier(
- "to_char", TIMESTAMP_FORMAT));
- // /NO NETEZAA FUNCTION for DATE, TIME to STRING
-
convertModifier.setWideningNumericImplicit(true);
registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
}
@@ -354,8 +281,7 @@
@Override
public List<?> translate(Function function) {
- return Arrays.asList("extract(", this.type, " from ", function
- .getParameters().get(0), ")");
+ return Arrays.asList("extract(",this.type," from ",function.getParameters().get(0) ,")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
@@ -365,16 +291,12 @@
public List<?> translate(Function function) {
Expression booleanValue = function.getParameters().get(0);
if (booleanValue instanceof Function) {
- Function nested = (Function) booleanValue;
- if (nested.getName().equalsIgnoreCase("convert")
- && Number.class.isAssignableFrom(nested.getParameters()
- .get(0).getType())) {
+ Function nested = (Function)booleanValue;
+ if (nested.getName().equalsIgnoreCase("convert") && Number.class.isAssignableFrom(nested.getParameters().get(0).getType())) { //$NON-NLS-1$
booleanValue = nested.getParameters().get(0);
}
}
- return Arrays.asList("(CASE WHEN ", booleanValue,
- " IN ( '0', 'FALSE') THEN 0 WHEN ", booleanValue,
- " IS NOT NULL THEN 1 END)");
+ return Arrays.asList("(CASE WHEN ", booleanValue, " IN ( '0', 'FALSE') THEN 0 WHEN ", booleanValue, " IS NOT NULL THEN 1 END)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
@@ -385,16 +307,12 @@
public List<?> translate(Function function) {
Expression booleanValue = function.getParameters().get(0);
if (booleanValue instanceof Function) {
- Function nested = (Function) booleanValue;
- if (nested.getName().equalsIgnoreCase("convert")
- && Number.class.isAssignableFrom(nested.getParameters()
- .get(0).getType())) {
+ Function nested = (Function)booleanValue;
+ if (nested.getName().equalsIgnoreCase("convert") && Number.class.isAssignableFrom(nested.getParameters().get(0).getType())) { //$NON-NLS-1$
booleanValue = nested.getParameters().get(0);
}
}
- return Arrays.asList("CASE WHEN ", booleanValue,
- " = '0' THEN 'false' WHEN ", booleanValue,
- " IS NOT NULL THEN 'true' END");
+ return Arrays.asList("CASE WHEN ", booleanValue, " = '0' THEN 'false' WHEN ", booleanValue, " IS NOT NULL THEN 'true' END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
@@ -408,19 +326,17 @@
@Override
public List<?> translate(Function function) {
- return Arrays.asList("cast(", function.getParameters().get(0),
- " AS " + this.target + ")");
+ return Arrays.asList("cast(", function.getParameters().get(0), " AS "+this.target+")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
@Override
public List<?> translateLimit(Limit limit, ExecutionContext context) {
- if (limit.getRowOffset() > 0) {
- return Arrays.asList("LIMIT ", limit.getRowLimit(), " OFFSET ",
- limit.getRowOffset());
- }
- return null;
- }
+ if (limit.getRowOffset() > 0) {
+ return Arrays.asList("LIMIT ", limit.getRowLimit(), " OFFSET ", limit.getRowOffset()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return null;
+ }
@Override
public boolean supportsCorrelatedSubqueries() {
Modified: branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java 2012-01-03 20:04:59 UTC (rev 3764)
+++ branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/netezza/TestNetezzaTranslatorSourceSystemFunctions.java 2012-01-03 21:29:22 UTC (rev 3765)
@@ -206,7 +206,7 @@
@Test public void testBitAnd() throws Exception {
String input = "select bitand(intkey, intnum) from bqt1.smalla";
- String output = "SELECT intNand(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
+ String output = "SELECT int4and(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
input,
@@ -214,7 +214,7 @@
}
@Test public void testBitNot() throws Exception {
String input = "select bitnot(intkey) from bqt1.smalla";
- String output = "SELECT intNnot(SmallA.IntKey) FROM SmallA";
+ String output = "SELECT int4not(SmallA.IntKey) FROM SmallA";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
input,
@@ -222,7 +222,7 @@
}
@Test public void testBitOr() throws Exception {
String input = "select bitor(intkey, intnum) from bqt1.smalla";
- String output = "SELECT intNor(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
+ String output = "SELECT int4or(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
input,
@@ -230,7 +230,7 @@
}
@Test public void testBitXor() throws Exception {
String input = "select bitxor(intkey, intnum) from bqt1.smalla";
- String output = "SELECT intNxor(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
+ String output = "SELECT int4xor(SmallA.IntKey, SmallA.IntNum) FROM SmallA";
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB,
input,
12 years, 12 months
teiid SVN: r3764 - in branches/7.6.x/engine/src: test/java/org/teiid/dqp/internal/process and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-01-03 15:04:59 -0500 (Tue, 03 Jan 2012)
New Revision: 3764
Modified:
branches/7.6.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
branches/7.6.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
Log:
TEIID-1884 fixing final row count when using foward only
Modified: branches/7.6.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/7.6.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-01-03 19:40:57 UTC (rev 3763)
+++ branches/7.6.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2012-01-03 20:04:59 UTC (rev 3764)
@@ -536,8 +536,9 @@
return;
}
super.flushBatchDirect(batch, add);
- //restrict the buffer size for forward only results
- if (add && !processor.hasFinalBuffer()
+ if (!add && !processor.hasFinalBuffer()) {
+ resultsBuffer.setRowCount(batch.getEndRow());
+ } else if (!processor.hasFinalBuffer() //restrict the buffer size for forward only results
&& !batch.getTerminationFlag()
&& transactionState != TransactionState.ACTIVE
&& this.getTupleBuffer().getManagedRowCount() >= OUTPUT_BUFFER_MAX_BATCHES * this.getTupleBuffer().getBatchSize()) {
Modified: branches/7.6.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- branches/7.6.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2012-01-03 19:40:57 UTC (rev 3763)
+++ branches/7.6.x/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2012-01-03 20:04:59 UTC (rev 3764)
@@ -360,6 +360,24 @@
assertEquals(100, item.resultsBuffer.getRowCount());
}
+ @Test public void testFinalRow() throws Exception {
+ String sql = "SELECT A.IntKey FROM BQT1.SmallA as A"; //$NON-NLS-1$
+ String userName = "1"; //$NON-NLS-1$
+ String sessionid = "1"; //$NON-NLS-1$
+
+ RequestMessage reqMsg = exampleRequestMessage(sql);
+ reqMsg.setCursorType(ResultSet.TYPE_FORWARD_ONLY);
+ DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
+ DQPWorkContext.getWorkContext().getSession().setUserName(userName);
+ ((BufferManagerImpl)core.getBufferManager()).setProcessorBatchSize(10);
+ Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
+ ResultsMessage rm = message.get(500000, TimeUnit.MILLISECONDS);
+ assertNull(rm.getException());
+ assertEquals(10, rm.getResultsList().size());
+ RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
+ assertEquals(10, item.resultsBuffer.getRowCount());
+ }
+
@Test public void testBufferReuse1() throws Exception {
//the sql should return 100 rows
String sql = "SELECT IntKey FROM texttable('1112131415' columns intkey integer width 2 no row delimiter) t " +
12 years, 12 months
teiid SVN: r3763 - branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-01-03 14:40:57 -0500 (Tue, 03 Jan 2012)
New Revision: 3763
Modified:
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java
Log:
SOA-3683 / TEIID-1871 Teiid is handling MySQL5.0 returning DAYNAME as a blob
Modified: branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java
===================================================================
--- branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java 2012-01-03 17:20:39 UTC (rev 3762)
+++ branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java 2012-01-03 19:40:57 UTC (rev 3763)
@@ -1,69 +1,94 @@
-/*
- * 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.
- */
-
+/*
+ * 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.translator.jdbc.mysql;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.language.Function;
-import org.teiid.translator.Translator;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.SourceSystemFunctions;
-import org.teiid.translator.jdbc.FunctionModifier;
-
-@Translator(name="mysql5", description="A translator for open source MySQL5 Database")
-public class MySQL5ExecutionFactory extends MySQLExecutionFactory {
-
- @Override
- public void start() throws TranslatorException {
- super.start();
- registerFunctionModifier(SourceSystemFunctions.CHAR, new FunctionModifier() {
-
- @Override
- public List<?> translate(Function function) {
- return Arrays.asList("char(", function.getParameters().get(0), " USING ASCII)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.language.Function;
+import org.teiid.translator.SourceSystemFunctions;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.FunctionModifier;
+
+@Translator(name="mysql5", description="A translator for open source MySQL5 Database")
+public class MySQL5ExecutionFactory extends MySQLExecutionFactory {
+
+ @Override
+ public void start() throws TranslatorException {
+ super.start();
+ registerFunctionModifier(SourceSystemFunctions.CHAR, new FunctionModifier() {
+
+ @Override
+ public List<?> translate(Function function) {
+ return Arrays.asList("char(", function.getParameters().get(0), " USING ASCII)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
}
-
- @Override
- public List<String> getSupportedFunctions() {
- List<String> supportedFunctions = new ArrayList<String>();
- supportedFunctions.addAll(super.getSupportedFunctions());
- supportedFunctions.add(SourceSystemFunctions.TIMESTAMPADD);
- supportedFunctions.add(SourceSystemFunctions.TIMESTAMPDIFF);
- return supportedFunctions;
- }
-
- @Override
- public boolean supportsInlineViews() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesEnhancedNumeric() {
- return true;
- }
-
+
+ @Override
+ public List<String> getSupportedFunctions() {
+ List<String> supportedFunctions = new ArrayList<String>();
+ supportedFunctions.addAll(super.getSupportedFunctions());
+ supportedFunctions.add(SourceSystemFunctions.TIMESTAMPADD);
+ supportedFunctions.add(SourceSystemFunctions.TIMESTAMPDIFF);
+ return supportedFunctions;
+ }
+
+ @Override
+ public boolean supportsInlineViews() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesEnhancedNumeric() {
+ return true;
+ }
+
+ @Override
+ public Object retrieveValue(ResultSet results, int columnIndex,
+ Class<?> expectedType) throws SQLException {
+ Object result = super.retrieveValue(results, columnIndex, expectedType);
+ if (expectedType == TypeFacility.RUNTIME_TYPES.STRING && result instanceof Blob) {
+ return results.getString(columnIndex);
+ }
+ return result;
+ }
+
+ @Override
+ public Object retrieveValue(CallableStatement results, int parameterIndex,
+ Class<?> expectedType) throws SQLException {
+ Object result = super.retrieveValue(results, parameterIndex, expectedType);
+ if (expectedType == TypeFacility.RUNTIME_TYPES.STRING && result instanceof Blob) {
+ return results.getString(parameterIndex);
+ }
+ return result;
+ }
+
}
12 years, 12 months
teiid SVN: r3762 - in trunk: build/kits/jboss-as7/domain/configuration and 1 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-01-03 12:20:39 -0500 (Tue, 03 Jan 2012)
New Revision: 3762
Modified:
trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
trunk/build/kits/jboss-as7/domain/configuration/host-teiid.xml
trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
trunk/pom.xml
Log:
TEIID-1720: Upgraded the configuration files to work with AS7-CR1b. This version will work with AS7-CR1b version.
Modified: trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2012-01-03 17:11:16 UTC (rev 3761)
+++ trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2012-01-03 17:20:39 UTC (rev 3762)
@@ -77,7 +77,7 @@
</subsystem>
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
- <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="java:jboss/datasources/ExampleDS">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<pool></pool>
@@ -94,12 +94,12 @@
</datasources>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee:1.0"/>
- <subsystem xmlns="urn:jboss:domain:ejb3:1.2">
+ <subsystem xmlns="urn:jboss:domain:ejb3:1.2" >
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
- <stateful default-access-timeout="5000"/>
+ <stateful default-access-timeout="5000" cache-ref="simple" clustered-cache-ref="clustered"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
@@ -112,6 +112,15 @@
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
+ <caches>
+ <cache name="simple" aliases="NoPassivationCache"/>
+ <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
+ <cache name="clustered" passivation-store-ref="infinispan" aliases="StatefulTreeCache"/>
+ </caches>
+ <passivation-stores>
+ <file-passivation-store name="file"/>
+ <cluster-passivation-store name="infinispan" backing-cache="sfsb"/>
+ </passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
@@ -120,6 +129,7 @@
<thread-pools>
<thread-pool name="default" max-threads="10" keepalive-time="100"/>
</thread-pools>
+ <iiop enable-by-default="true" use-qualified-name="true"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:infinispan:1.1" default-cache-container="cluster">
<cache-container name="cluster" default-cache="default">
@@ -136,14 +146,19 @@
<distributed-cache name="dist" mode="ASYNC" batching="true">
<file-store/>
</distributed-cache>
+ <replicated-cache name="registry" mode="SYNC" batching="true"/>
+ <replicated-cache name="sso" mode="SYNC" batching="true"/>
</cache-container>
<cache-container name="sfsb" default-cache="repl">
<alias>sfsb-cache</alias>
- <alias>jboss.cache:service=EJB3SFSBClusteredCache</alias>
<replicated-cache name="repl" mode="ASYNC" batching="true">
- <eviction strategy="LRU" max-entries="10000"/>
+ <eviction strategy="LRU"/>
<file-store/>
</replicated-cache>
+ <distributed-cache name="dist" mode="ASYNC" batching="true">
+ <eviction strategy="LRU"/>
+ <file-store/>
+ </distributed-cache>
</cache-container>
<cache-container name="hibernate" default-cache="local-query">
<invalidation-cache name="entity" mode="SYNC">
@@ -226,7 +241,9 @@
<protocol type="pbcast.FLUSH"/>
</stack>
</subsystem>
- <subsystem xmlns="urn:jboss:domain:jmx:1.1" show-model="true"/>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.1">
+ <show-model value="true"/>
+ </subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.0">
<jpa default-datasource=""/>
</subsystem>
Modified: trunk/build/kits/jboss-as7/domain/configuration/host-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/domain/configuration/host-teiid.xml 2012-01-03 17:11:16 UTC (rev 3761)
+++ trunk/build/kits/jboss-as7/domain/configuration/host-teiid.xml 2012-01-03 17:20:39 UTC (rev 3762)
@@ -12,10 +12,10 @@
</security-realms>
<management-interfaces>
<native-interface security-realm="ManagementRealm">
- <socket interface="management" port="9999"/>
+ <socket interface="management" port="${jboss.management.native.port:9999}"/>
</native-interface>
<http-interface security-realm="ManagementRealm">
- <socket interface="management" port="9990"/>
+ <socket interface="management" port="${jboss.management.http.port:9990}"/>
</http-interface>
</management-interfaces>
</management>
@@ -23,7 +23,7 @@
<domain-controller>
<local/>
<!-- Alternative remote domain controller configuration with a host and port -->
- <!-- <remote host="192.168.100.1" port="9999"/> -->
+ <!-- <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}"/> -->
</domain-controller>
<interfaces>
@@ -37,27 +37,25 @@
<jvms>
<jvm name="default">
- <heap size="64m" max-size="128m"/>
+ <heap size="64m" max-size="256m"/>
</jvm>
</jvms>
<servers>
<server name="server-one" group="main-server-group">
- <socket-binding-group ref="ha-sockets" port-offset="0"/>
+ <!-- Remote JPDA debugging for a specific server
<jvm name="default">
- <!-- Remote JPDA debugging for a specific server
<jvm-options>
<option value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
</jvm-options>
- -->
</jvm>
+ -->
</server>
-
- <!-- If additional servers needed on same host un-comment and configure -->
<!--
<server name="server-two" group="main-server-group" auto-start="true">
- <socket-binding-group ref="ha-sockets" port-offset="150"/>
+ <socket-bindings port-offset="150"/>
</server>
-->
+
</servers>
</host>
Modified: trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2012-01-03 17:11:16 UTC (rev 3761)
+++ trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2012-01-03 17:20:39 UTC (rev 3762)
@@ -8,6 +8,7 @@
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
+ <extension module="org.jboss.as.jaxr"/>
<extension module="org.jboss.as.jaxrs"/>
<extension module="org.jboss.as.jdr"/>
<extension module="org.jboss.as.jmx"/>
@@ -88,7 +89,7 @@
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true"
- pool-name="H2DS">
+ pool-name="ExampleDS">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<pool></pool>
@@ -113,7 +114,7 @@
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
- <stateful default-access-timeout="5000"/>
+ <stateful default-access-timeout="5000" cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
@@ -126,6 +127,13 @@
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
+ <caches>
+ <cache name="simple" aliases="NoPassivationCache"/>
+ <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
+ </caches>
+ <passivation-stores>
+ <file-passivation-store name="file"/>
+ </passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
@@ -156,6 +164,10 @@
</local-cache>
</cache-container>
</subsystem>
+ <subsystem xmlns="urn:jboss:domain:jaxr:1.0">
+ <connection-factory jndi-name="java:jboss/jaxr/ConnectionFactory"/>
+ <juddi-server publish-url="http://localhost:8080/juddi/publish" query-url="http://localhost:8080/juddi/query"/>
+ </subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
<subsystem xmlns="urn:jboss:domain:jca:1.1">
<archive-validation enabled="false"/>
@@ -176,7 +188,9 @@
</default-workmanager>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
- <subsystem xmlns="urn:jboss:domain:jmx:1.1" show-model="true"/>
+ <subsystem xmlns="urn:jboss:domain:jmx:1.1">
+ <show-model value="true"/>
+ </subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.0">
<jpa default-datasource=""/>
</subsystem>
@@ -357,15 +371,15 @@
</interface>
</interfaces>
- <socket-binding-group name="standard-sockets" default-interface="public">
+ <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8443"/>
<socket-binding name="jacorb" port="3528"/>
<socket-binding name="jacorb-ssl" port="3529"/>
<socket-binding name="jmx-connector-registry" interface="management" port="1090"/>
<socket-binding name="jmx-connector-server" interface="management" port="1091"/>
- <socket-binding name="management-native" interface="management" port="9999"/>
- <socket-binding name="management-http" interface="management" port="9990"/>
+ <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
+ <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>
<socket-binding name="osgi-http" interface="management" port="8090"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-01-03 17:11:16 UTC (rev 3761)
+++ trunk/pom.xml 2012-01-03 17:20:39 UTC (rev 3762)
@@ -15,27 +15,27 @@
<properties>
<ant.version>1.7.0</ant.version>
<site.url>http://www.jboss.org/teiid</site.url>
- <jbossas-version>7.1.0.Beta1</jbossas-version>
+ <jbossas-version>7.1.0.CR1b</jbossas-version>
<version.org.jboss.jboss-common-core>2.2.17.GA</version.org.jboss.jboss-common-core>
<version.org.jboss.staxmapper>1.0.0.Final</version.org.jboss.staxmapper>
- <version.org.jboss.jboss-dmr>1.1.0.Final</version.org.jboss.jboss-dmr>
+ <version.org.jboss.jboss-dmr>1.1.1.Final</version.org.jboss.jboss-dmr>
<version.org.jboss.msc.jboss-msc>1.0.1.GA</version.org.jboss.msc.jboss-msc>
- <version.org.jboss.modules.jboss-modules>1.1.0.CR3</version.org.jboss.modules.jboss-modules>
+ <version.org.jboss.modules.jboss-modules>1.1.0.CR6</version.org.jboss.modules.jboss-modules>
<version.org.jboss.jboss-vfs>3.1.0.CR1</version.org.jboss.jboss-vfs>
- <version.org.picketbox>4.0.6.Beta1</version.org.picketbox>
- <version.org.jboss.logging.jboss-logging>3.1.0.CR1</version.org.jboss.logging.jboss-logging>
- <version.org.jboss.logging.jboss-logging-tools>1.0.0.CR4</version.org.jboss.logging.jboss-logging-tools>
+ <version.org.picketbox>4.0.6.Beta2</version.org.picketbox>
+ <version.org.jboss.logging.jboss-logging>3.1.0.CR2</version.org.jboss.logging.jboss-logging>
+ <version.org.jboss.logging.jboss-logging-tools>1.0.0.CR5</version.org.jboss.logging.jboss-logging-tools>
<version.org.picketbox.jbosssx-client>3.0.0.CR2</version.org.picketbox.jbosssx-client>
- <version.org.jboss.arquillian.core>1.0.0.CR5</version.org.jboss.arquillian.core>
+ <version.org.jboss.arquillian.core>1.0.0.CR7</version.org.jboss.arquillian.core>
<version.javax.enterprise.cdi-api>1.0-SP4</version.javax.enterprise.cdi-api>
- <version.org.jboss.netty>3.2.4.Final</version.org.jboss.netty>
+ <version.org.jboss.netty>3.2.5.Final</version.org.jboss.netty>
<version.net.sourceforge.saxon>9.2.1.5</version.net.sourceforge.saxon>
<version.json-simple>1.1</version.json-simple>
- <version.org.jgroups>3.0.0.Final</version.org.jgroups>
+ <version.org.jgroups>3.0.1.Final</version.org.jgroups>
<version.connector-api>1.5</version.connector-api>
<version.jta>1.1</version.jta>
<version.sun.jaxb>2.2</version.sun.jaxb>
- <version.junit>4.8.2</version.junit>
+ <version.junit>4.10</version.junit>
</properties>
<scm>
<connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
12 years, 12 months
teiid SVN: r3761 - tags.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2012-01-03 12:11:16 -0500 (Tue, 03 Jan 2012)
New Revision: 3761
Added:
tags/7.1.2.GA/
Log:
SOA-3655: SOA 5.1/Teiid 7.1 Cumulative Patch promote to 7.1.2
12 years, 12 months