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

   ### Describe the usage question you have. Please include as many useful 
details as  possible.
   
   
   I implemented an Arrow Flight SQL Server using JAVA and tried to connect to 
it using Python, using Apache Arrow 13.0.0. I'm having a  Infinite loop problem 
and looking for help. Infinite loop at the code position below:
   
![image](https://github.com/apache/arrow/assets/13197424/a3063f07-5b70-4429-a5e0-ba371178f628)
   
![image](https://github.com/apache/arrow/assets/13197424/3fad682d-95c7-4bd3-ab58-0464235373eb)
   It seems to because `AuthObserver::onNext` is not being called correctly, Is 
this related to the Protobuf version?
   
   Arrow Flight SQL Server using JAVA:
   ```
   <arrow.version>13.0.0</arrow.version>
   <grpc.version>1.56.0</grpc.version>
   <protobuf.version>3.23.1</protobuf.version>
   <protoc.artifact.version>3.24.3</protoc.artifact.version>
   ```
   ```
   FlightSqlService.java
   
   public FlightSqlService(int port) {
            BufferAllocator allocator = new RootAllocator();
            Location location = Location.forGrpcInsecure("0.0.0.0", port);
            FlightSqlServiceImpl producer = new FlightSqlServiceImpl(location);
            flightServer = FlightServer.builder(allocator, location, producer)
                    .authHandler(new BasicServerAuthHandler(new 
FlightServerBasicAuthValidator())).build();
        }
   
   flightServer.start();
   ```
   ```
   FlightSqlServiceImpl.java
   
   public class FlightSqlServiceImpl implements FlightSqlProducer, 
AutoCloseable {
       public FlightSqlServiceImpl(final Location location) {
           this.location = location;
           sqlInfoBuilder = new SqlInfoBuilder();
           sqlInfoBuilder.withFlightSqlServerName("DorisFE")
                   .withFlightSqlServerVersion("1.0")
                   .withFlightSqlServerArrowVersion("13.0.0")
                   .withFlightSqlServerReadOnly(false)
                   .withSqlIdentifierQuoteChar("`")
                   .withSqlDdlCatalog(true)
                   .withSqlDdlSchema(false)
                   .withSqlDdlTable(false)
                   
.withSqlIdentifierCase(SqlSupportedCaseSensitivity.SQL_CASE_SENSITIVITY_CASE_INSENSITIVE)
                   
.withSqlQuotedIdentifierCase(SqlSupportedCaseSensitivity.SQL_CASE_SENSITIVITY_CASE_INSENSITIVE);
       }
   }
   ```
   ```
   FlightServerBasicAuthValidator.java
   
   public class FlightServerBasicAuthValidator implements 
BasicServerAuthHandler.BasicAuthValidator {
       private static final String myToken = "DORIS_READ_WRITE_TOKEN";
   
       @Override
       public byte[] getToken(String username, String password) {
           return myToken.getBytes(Charsets.UTF_8);
       }
   
       @Override
       public Optional<String> isValid(byte[] bytes) {
           return Optional.of(myToken);
       }
   }
   ```
   
   Connect using Python ADBC
   ```
   tp version:
   adbc_driver_flightsql-0.6.0
   adbc_driver_manager-0.6.0
   pyarrow-13.0.0
   ```
   ```
   import adbc_driver_flightsql.dbapi as flight_sql
   import adbc_driver_flightsql
   import adbc_driver_manager
   
   db = adbc_driver_flightsql.connect(uri="grpc://xxx:10478", db_kwargs={
               adbc_driver_manager.DatabaseOptions.USERNAME.value: "root",
               adbc_driver_manager.DatabaseOptions.PASSWORD.value: "",
           })
   conn = adbc_driver_manager.AdbcConnection(db)
   stmt = adbc_driver_manager.AdbcStatement(conn)
   ```
   
   if not add `DatabaseOptions.USERNAME` and `DatabaseOptions.PASSWORD`, can 
connect it normally
   ```
   db = adbc_driver_flightsql.connect(uri="grpc://xxx:10478")
   ```
   
   ### Component(s)
   
   FlightRPC


-- 
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