You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/22 13:54:12 UTC

[GitHub] [arrow] milesgranger opened a new pull request, #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

milesgranger opened a new pull request, #14698:
URL: https://github.com/apache/arrow/pull/14698

   Will close [ARROW-18360](https://issues.apache.org/jira/browse/ARROW-18360)


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14698:
URL: https://github.com/apache/arrow/pull/14698#issuecomment-1323714728

   https://issues.apache.org/jira/browse/ARROW-18360


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] milesgranger commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
milesgranger commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029718574


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Yes, the `not None` is nice, I initially used it in a previous PR but it was advised to raise a more informative error; I can make the switch back here.
   
   > Also, in general I question if pyarrow_unwrap_schema et al should accept None by default, it seems such errors would be caught if they raised and translating None to nullptr had to be opt in
   
   I checked the impl of `pyarrow_unwrap_schema` and it seems quite decisive in it's willingness to return an empty pointer so left it alone; it anyway maps nice enough from Python's `None` to `nullptr` in it's current form. :sweat_smile: 
   
   > Finally, it seems the C++ side should guard against nullptr better too
   
   Agreed, I'll try to make that better in this PR, thanks. :) 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ursabot commented on pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #14698:
URL: https://github.com/apache/arrow/pull/14698#issuecomment-1326951694

   Benchmark runs are scheduled for baseline = 945bcf6429e39a0bee5a266615d9277c2592238b and contender = 62829c5ca81e5ddaef2a609745aae6e6d08d1e6b. 62829c5ca81e5ddaef2a609745aae6e6d08d1e6b is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/7b6efd06ad1a4e44852431a1a3738d23...9fca032031554acaa83a7074ff797d90/)
   [Failed :arrow_down:0.47% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/e87ebdf76ab6464891b1ec7a229fa437...fd8b1e6a73734b168b5596befc8dce74/)
   [Finished :arrow_down:0.27% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/2421fff28a6e431b8a4e8475069434ed...29f3675b32d046f5b7d33c541b31f1a5/)
   [Finished :arrow_down:0.7% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/1c525283f79b4178a094e6de0c1932ff...658aa4ad6d934e13b551075be45152ff/)
   Buildkite builds:
   [Finished] [`62829c5c` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/1916)
   [Finished] [`62829c5c` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/1938)
   [Finished] [`62829c5c` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/1908)
   [Finished] [`62829c5c` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/1930)
   [Finished] [`945bcf64` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/1915)
   [Failed] [`945bcf64` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/1937)
   [Finished] [`945bcf64` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/1907)
   [Finished] [`945bcf64` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/1929)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
lidavidm commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029906948


