Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5152

"No value was available" error message when evaluating an expression

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 9.3.5, 10.1, 10.0.1
    • 9.3.4
    • Query Engine
    • None
    • Hide

      1. In postgresql create the test_nva and test_ table by the following script:

      CREATE TABLE public.test_nva
      (
        id integer,
        type character varying(4000),
        start_date date
      );
      INSERT INTO public.test_nva(id, type, start_date) VALUES (1, 'str_val', '2015-07-02');
      

      2. Add postgresql database configuration in standalone-teiid.xml

      <datasource jndi-name="java:/test_pg" pool-name="test_pg" enabled="true" use-java-context="true">
                          <connection-url>jdbc:postgresql://localhost:5432/test?charSet=utf8</connection-url>
                          <driver-class>org.postgresql.Driver</driver-class>
                          <driver>org.postgresql</driver>
                          <pool>
                              <min-pool-size>2</min-pool-size>
                              <max-pool-size>70</max-pool-size>
                              <prefill>false</prefill>
                              <use-strict-min>false</use-strict-min>
                              <flush-strategy>FailingConnectionOnly</flush-strategy>
                          </pool>
                          <security>
                              <user-name>postgres</user-name>
                              <password>xxxxxx</password>
                          </security>
                          <validation>
                              <check-valid-connection-sql>select 0</check-valid-connection-sql>
                          </validation>
                          <timeout>
                              <blocking-timeout-millis>120000</blocking-timeout-millis>
                              <idle-timeout-minutes>5</idle-timeout-minutes>
                          </timeout>
                      </datasource>
      

      3. Add in test-vdb.xml java:/test_pg configured in previous step as datasource:

      <model name="test_pg">
              <property name="importer.useFullSchemaName" value="false"/>
      	<property name="importer.tableTypes" value="TABLE,VIEW"/>
      	<property name="importer.importKeys" value="false"/>
              <source name="test_pg" translator-name="myPg" connection-jndi-name="java:/test_pg"/>
          </model>
      
      <translator name="myPg" type="postgresql">
              <property name="SupportsNativeQueries" value="true"/>
          </translator>
      

      4. Configure in the test-vdb.xml the following virtual procedure:

      <model visible = "true" type = "VIRTUAL" name = "views">
              <metadata type = "DDL"><![CDATA[
                CREATE VIRTUAL PROCEDURE pr0 (arg0 string) RETURNS (col0 integer, col1 string) AS
      BEGIN
          SELECT 1 as col0, '2017-01-01' AS col1 
      		FROM (select '{"meta":1}' as val) w
      			,XMLTABLE(
      				XMLNAMESPACES ('http://www.w3.org/2001/XMLSchema-instance' as "xsi")
      				,'/root/bounce_rate' PASSING JSONTOXML('root', w.val) 
      				COLUMNS col0 integer
                      		  ,col1 string
                  	) some_alias;
      END
              ]]>
              </metadata>
          </model>
      

      5. Run the following query:

      SELECT *
      	FROM (SELECT 'League' AS type, 1 AS arg0) xxx, "test_pg.test_nva" dl, table(CALL "views.pr0"(arg0)) x
      	JOIN "test_pg.test_nva" d ON d.type = 'str_val' ;;
      

      or

      SELECT *
      	FROM (SELECT 'League' AS type, 1 AS arg0) xxx, "test_pg.test_nva" dl, table(CALL "views.pr0"(arg0)) x
      	JOIN "test_pg.test_nva" d ON x.col1 = d.start_date AND d.type = 'str_val' ;;
      
      Show
      1. In postgresql create the test_nva and test_ table by the following script: CREATE TABLE public .test_nva ( id integer , type character varying (4000), start_date date ); INSERT INTO public .test_nva(id, type , start_date) VALUES (1, 'str_val' , '2015-07-02' ); 2. Add postgresql database configuration in standalone-teiid.xml <datasource jndi-name= "java:/test_pg" pool-name= "test_pg" enabled= "true" use-java-context= "true" > <connection-url> jdbc:postgresql://localhost:5432/test?charSet=utf8 </connection-url> <driver-class> org.postgresql.Driver </driver-class> <driver> org.postgresql </driver> <pool> <min-pool-size> 2 </min-pool-size> <max-pool-size> 70 </max-pool-size> <prefill> false </prefill> <use-strict-min> false </use-strict-min> <flush-strategy> FailingConnectionOnly </flush-strategy> </pool> <security> <user-name> postgres </user-name> <password> xxxxxx </password> </security> <validation> <check-valid-connection-sql> select 0 </check-valid-connection-sql> </validation> <timeout> <blocking-timeout-millis> 120000 </blocking-timeout-millis> <idle-timeout-minutes> 5 </idle-timeout-minutes> </timeout> </datasource> 3. Add in test-vdb.xml java:/test_pg configured in previous step as datasource: <model name= "test_pg" > <property name= "importer.useFullSchemaName" value= "false" /> <property name= "importer.tableTypes" value= "TABLE,VIEW" /> <property name= "importer.importKeys" value= "false" /> <source name= "test_pg" translator-name= "myPg" connection-jndi-name= "java:/test_pg" /> </model> <translator name= "myPg" type= "postgresql" > <property name= "SupportsNativeQueries" value= "true" /> </translator> 4. Configure in the test-vdb.xml the following virtual procedure: <model visible = "true" type = "VIRTUAL" name = "views" > <metadata type = "DDL" > <![CDATA[ CREATE VIRTUAL PROCEDURE pr0 (arg0 string) RETURNS (col0 integer, col1 string) AS BEGIN SELECT 1 as col0, '2017-01-01' AS col1 FROM (select '{ "meta" :1}' as val) w ,XMLTABLE( XMLNAMESPACES ( 'http://www.w3.org/2001/XMLSchema-instance' as "xsi" ) , '/root/bounce_rate' PASSING JSONTOXML( 'root' , w.val) COLUMNS col0 integer ,col1 string ) some_alias; END ]]> </metadata> </model> 5. Run the following query: SELECT * FROM ( SELECT 'League' AS type , 1 AS arg0) xxx, "test_pg.test_nva" dl, table ( CALL "views.pr0" (arg0)) x JOIN "test_pg.test_nva" d ON d. type = 'str_val' ;; or SELECT * FROM ( SELECT 'League' AS type , 1 AS arg0) xxx, "test_pg.test_nva" dl, table ( CALL "views.pr0" (arg0)) x JOIN "test_pg.test_nva" d ON x.col1 = d.start_date AND d. type = 'str_val' ;;

    Description

      1. When running the following query:

      SELECT *
      	FROM (SELECT 'League' AS type, 1 AS arg0) xxx, "test_pg.test_nva" dl, table(CALL "views.pr0"(arg0)) x
      	JOIN "test_pg.test_nva" d ON d.type = 'str_val' ;;
      

      teiid throws out the following error:

      Unable to find source-code formatter for language: noformat. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      2017-11-16 17:23:24,159 ERROR [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue8) DopCSsLeK9Oy TEIID30019 Unexpected exception for request DopCSsLeK9Oy.2: org.teiid.core.TeiidCompon
      entException: TEIID30328 Unable to evaluate xxx.arg0: No value was available
              at org.teiid.query.util.CommandContext.getFromContext(CommandContext.java:514)
              at org.teiid.query.eval.Evaluator.internalEvaluate(Evaluator.java:771)
              at org.teiid.query.eval.Evaluator.evaluate(Evaluator.java:1387)
              at org.teiid.query.eval.Evaluator.internalEvaluate(Evaluator.java:761)
              at org.teiid.query.eval.Evaluator.evaluate(Evaluator.java:727)
              at org.teiid.query.processor.proc.ProcedurePlan.evaluateExpression(ProcedurePlan.java:857)
              at org.teiid.query.processor.proc.ProcedurePlan.open(ProcedurePlan.java:225)
              at org.teiid.query.processor.relational.PlanExecutionNode.open(PlanExecutionNode.java:82)
              at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:254)
              at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:254)
              at org.teiid.query.processor.relational.LimitNode.open(LimitNode.java:146)
              at org.teiid.query.processor.relational.JoinStrategy.openLeft(JoinStrategy.java:95)
              at org.teiid.query.processor.relational.NestedTableJoinStrategy.openLeft(NestedTableJoinStrategy.java:74)
              at org.teiid.query.processor.relational.JoinNode.open(JoinNode.java:145)
              at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:254)
              at org.teiid.query.processor.relational.LimitNode.open(LimitNode.java:146)
              at org.teiid.query.processor.relational.JoinStrategy.openRight(JoinStrategy.java:105)
              at org.teiid.query.processor.relational.JoinNode.open(JoinNode.java:149)
              at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:254)
              at org.teiid.query.processor.relational.LimitNode.open(LimitNode.java:146)
              at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:254)
              at org.teiid.query.processor.relational.RelationalPlan.open(RelationalPlan.java:136)
              at org.teiid.query.processor.QueryProcessor.init(QueryProcessor.java:232)
              at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:139)
              at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:115)
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)
              at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:479)
              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:349)
              at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
              at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:275)
              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:284)
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      

      2. When running the following query:

      SELECT *
      	FROM (SELECT 'League' AS type, 1 AS arg0) xxx, "test_pg.test_nva" dl, table(CALL "views.pr0"(arg0)) x
      	JOIN "test_pg.test_nva" d ON x.col1 = d.start_date AND d.type = 'str_val' ;;
      

      teiid complains showing the following error message:

      Unable to find source-code formatter for language: noformat. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      2017-11-16 17:37:59,372 WARN  [org.teiid.PROCESSOR] (Worker8_QueryProcessorQueue23) DopCSsLeK9Oy TEIID30020 Processing exception for request DopCSsLeK9Oy.9 'TEIID31172 Could not reso
      lve expressions being compared to a common type excluding character conversions: x.col1 = d.start_date'. Originally QueryResolverException ResolverVisitor.java:1045. Enable more deta
      iled logging to see the entire stacktrace.
      

      It seems that in the x.col1 = d.start_date comparison the d.start_date must be converted to string explicitly but I don't know if it's a bug or not, if we indeed must use the conversion here explicitly.

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            dalex005 Dmitrii Pogorelov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: