Skip to content

Conversation

@EdwardArchive
Copy link
Contributor

@EdwardArchive EdwardArchive commented Jan 12, 2026

Related PR : #8454


Problem:

  • VARCHAR columns were returned as []byte instead of string due to MySQL
    driver behavior when scanning into any type
  • DECIMAL columns returned as float64, causing precision loss for large values

Solution:

  • Add starrocksRows wrapper with custom MapScan() using sql.NullXXX types
  • DECIMAL now returns as string to preserve full precision (same as MySQL driver)
  • Add prepareScanDest() for type-safe scan destinations

Testing:

  • Add Docker-based integration tests using StarRocks 4.0.3 all-in-one container
  • 29 test cases covering all StarRocks data types:
    • Basic types (BOOLEAN, INT, BIGINT, FLOAT, DOUBLE, VARCHAR, etc.)
    • Complex types (ARRAY, MAP, STRUCT)
    • Aggregate types (HLL, BITMAP)
    • High-precision DECIMAL (DECIMAL32, DECIMAL64, DECIMAL128)
    • Unicode strings (Korean, Chinese, Japanese, Emoji)
    • Boundary values and NULL handling
  • Refactor teststarrocks to read from init.sql file for better maintainability

Type mapping (MySQL protocol):

  • BOOLEAN → int16 (reported as TINYINT)
  • DECIMAL → string (precision preserved)
  • LARGEINT → string (128-bit exceeds int64)
  • ARRAY/MAP/STRUCT → string (JSON format)
  • JSON → string (reported as VARCHAR)

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@EdwardArchive
Copy link
Contributor Author

These test failures are due to missing environment variables (S3, GCS, Druid, MotherDuck credentials)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant