Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

The issue requests support for scanning YDB Decimal values using types.Decimal as the destination type in both query client and database/sql. This functionality already exists but lacked test coverage.

Changes

  • Added tests/integration/decimal_scan_test.go with comprehensive integration tests:
    • Query client: Direct row.Scan(&decimal) with various precision/scale combinations, negative values, NULL handling
    • Database/SQL: Both table service and query service modes with same coverage

Usage

// Query client
row, err := db.Query().QueryRow(ctx,   
    `SELECT Decimal('123456789.987654321', 33, 12)`,  
    query.WithIdempotent(),  
)  
var dst types.Decimal   
err = row.Scan(&dst)
// dst.Precision == 33, dst.Scale == 12

// Database/SQL
row := db.QueryRowContext(ctx, `SELECT Decimal('123456789.987654321', 33, 12)`)
var dst types.Decimal  
err = row.Scan(&dst)

No implementation changes needed - the underlying support in internal/value/value.go (line 615-619) and internal/table/scanner/scanner.go (line 900-901) already handles decimal.Decimal type casting correctly.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • invalid_host
    • Triggering command: /tmp/go-build2219246829/b548/credentials.test -test.testlogfile=/tmp/go-build2219246829/b548/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: support YDB Decimal as destination type in query result and database/sql result</issue_title>
<issue_description>Example using query-client and Scan API

row, err := db.Query().QueryRow(ctx,   
    `SELECT Decimal('123456789.987654321', 33, 12)`,  
    query.WithIdempotent(),  
)  
if err != nil {  
    panic(err)  
}  
var dst types.Decimal   // or other type
err = row.Scan(&dst)  
// check value, precision, scale

Example using database/sql client

var db *sql.DB // init outside
row := db.QueryRowContext(ctx, `SELECT Decimal('123456789.987654321', 33, 12)`)
var dst types.Decimal  // or other type
err = row.Scan(&dst)  
if err != nil {  
    panic(err)  
}  
// check value, precision, scale
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@github-actions
Copy link

summary

Inferred base version: v3.118.2
Suggested version: v3.118.3

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.23%. Comparing base (70fd60b) to head (5eb7e83).

❗ There is a different number of reports uploaded between BASE (70fd60b) and HEAD (5eb7e83). Click for more details.

HEAD has 503 uploads less than BASE
Flag BASE (70fd60b) HEAD (5eb7e83)
macOS 24 2
unit 71 6
go-1.25.x 79 3
go-1.21.x 69 3
windows 23 2
ubuntu 101 2
experiment 10 0
ydb-nightly 10 0
ydb-latest 21 0
integration 67 0
ydb-25.2 24 0
ydb-24.4 22 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1938       +/-   ##
===========================================
- Coverage   74.01%   47.23%   -26.79%     
===========================================
  Files         392      391        -1     
  Lines       34343    34208      -135     
===========================================
- Hits        25418    16157     -9261     
- Misses       7807    17453     +9646     
+ Partials     1118      598      -520     
Flag Coverage Δ
experiment ?
go-1.21.x 47.19% <ø> (-25.54%) ⬇️
go-1.25.x 45.07% <ø> (-28.92%) ⬇️
integration ?
macOS 47.20% <ø> (-0.03%) ⬇️
ubuntu 47.19% <ø> (-26.82%) ⬇️
unit 47.23% <ø> (-0.02%) ⬇️
windows 47.22% <ø> (-0.01%) ⬇️
ydb-24.4 ?
ydb-25.2 ?
ydb-latest ?
ydb-nightly ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: asmyasnikov <14202262+asmyasnikov@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for YDB Decimal in query results Add integration tests for Decimal scanning in query and database/sql clients Nov 17, 2025
Copilot AI requested a review from asmyasnikov November 17, 2025 14:51
Copilot finished work on behalf of asmyasnikov November 17, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support YDB Decimal as destination type in query result and database/sql result

3 participants