Commit ff3ca55
authored
### Rationale for this change
https://github.com/apache/arrow/blob/8fc54a35f7df672d416ebd12a9558d320fba9afe/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.cc#L746-L748
This was introduced by ed36107
The `GetData` function was using hardcoded precision (38) and scale (0) values instead of retrieving them from the IRD (Implementation Row Descriptor). This fix ensures that precision/scale are properly retrieved from the IRD as defaults, and can be overridden by ARD (Application Row Descriptor) values when specified, following ODBC specification behavior.
### What changes are included in this PR?
- Modified `ODBCStatement::GetData()` to use IRD precision/scale as defaults instead of hardcoded values
- ARD precision/scale now properly override IRD values when `SQL_ARD_TYPE` or `SQL_C_DEFAULT` is used
- Added unit tests to verify IRD defaults and ARD override behavior
### Are these changes tested?
Yes. Added two tests in `statement_test.cc`:
- `TestGetDataPrecisionScaleUsesIRDAsDefault`: Verifies IRD precision/scale are used as defaults
- `TestGetDataPrecisionScaleUsesARDWhenSet`: Verifies ARD precision/scale override IRD when set
### Are there any user-facing changes?
I think it's fair to say a no. This is an internal fix that ensures correct ODBC behavior.
* GitHub Issue: #48707
Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: David Li <li.davidm96@gmail.com>
1 parent 0c49503 commit ff3ca55
2 files changed
Lines changed: 103 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
743 | 744 | | |
744 | 745 | | |
745 | 746 | | |
746 | | - | |
747 | | - | |
748 | | - | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
749 | 753 | | |
750 | 754 | | |
751 | 755 | | |
| |||
767 | 771 | | |
768 | 772 | | |
769 | 773 | | |
770 | | - | |
771 | 774 | | |
772 | 775 | | |
773 | 776 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
649 | 745 | | |
650 | 746 | | |
651 | 747 | | |
| |||
0 commit comments