flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "naveen holla U (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLINK-6099) not able to auto infer the row type when getting informationn from jdbc vertica
Date Fri, 17 Mar 2017 09:45:41 GMT
naveen holla U created FLINK-6099:
-------------------------------------

             Summary: not able to auto infer the row type when getting informationn from jdbc
vertica 
                 Key: FLINK-6099
                 URL: https://issues.apache.org/jira/browse/FLINK-6099
             Project: Flink
          Issue Type: Bug
          Components: DataSet API
    Affects Versions: 1.3.0
         Environment: linux , flink 1.3.0 with scala 2.10 
            Reporter: naveen holla U


How to automatically infer the row type information for a given query

import org.apache.flink.api.scala._
import org.apache.flink.table.api.TableEnvironment
import org.apache.flink.api.java.io.jdbc.JDBCInputFormat
import org.apache.flink.api.java.typeutils.RowTypeInfo
import org.apache.flink.api.common.typeinfo.TypeInformation

var fieldTypes: Array[TypeInformation[_]] = Array(createTypeInformation[String],createTypeInformation[String],createTypeInformation[String])

var fieldNames: Array[String] = Array("UUID", "Name","instanceid")

val rowTypeInfo = new RowTypeInfo( fieldTypes,  fieldNames )

val inputFormat = JDBCInputFormat.buildJDBCInputFormat().setDrivername("com.vertica.jdbc.Driver").setDBUrl("jdbc:vertica://x.x.x.x:5433/hfdb").setUsername("user").setPassword("password").setQuery("select
* from test").setRowTypeInfo(rowTypeInfo).finish()

val dataset = benv.createInput(inputFormat)

dataset.print()



import org.apache.flink.api.scala._
import org.apache.flink.table.api.TableEnvironment
import org.apache.flink.api.java.io.jdbc.JDBCInputFormat
import org.apache.flink.api.java.typeutils.RowTypeInfo
import org.apache.flink.api.common.typeinfo.TypeInformation

var fieldTypes: Array[TypeInformation[_]] = Array(createTypeInformation[String],createTypeInformation[String],createTypeInformation[String])

var fieldNames: Array[String] = Array("UUID", "Name","instanceid")

val rowTypeInfo = new RowTypeInfo( fieldTypes,  fieldNames )

val inputFormat = JDBCInputFormat.buildJDBCInputFormat().setDrivername("com.vertica.jdbc.Driver").setDBUrl("jdbc:vertica://x.x.x.x:5433/hfdb").setUsername("user").setPassword("password").setQuery("select
* from test").setRowTypeInfo(rowTypeInfo).finish()

val dataset = benv.createInput(inputFormat)

dataset.print()



So in the above code we have to specify the type of the rows which we are getting . is there
a way to get the answer without setting row type ?



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

Mime
View raw message