Skip to content

init impl flight sql server example#1

Open
wangfenjin wants to merge 6 commits into
masterfrom
flight-sql
Open

init impl flight sql server example#1
wangfenjin wants to merge 6 commits into
masterfrom
flight-sql

Conversation

@wangfenjin

@wangfenjin wangfenjin commented Mar 3, 2022

Copy link
Copy Markdown
Owner

The logic is identical to datafusion-examples/flight_server.rs, and we can use arrow-cpp-cli to connect to this server

~/github/arrow-datafusion $ cargo run --example flight_sql_server

~/github/arrow/cpp/build $ debug/flight_sql_test_app --port 50051 --command Execute --query 'select * from alltypes_plain'

Results from endpoint 1 of 1
Schema:
id: int32
bool_col: bool
tinyint_col: int32
smallint_col: int32
int_col: int32
bigint_col: int64
float_col: float
double_col: double
date_string_col: binary
string_col: binary
timestamp_col: timestamp[ns]

Results:
id:   [
    4,
    5,
    6,
    7,
    2,
    3,
    0,
    1
  ]
bool_col:   [
    true,
    false,
    true,
    false,
    true,
    false,
    true,
    false
  ]
tinyint_col:   [
    0,
    1,
    0,
    1,
    0,
    1,
    0,
    1
  ]
smallint_col:   [
    0,
    1,
    0,
    1,
    0,
    1,
    0,
    1
  ]
int_col:   [
    0,
    1,
    0,
    1,
    0,
    1,
    0,
    1
  ]
bigint_col:   [
    0,
    10,
    0,
    10,
    0,
    10,
    0,
    10
  ]
float_col:   [
    0,
    1.1,
    0,
    1.1,
    0,
    1.1,
    0,
    1.1
  ]
double_col:   [
    0,
    10.1,
    0,
    10.1,
    0,
    10.1,
    0,
    10.1
  ]
date_string_col:   [
    30332F30312F3039,
    30332F30312F3039,
    30342F30312F3039,
    30342F30312F3039,
    30322F30312F3039,
    30322F30312F3039,
    30312F30312F3039,
    30312F30312F3039
  ]
string_col:   [
    30,
    31,
    30,
    31,
    30,
    31,
    30,
    31
  ]
timestamp_col:   [
    2009-03-01 00:00:00.000000000,
    2009-03-01 00:01:00.000000000,
    2009-04-01 00:00:00.000000000,
    2009-04-01 00:01:00.000000000,
    2009-02-01 00:00:00.000000000,
    2009-02-01 00:01:00.000000000,
    2009-01-01 00:00:00.000000000,
    2009-01-01 00:01:00.000000000
  ]

Total: 8

Change-Id: Ia38c305a7f2f2e309b2e013ff39fd6e3a855d647
Comment thread datafusion-examples/examples/flight_sql_server.rs Outdated
Change-Id: I5848753c84dde2efae4b3fb78679f4375f017ca2
Change-Id: Ibded6ef3be1a587067dbc1a313d4e679ba9a9627
}),
location: vec![],
};
let info = FlightInfo {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the FlightInfo should be returned as part of the call that is executing the query in do_get_statement -- maybe even handled by the implementation of FlightSqlService

Though I realize it may be somewhat tricky to save the state between what is essentially two calls in flight -- the DoPut (which returns this FlightInfo) and then the GetFlightInfo)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite get it. Are you suggesting we merge the get_flight_info_statement and do_get_statement?

No we can't do that, we need to leave that to the client, that's part of the protocol.

You may have noticed the endpoint field, when we implement a distributed sql server, we can have a coordinator to serve the get_flight_info_statement, and then the client can be redirected to connected to multiple endpoints returned by the coordinator, so that not all data need go through one server host. That's just one case we can think of.

Change-Id: Icfd3d2e85d36234188c86d6780ab14332a8de092
Change-Id: I113bc893da91c5b9ddc4ff6f15989c313cd93d43
Change-Id: Iaa37bc710c46eb8bed80c446224ccd6b43fd0120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants