Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-6099

not able to auto infer the row type when getting information from jdbc vertica

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Not a Priority
    • Resolution: Unresolved
    • 1.3.0
    • None
    • API / DataSet
    • linux , flink 1.3.0 with scala 2.10

    Description

      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 ?

      Attachments

        Activity

          People

            Unassigned Unassigned
            NaveenHolla naveen holla U
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified