You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by hagersaleh <lo...@yahoo.com> on 2015/04/11 16:24:47 UTC

How can generation dataset in flink automatic depend on number of filed and data type

I want write program flink on any database
user input filed and type of filed and
when read database want generate  automatic function  dataset

any example in flink i want database and write function to handles this
example
final ExecutionEnvironment env =
ExecutionEnvironment.getExecutionEnvironment();

                // get input data
                DataSet<Lineitem> lineitems = getLineitemDataSet(env);
                DataSet<Order> orders = getOrdersDataSet(env);
                DataSet<Customer> customers = getCustomerDataSet(env);


        //
*************************************************************************
        //     DATA TYPES
        //
*************************************************************************
       
        public static class Lineitem extends Tuple4<Long, Double, Double,
String> {

                public Long getOrderkey() { return this.f0; }
                public Double getDiscount() { return this.f2; }
                public Double getExtendedprice() { return this.f1; }
                public String getShipdate() { return this.f3; }
        }

        public static class Customer extends Tuple2<Long, String> {
               
                public Long getCustKey() { return this.f0; }
                public String getMktsegment() { return this.f1; }
        }

        public static class Order extends Tuple4<Long, Long, String, Long> {
               
                public Long getOrderKey() { return this.f0; }
                public Long getCustKey() { return this.f1; }
                public String getOrderdate() { return this.f2; }
                public Long getShippriority() { return this.f3; }
        }

I want generate this automatic for any database and input from user 



--
View this message in context: http://apache-flink-incubator-user-mailing-list-archive.2336050.n4.nabble.com/How-can-generation-dataset-in-flink-automatic-depend-on-number-of-filed-and-data-type-tp982.html
Sent from the Apache Flink (Incubator) User Mailing List archive. mailing list archive at Nabble.com.

Re: How can generation dataset in flink automatic depend on number of filed and data type

Posted by hagersaleh <lo...@yahoo.com>.
 user input csv file for database and Filed Name and Data type for all filed
then i want generate dataset function for handles this 
because want use this in all input file not custom file



--
View this message in context: http://apache-flink-incubator-user-mailing-list-archive.2336050.n4.nabble.com/How-can-generation-dataset-in-flink-automatic-depend-on-number-of-filed-and-data-type-tp982p984.html
Sent from the Apache Flink (Incubator) User Mailing List archive. mailing list archive at Nabble.com.

Re: How can generation dataset in flink automatic depend on number of filed and data type

Posted by Robert Metzger <rm...@apache.org>.
Hey,

do you want to read from a JDBC database?
What exactly do you mean by "automatic function"?

In general, I think you can read rows from a JDBC database and then use a
map function to transform the rows from that database into a custom
datatype (POJO).

Best,
Robert

On Sat, Apr 11, 2015 at 4:24 PM, hagersaleh <lo...@yahoo.com> wrote:

> I want write program flink on any database
> user input filed and type of filed and
> when read database want generate  automatic function  dataset
>
> any example in flink i want database and write function to handles this
> example
> final ExecutionEnvironment env =
> ExecutionEnvironment.getExecutionEnvironment();
>
>                 // get input data
>                 DataSet<Lineitem> lineitems = getLineitemDataSet(env);
>                 DataSet<Order> orders = getOrdersDataSet(env);
>                 DataSet<Customer> customers = getCustomerDataSet(env);
>
>
>         //
> *************************************************************************
>         //     DATA TYPES
>         //
> *************************************************************************
>
>         public static class Lineitem extends Tuple4<Long, Double, Double,
> String> {
>
>                 public Long getOrderkey() { return this.f0; }
>                 public Double getDiscount() { return this.f2; }
>                 public Double getExtendedprice() { return this.f1; }
>                 public String getShipdate() { return this.f3; }
>         }
>
>         public static class Customer extends Tuple2<Long, String> {
>
>                 public Long getCustKey() { return this.f0; }
>                 public String getMktsegment() { return this.f1; }
>         }
>
>         public static class Order extends Tuple4<Long, Long, String, Long>
> {
>
>                 public Long getOrderKey() { return this.f0; }
>                 public Long getCustKey() { return this.f1; }
>                 public String getOrderdate() { return this.f2; }
>                 public Long getShippriority() { return this.f3; }
>         }
>
> I want generate this automatic for any database and input from user
>
>
>
> --
> View this message in context:
> http://apache-flink-incubator-user-mailing-list-archive.2336050.n4.nabble.com/How-can-generation-dataset-in-flink-automatic-depend-on-number-of-filed-and-data-type-tp982.html
> Sent from the Apache Flink (Incubator) User Mailing List archive. mailing
> list archive at Nabble.com.
>