Error on SQL orderBy Error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error on SQL orderBy Error

chrisr123
Use Case:
I have a CSV file with data that I want to do a SELECT with orderBy.
I'm getting this error below. What am I doing incorrectly? Thanks!

*Expression (('id).asc).asc failed on input check: Sort should only based on
field reference
*

*Input File structure:*
id,order_date,amount,customer_id
3000,2018-04-19,192.74,1005
3001,2017-08-18,432.87,1000
3002,2018-08-18,22.19,1002

*Source code:*
CsvTableSource orderTableSource = CsvTableSource.builder()
            .path("input/batch/orders.csv")
            .ignoreFirstLine()
            .fieldDelimiter(",")
            .field("id", Types.INT())
            .field("order_date", Types.SQL_DATE())
            .field("amount", Types.DECIMAL())
            .field("customer_id", Types.LONG())
            .build();


tableEnv.registerTableSource("orders", orderTableSource);
Table orderTable = tableEnv.scan("orders");

// SELECT *
// FROM orders
Table allOrders = orderTable
        .select("id,order_date,amount,customer_id")
        .orderBy("id.asc");



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Error on SQL orderBy Error

Rong Rong
Hi Chris,

This looks like a bug to me as 
val allOrders:Table = orderTable
        .select('id, 'order_date, 'amount, 'customer_id)
        .orderBy('id.asc)


works perfectly fine. Could you file a bug report and kindly provide the Flink version you are using? I can take a look into it

Thanks,
Rong

On Sun, Aug 19, 2018 at 5:42 AM chrisr123 <[hidden email]> wrote:
Use Case:
I have a CSV file with data that I want to do a SELECT with orderBy.
I'm getting this error below. What am I doing incorrectly? Thanks!

*Expression (('id).asc).asc failed on input check: Sort should only based on
field reference
*

*Input File structure:*
id,order_date,amount,customer_id
3000,2018-04-19,192.74,1005
3001,2017-08-18,432.87,1000
3002,2018-08-18,22.19,1002

*Source code:*
CsvTableSource orderTableSource = CsvTableSource.builder()
            .path("input/batch/orders.csv")
            .ignoreFirstLine()
            .fieldDelimiter(",")
            .field("id", Types.INT())
            .field("order_date", Types.SQL_DATE())
            .field("amount", Types.DECIMAL())
            .field("customer_id", Types.LONG())
            .build();


tableEnv.registerTableSource("orders", orderTableSource);
Table orderTable = tableEnv.scan("orders");

// SELECT *
// FROM orders
Table allOrders = orderTable
        .select("id,order_date,amount,customer_id")
        .orderBy("id.asc");



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Error on SQL orderBy Error

Rong Rong
Filed https://issues.apache.org/jira/browse/FLINK-10172. Seems like it is affecting latest version.

--
Rong

On Sun, Aug 19, 2018 at 8:14 AM Rong Rong <[hidden email]> wrote:
Hi Chris,

This looks like a bug to me as 
val allOrders:Table = orderTable
        .select('id, 'order_date, 'amount, 'customer_id)
        .orderBy('id.asc)


works perfectly fine. Could you file a bug report and kindly provide the Flink version you are using? I can take a look into it

Thanks,
Rong

On Sun, Aug 19, 2018 at 5:42 AM chrisr123 <[hidden email]> wrote:
Use Case:
I have a CSV file with data that I want to do a SELECT with orderBy.
I'm getting this error below. What am I doing incorrectly? Thanks!

*Expression (('id).asc).asc failed on input check: Sort should only based on
field reference
*

*Input File structure:*
id,order_date,amount,customer_id
3000,2018-04-19,192.74,1005
3001,2017-08-18,432.87,1000
3002,2018-08-18,22.19,1002

*Source code:*
CsvTableSource orderTableSource = CsvTableSource.builder()
            .path("input/batch/orders.csv")
            .ignoreFirstLine()
            .fieldDelimiter(",")
            .field("id", Types.INT())
            .field("order_date", Types.SQL_DATE())
            .field("amount", Types.DECIMAL())
            .field("customer_id", Types.LONG())
            .build();


tableEnv.registerTableSource("orders", orderTableSource);
Table orderTable = tableEnv.scan("orders");

// SELECT *
// FROM orders
Table allOrders = orderTable
        .select("id,order_date,amount,customer_id")
        .orderBy("id.asc");



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/