geyungjen opened a new issue, #37113:
URL: https://github.com/apache/arrow/issues/37113

   ### Describe the usage question you have. Please include as many useful 
details as  possible.
   
   
   I have a flight SQL server running against a relational database, the client 
I wrote with C/C++ works fine:
   
   In my C++ client, when I embed the following command:
   
      ARROW_ASSIGN_OR_RAISE(auto info, sql_client->Execute(call_options, 
"select 1, cast(3.14 as float), cast(Now() as text), 2 , cast('hello' as text), 
3, cast('world' as text) ;"))
   
   It works and gives me the result:
   
   Schema:?column?: int32
   float8: double
   now: string
   ?column?: int32
   text: string
   ?column?: int32
   text: string
   ?column?:   [
       1
     ]
   float8:   [
       3.14
     ]
   now:   [
       ";2023-08-10 12:56:12.10774-07"
     ]
   ?column?:   [
       2
     ]
   text:   [
   hello"
     ]
   ?column?:   [
       3
     ]
   text:   [
   world"
     ]
   
   The above is not an issue.
   
   The issue is with PyArrow, I got following error:
   
   Traceback (most recent call last):
     File "/Users/user/Documents/ml_spark/python_test/PyArrow/main.py", line 
69, in <module>
       
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select
 1;"), options=options)
     File "pyarrow/_flight.pyx", line 1527, in 
pyarrow._flight.FlightClient.get_flight_info
     File "pyarrow/_flight.pyx", line 78, in pyarrow._flight.check_flight_status
     File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
   pyarrow.lib.ArrowInvalid: Unable to parse command
   
   
   Here is the Python code in Pycharm:
   
   ef print_hi(name):
       # Use a breakpoint in the code line below to debug your script.
       print(f'Hi, {name}')  # Press ⌘F8 to toggle the breakpoint.
   
   
   # Press the green button in the gutter to run the script.
   if __name__ == '__main__':
       print_hi('PyCharm')
   
       username = 'sysdba'
       password = 'hello'
       sql = 'select 1'
       location=flight.Location('grpc://10.0.0.109:15432')
       client = flight.connect(location)
       token_pair = 
client.authenticate_basic_token(username=username,password=password)
       headers = [token_pair]
       print(headers)
       options = flight.FlightCallOptions(headers=headers)
       
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select
 1;"), options=options)
       reader = client.do_get(flight_info.endpoints[0].ticket, options)
       print(reader.read_pandas())
   
   It outputs:
   
   Hi, PyCharm
   [(b'authorization', b'Bearer 12630926897980691830')]
   Traceback (most recent call last):
     File "/Users/user/Documents/ml_spark/python_test/PyArrow/main.py", line 
69, in <module>
       
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select
 1;"), options=options)
     File "pyarrow/_flight.pyx", line 1527, in 
pyarrow._flight.FlightClient.get_flight_info
     File "pyarrow/_flight.pyx", line 78, in pyarrow._flight.check_flight_status
     File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
   pyarrow.lib.ArrowInvalid: Unable to parse command
   
   Authentication was successful, returns Bearer and session id.
   
   What is failed is:
   
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select
 1;"), options=options)
   
   with following error:
     File "/Users/user/Documents/ml_spark/python_test/PyArrow/main.py", line 
69, in <module>
       
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select
 1;"), options=options)
     File "pyarrow/_flight.pyx", line 1527, in 
pyarrow._flight.FlightClient.get_flight_info
     File "pyarrow/_flight.pyx", line 78, in pyarrow._flight.check_flight_status
     File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
   pyarrow.lib.ArrowInvalid: Unable to parse command
   
   Thanks
   
   George Jen
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to