##########
cpp/src/arrow/ipc/writer.cc:
##########
@@ -1377,6 +1377,10 @@ namespace internal {
 Result<std::unique_ptr<RecordBatchWriter>> OpenRecordBatchWriter(
     std::unique_ptr<IpcPayloadWriter> sink, const std::shared_ptr<Schema>& schema,
     const IpcWriteOptions& options) {
+  // constructor for IpcFormatWriter here dereferences ptr to schema.
+  if (schema == nullptr) {
+    return Status::Invalid("nullptr for Schema not allowed.");

Review Comment:
   nit: no need for a period here



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
lidavidm commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029475785


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Cython lets you declare the parameter as `Schema schema not None` which would be better https://cython.readthedocs.io/en/latest/src/userguide/extension_types.html#extension-types-and-none



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm merged pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
lidavidm merged PR #14698:
URL: https://github.com/apache/arrow/pull/14698


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] milesgranger commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
milesgranger commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029742029


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Updated in https://github.com/apache/arrow/pull/14698/commits/d38124fc1276757c2eb04b8c77afc67247284766, when testing with removing the `not None` check, the error is somewhat uninformative so left the `not None` in Cython.
   
   ```python
   In [1]: import pyarrow.flight as flight
   
   In [2]: client = flight.FlightClient('grpc+tls://localhost:9643', disable_server_verification=True)
   
   In [3]: client.do_put(flight.FlightDescriptor.for_command('foo'), schema=None)
   ---------------------------------------------------------------------------
   FlightUnavailableError                    Traceback (most recent call last)
   Cell In [3], line 1
   ----> 1 client.do_put(flight.FlightDescriptor.for_command('foo'), schema=None)
   
   File ~/Projects/arrow/python/pyarrow/_flight.pyx:1559, in pyarrow._flight.FlightClient.do_put()
      1557
      1558         with nogil:
   -> 1559             check_flight_status(self.client.get().DoPut(
      1560                 deref(c_options),
      1561                 c_descriptor,
   
   File ~/Projects/arrow/python/pyarrow/_flight.pyx:71, in pyarrow._flight.check_flight_status()
        69             raise FlightUnauthorizedError(message, detail_msg)
        70         elif detail.get().code() == CFlightStatusUnavailable:
   ---> 71             raise FlightUnavailableError(message, detail_msg)
        72
        73 size_detail = FlightWriteSizeStatusDetail.UnwrapStatus(status)
   
   FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all  
   addresses; last error: UNKNOWN: Failed to connect to remote host: Connection refused. gRPC 
   client debug context: UNKNOWN:Failed to pick subchannel {created_time:"2022-11-
   22T20:23:29.049965339+01:00", children:[UNKNOWN:failed to connect to all addresses; last error: 
   UNKNOWN: Failed to connect to remote host: Connection refused {grpc_status:14, 
   created_time:"2022-11-22T20:23:29.049961187+01:00"}]}. Additionally, could not finish writing 
   record batches before closing. Client context: Invalid: nullptr for Schema not allowed.
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] milesgranger commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
milesgranger commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029718574


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Yes, the `not None` is nice, I initially used it in a previous PR but it was advised to raise a more informative error; I can make the switch back here.
   
   > Also, in general I question if pyarrow_unwrap_schema et al should accept None by default, it seems such errors would be caught if they raised and translating None to nullptr had to be opt in
   
   I checked the impl of `pyarrow_unwrap_schema` and it seems quite decisive in it's willingness to return an empty pointer so left it alone; it anyway maps nice enough from Python's `None` to `nullptr` in it's current form. :sweat_smile: Opting into this sounds reasonable though.
   
   > Finally, it seems the C++ side should guard against nullptr better too
   
   Agreed, I'll try to make that better in this PR, thanks. :) 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm commented on pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
lidavidm commented on PR #14698:
URL: https://github.com/apache/arrow/pull/14698#issuecomment-1325035365

   Thanks. Looks like the MinGW failures are unrelated.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] milesgranger commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
milesgranger commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029742029


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Updated in https://github.com/apache/arrow/pull/14698/commits/d38124fc1276757c2eb04b8c77afc67247284766, when testing with removing the `not None` check, the error is somewhat unclear so left the `not None` in Cython.
   
   ```python
   In [1]: import pyarrow.flight as flight
   
   In [2]: client = flight.FlightClient('grpc+tls://localhost:9643', disable_server_verification=True)
   
   In [3]: client.do_put(flight.FlightDescriptor.for_command('foo'), schema=None)
   ---------------------------------------------------------------------------
   FlightUnavailableError                    Traceback (most recent call last)
   Cell In [3], line 1
   ----> 1 client.do_put(flight.FlightDescriptor.for_command('foo'), schema=None)
   
   File ~/Projects/arrow/python/pyarrow/_flight.pyx:1559, in pyarrow._flight.FlightClient.do_put()
      1557
      1558         with nogil:
   -> 1559             check_flight_status(self.client.get().DoPut(
      1560                 deref(c_options),
      1561                 c_descriptor,
   
   File ~/Projects/arrow/python/pyarrow/_flight.pyx:71, in pyarrow._flight.check_flight_status()
        69             raise FlightUnauthorizedError(message, detail_msg)
        70         elif detail.get().code() == CFlightStatusUnavailable:
   ---> 71             raise FlightUnavailableError(message, detail_msg)
        72
        73 size_detail = FlightWriteSizeStatusDetail.UnwrapStatus(status)
   
   FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all  
   addresses; last error: UNKNOWN: Failed to connect to remote host: Connection refused. gRPC 
   client debug context: UNKNOWN:Failed to pick subchannel {created_time:"2022-11-
   22T20:23:29.049965339+01:00", children:[UNKNOWN:failed to connect to all addresses; last error: 
   UNKNOWN: Failed to connect to remote host: Connection refused {grpc_status:14, 
   created_time:"2022-11-22T20:23:29.049961187+01:00"}]}. Additionally, could not finish writing 
   record batches before closing. Client context: Invalid: nullptr for Schema not allowed.
   ```



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
lidavidm commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029478889


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Also, in general I question if `pyarrow_unwrap_schema` et al should accept None by default, it seems such errors would be caught if they raised and translating None to nullptr had to be opt in



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] lidavidm commented on a diff in pull request #14698: ARROW-18360: [Python] Don't crash when schema=None in FlightClient.do_put

Posted by GitBox <gi...@apache.org>.
lidavidm commented on code in PR #14698:
URL: https://github.com/apache/arrow/pull/14698#discussion_r1029479725


##########
python/pyarrow/_flight.pyx:
##########
@@ -1548,6 +1548,9 @@ cdef class FlightClient(_Weakrefable):
         writer : FlightStreamWriter
         reader : FlightMetadataReader
         """
+        if schema is None:

Review Comment:
   Finally, it seems the C++ side should guard against nullptr better too



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org