Repository navigation
Conversation
Seek parent and child random streams with Long offsets in both the Spark connector and dev generator to avoid row-number truncation at large scales, and iterate instead of recursing in computeNext(). Round partition counts up with exact integer division, validate positive maxPartitionBytes, widen large-scale order/ticket number columns to Long in DataGenerator, and add regression tests for split boundaries, native dsdgen samples, and partition sizing. Co-authored-by: Fu Chen <cfmcgrady@gmail.com>
|
Maybe we should migrate all Identifier columns from INT to BIGINT for consistency, let me hold this for a while and wait for Spark side decision. |
|
SPARK-62327 has been accepted by the Spark community, which maps all Identifier columns from INT to the BIGINT, this PR is updated to follow that. |
|
I checked Partition sizing. The new ceiling test uses Catalog dates at a chunk boundary. At SF100000, read chunk
I reproduced the one-day shift through both Kyuubi iterators and native
|
|
Thanks for the review and thorough verification! Addressed in
|
|
Thanks for the update. I rechecked
|
|
Addressed in
|
|
Merge Summary:
Posted by |
Why are the changes needed?
io.trino.tpcds(1.4) narrowsstartingRowNumbertointinAbstractRowGenerator.skipRowsUntilStartingRowNumber:randomNumberStream.skipRows((int) startingRowNumber - 1).When generating large-scale TPC-DS tables whose row counts exceed
Int.MaxValue(store_sales/store_returnsat SF10000+,catalog_sales/catalog_returnsat SF30000+,web_sales/web_returnsat SF100000), the cast wraps negative andRandomNumberStreamImpl.skipRowsskips zero rows, corrupting generated data and row counts. Bothkyuubi-spark-connector-tpcdsanddev/kyuubi-tpcdsnow seek table, parent, and child random streams using the fullLongoffset (startingRowNumber - 1), and iterate incomputeNext()instead of recursing on empty rows.TPCDSBatchScanpreviously computed(_sizeInBytes / readConf.maxPartitionBytes).ceil.toInt, performing truncatingLonginteger division before.ceiland risking silentIntoverflow, and only skipped parallelization fortable.isSmall(leaving chunks 2..N empty for tables with< 1,000,000orders perParallel.splitWork). It now validatesmaxPartitionBytes > 0unconditionally, plans 1 partition whentable.isSmall || new Scaling(scale).getRowCount(table) < 1000000, and computes partition count withMath.toIntExact(LongMath.divide(_sizeInBytes, maxPartitionBytes, RoundingMode.CEILING)).Identifiercolumns toBIGINT/LongTypeper Section 2.2.2.1 a) of the TPC-DS v4.0.0 Specification and SPARK-62327:dev/kyuubi-tpcdsDataGenerator, widen allIdentifiercolumns (includingcs_order_number,cr_order_number,ss_ticket_number,ws_order_number, all*_skcolumns, andc_last_review_date_sk) to.longto avoid SF10000+INToverflow and type mismatches.kyuubi-spark-connector-tpcds(TPCDSSchemaUtils.reviseColumnType), mapcc_closed_date_sk,cc_open_date_sk,cp_start_date_sk, andcp_end_date_sktoLongType(working aroundio.trino.tpcds1.4 declaring those four foreign-key columns asINTEGER).Originally authored by @cfmcgrady in cfmcgrady:incubator-kyuubi:fix/tpcds-large-scale-row-count.
How was this patch tested?
Added unit tests in
TPCDSTableSuitecovering:Int.MaxValuerow-number boundary forstore_salesandstore_returnsat SF10000.(order/ticket_number, item_sk, date_sk)keys matching nativedsdgenacross SF10000, SF30000, and SF100000 forstore_*,catalog_*, andweb_*tables.sf10.store_sales),defaultParallelismfloor, single-partition planning for sub-1M / small tables (sf1.store_sales,sf0.store_sales,sf1.call_center), and non-positivemaxPartitionBytesvalidation across all table sizes.Identifiercolumns across all 24 base tables mapping toLongType.Ran locally on Scala 2.12 and Scala 2.13 (Spark 3.5 / 4.2) and
-Pcross-version-test: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.TPCDSSchemaUtilsSuiteWas this patch assisted by generative AI tooling?
Assisted-by: DeepSeek Harness (Gemini 4 Neon)