You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2017/03/12 21:55:04 UTC

[jira] [Commented] (METAMODEL-1137) could not execute query: The "variant" data type is not supported

    [ https://issues.apache.org/jira/browse/METAMODEL-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15906702#comment-15906702 ] 

Kasper Sørensen commented on METAMODEL-1137:
--------------------------------------------

Thank you very much for the report. I will rephrase the issue though; in my opinion this is not a bug of MetaModel, but rather a feature request. You're basically asking MetaModel to compensate for a limitation in jTDS (that variant data types can only be queried when casted).

> could not execute query: The "variant" data type is not supported
> -----------------------------------------------------------------
>
>                 Key: METAMODEL-1137
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-1137
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.4
>         Environment: Windows & Linux
>            Reporter: ASHISH PANCHOLI
>              Labels: java, jdbc, jtds, sql_variant, sqlserver, variant
>         Attachments: image (1).png
>
>
> When I am trying to run the below query:
>  
> SELECT ct."A" FROM dbo."IMAGE_TABLE1" ct
> using meta-model, it's throwing an exception: 
> org.apache.metamodel.MetaModelException: Could not execute query: The "variant" data type is not supported.
> I completely understand that the SQL Server sqlvariant data type is not currently supported by the JDBC driver. If a query is used to retrieve data from a table that contains a column of the sqlvariant data type, an exception will occur.
> But when I am casting the "sqlvariant" column to "varchar(30)" in the query then it ran successfully using jTDS ( SQL Server and Sybase JDBC driver). 
> Here is the query that ran successfully:
> SELECT CAST(A as varchar(30)) from IMAGE_TABLE1
> The same I am expecting from Apache Meta model but Apache Meta model throwing a below exception:
> org.apache.metamodel.query.parser.QueryParserException: Not capable of parsing SELECT token: CAST(A
> 	at org.apache.metamodel.query.parser.SelectItemParser.parse(SelectItemParser.java:68)
> 	at org.apache.metamodel.query.parser.QueryPartParser.parseItem(QueryPartParser.java:122)
> 	at org.apache.metamodel.query.parser.QueryPartParser.parse(QueryPartParser.java:93)
> 	at org.apache.metamodel.query.parser.QueryParser.parseSelectClause(QueryParser.java:160)
> 	at org.apache.metamodel.query.parser.QueryParser.parse(QueryParser.java:95)
> 	at org.apache.metamodel.AbstractDataContext.parseQuery(AbstractDataContext.java:164)
> 	at org.apache.metamodel.AbstractDataContext.executeQuery(AbstractDataContext.java:188)
> 	at org.apache.metamodel.DataContextFactoryTest.testSQLVarient(DataContextFactoryTest.java:69)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at junit.framework.TestCase.runTest(TestCase.java:176)
> 	at junit.framework.TestCase.runBare(TestCase.java:141)
> 	at junit.framework.TestResult$1.protect(TestResult.java:122)
> 	at junit.framework.TestResult.runProtected(TestResult.java:142)
> 	at junit.framework.TestResult.run(TestResult.java:125)
> 	at junit.framework.TestCase.run(TestCase.java:129)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:255)
> 	at junit.framework.TestSuite.run(TestSuite.java:250)
> 	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
> 	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
> 	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> 	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
> 	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)