wangyum opened a new pull request, #6863:
URL: https://github.com/apache/hive/pull/6863

   ### What changes were proposed in this pull request?
   `GetPartitionsRequest.filterSpec` has no thrift requiredness qualifier, so a 
client is allowed to leave it unset. `ShowTableStatusFormatter.getLocations()` 
does exactly that when running `SHOW TABLE EXTENDED <partitioned_table>` 
without a `PARTITION` clause, which causes 
`TableStoreImpl.getPartitionSpecsByFilterAndProjection` to throw an NPE.
   
   This normalizes a `null` `filterSpec` to an empty 
`GetPartitionsFilterSpec()` at the top of the method. The existing 
`isSetFilterMode()` checks used throughout the SQL/JDO code paths already treat 
an unset filter mode as "no filtering", so this makes a null filterSpec behave 
the same as an explicitly empty one: all partitions are returned.
   
   ### Why are the changes needed?
   Regression introduced by HIVE-28601. `SHOW TABLE EXTENDED` without a 
`PARTITION` clause on any partitioned table currently throws 
`NullPointerException` instead of listing all partitions.
   
   ### Does this PR introduce _any_ user-facing change?
   No behavior change other than fixing the NPE — `SHOW TABLE EXTENDED 
<partitioned_table>` (no `PARTITION` clause) now correctly lists all partitions 
of the table instead of failing.
   
   ### How was this patch tested?
   - Added `testGetPartitionsWithNullFilterSpec` / 
`testGetPartitionsWithNullFilterSpecUsingJDO` to 
`TestGetPartitionsUsingProjectionAndFilterSpecs`, exercising the real thrift 
client path (`getPartitionsWithSpecs`) with `filterSpec` left unset, covering 
both the DirectSQL and JDO server code paths.
   - Added a `SHOW TABLE EXTENDED LIKE \`srcpart\`` (no `PARTITION` clause) 
case to `show_tablestatus.q`, tying the fix to the real-world trigger scenario. 
Verified via `mvn test` on 
`TestMiniLlapLocalCliDriver#testCliDriver[show_tablestatus]`.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to