pan3793 opened a new pull request, #7877:
URL: https://github.com/apache/kyuubi/pull/7877

   ### Why are the changes needed?
   
   1. `io.trino.tpcds` (1.4) narrows `startingRowNumber` to `int` in 
`AbstractRowGenerator.skipRowsUntilStartingRowNumber`:
      `randomNumberStream.skipRows((int) startingRowNumber - 1)`.
      When generating large-scale TPC-DS tables whose row counts exceed 
`Int.MaxValue` (`store_sales`/`store_returns` at SF10000+, 
`catalog_sales`/`catalog_returns` at SF30000+, `web_sales`/`web_returns` at 
SF100000), the cast wraps negative and `RandomNumberStreamImpl.skipRows` skips 
zero rows, corrupting generated data and row counts. Both 
`kyuubi-spark-connector-tpcds` and `dev/kyuubi-tpcds` now seek table, parent, 
and child random streams using the full `Long` offset (`startingRowNumber - 
1`), and iterate in `computeNext()` instead of recursing on empty rows.
   2. `TPCDSBatchScan` previously computed `(_sizeInBytes / 
readConf.maxPartitionBytes).ceil.toInt`, performing truncating `Long` integer 
division before `.ceil` and risking silent `Int` overflow. It now uses 
`Math.toIntExact(LongMath.divide(_sizeInBytes, readConf.maxPartitionBytes, 
RoundingMode.CEILING))`, and `TPCDSReadConf.maxPartitionBytes` validates that 
the value is positive.
   3. `dev/kyuubi-tpcds` `DataGenerator` defined `cs_order_number`, 
`cr_order_number`, `ss_ticket_number`, and `ws_order_number` as `INT`, which 
overflows at SF10000+; they are now `LONG` to match `sr_ticket_number`, 
`wr_order_number`, and the TPC-DS connector schema.
   
   Originally authored by @cfmcgrady in 
`cfmcgrady:incubator-kyuubi:fix/tpcds-large-scale-row-count`.
   
   ### How was this patch tested?
   
   Added unit tests in `TPCDSTableSuite` covering:
   1. Split consistency across the `Int.MaxValue` row-number boundary for 
`store_sales` and `store_returns` at SF10000.
   2. Large-scale partition row counts matching native `dsdgen` across SF10000, 
SF30000, and SF100000 for `store_*`, `catalog_*`, and `web_*` tables.
   3. Exact ceiling partition sizing, `defaultParallelism` floor, small-table 
handling, and non-positive `maxPartitionBytes` validation.
   
   Ran locally on Scala 2.12 and Scala 2.13 (Spark 3.5):
   ```shell
   build/mvn test scalastyle:check spotless:check apache-rat:check -Ptpcds   
-pl dev/kyuubi-tpcds,extensions/spark/kyuubi-spark-connector-tpcds -am   
-Dtest=none 
-DwildcardSuites=org.apache.kyuubi.spark.connector.tpcds.TPCDSTableSuite,org.apache.kyuubi.spark.connector.tpcds.TPCDSCatalogSuite,org.apache.kyuubi.spark.connector.tpcds.TPCDSSchemaUtilsSuite
   ```
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: DeepSeek Harness (Gemini 4 Neon)


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