diff --git a/go/adbc/go.mod b/go/adbc/go.mod index aa0bad1fa6..8be44dcdf0 100644 --- a/go/adbc/go.mod +++ b/go/adbc/go.mod @@ -83,14 +83,13 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a //indirect github.com/zeebo/xxh3 v1.0.2 // indirect - golang.org/x/crypto v0.13.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/term v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.3.0 // indirect diff --git a/go/adbc/go.sum b/go/adbc/go.sum index 283516941a..a18c66879a 100644 --- a/go/adbc/go.sum +++ b/go/adbc/go.sum @@ -4,8 +4,6 @@ github.com/99designs/keyring v1.2.2 h1:pZd3neh/EmUzWONb35LxQfvuY7kiSXAq3HQd97+XB github.com/99designs/keyring v1.2.2/go.mod h1:wes/FrByc8j7lFOAGLGSNEg8f/PaI3cgTBqhFkHUrPk= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 h1:8q4SaHjFsClSvuVne0ID/5Ka8u3fcIHyqkLjcFpNRHQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 h1:t5+QXLCK9SVi0PPdaY0PrFvYUo24KwA0QwxnaHRSVd4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= @@ -23,82 +21,44 @@ github.com/apache/arrow/go/v13 v13.0.0 h1:kELrvDQuKZo8csdWYqBQfyi431x6Zs/YJTEgUu github.com/apache/arrow/go/v13 v13.0.0/go.mod h1:W69eByFNO0ZR30q1/7Sr9d83zcVZmF2MiP3fFYAWJOc= github.com/apache/thrift v0.17.0 h1:cMd2aj52n+8VoAtvSvLn4kDC3aZ6IAkBuqWQ2IDu7wo= github.com/apache/thrift v0.17.0/go.mod h1:OLxhMRJxomX+1I/KUw03qoV3mMz16BwaKI+d4fPBx7Q= -github.com/apache/thrift v0.19.0 h1:sOqkWPzMj7w6XaYbJQG7m4sGqVolaW/0D28Ln7yPzMk= -github.com/apache/thrift v0.19.0/go.mod h1:SUALL216IiaOw2Oy+5Vs9lboJ/t9g40C+G07Dc0QC1I= github.com/aws/aws-sdk-go-v2 v1.19.0 h1:klAT+y3pGFBU/qVf1uzwttpBbiuozJYWzNLHioyDJ+k= github.com/aws/aws-sdk-go-v2 v1.19.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= -github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13/go.mod h1:gpAbvyDGQFozTEmlTFO8XcQKHzubdq0LzRyJpG6MiXM= github.com/aws/aws-sdk-go-v2/config v1.18.28 h1:TINEaKyh1Td64tqFvn09iYpKiWjmHYrG1fa91q2gnqw= github.com/aws/aws-sdk-go-v2/config v1.18.28/go.mod h1:nIL+4/8JdAuNHEjn/gPEXqtnS02Q3NXB/9Z7o5xE4+A= -github.com/aws/aws-sdk-go-v2/config v1.18.43 h1:IgdUtTRvUDC6eiJBqU6vh7bHFNAEBjQ8S+qJ7zVhDOs= -github.com/aws/aws-sdk-go-v2/config v1.18.43/go.mod h1:NiFev8qlgg8MPzw3fO/EwzMZeZwlJEKGwfpjRPA9Nvw= github.com/aws/aws-sdk-go-v2/credentials v1.13.27 h1:dz0yr/yR1jweAnsCx+BmjerUILVPQ6FS5AwF/OyG1kA= github.com/aws/aws-sdk-go-v2/credentials v1.13.27/go.mod h1:syOqAek45ZXZp29HlnRS/BNgMIW6uiRmeuQsz4Qh2UE= -github.com/aws/aws-sdk-go-v2/credentials v1.13.41 h1:dgbKq1tamtboYAKSXWbqL0lKO9rmEzEhbZFh9JQW/Bg= -github.com/aws/aws-sdk-go-v2/credentials v1.13.41/go.mod h1:cc3Fn7DkKbJalPtQnudHGZZ8ml9+hwtbc1CJONsYYqk= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.5 h1:kP3Me6Fy3vdi+9uHd7YLr6ewPxRL+PU6y15urfTaamU= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.5/go.mod h1:Gj7tm95r+QsDoN2Fhuz/3npQvcZbkEf5mL70n3Xfluc= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.72 h1:m0MmP89v1B0t3b8W8rtATU76KNsodak69QtiokHyEvo= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.72/go.mod h1:ylOTxIuoTL+XjH46Omv2iPjHdeGUk3SQ4hxYho4EHMA= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.88 h1:AxcMcV1uTY15jysvTiXC6Mgpb5nU1rnqH0PmgJ7ig80= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.88/go.mod h1:C6Kvpm4g92So11JEAHMK0trT6EEEe5g5uG5JrneR6zQ= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.35 h1:hMUCiE3Zi5AHrRNGf5j985u0WyqI6r2NULhUfo0N/No= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.35/go.mod h1:ipR5PvpSPqIqL5Mi82BxLnfMkHVbmco8kUwO2xrCi0M= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.29 h1:yOpYx+FTBdpk/g+sBU6Cb1H0U/TLEcYYp66mYqsPpcc= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.29/go.mod h1:M/eUABlDbw2uVrdAn+UsI6M727qp2fxkp8K0ejcBDUY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.36 h1:8r5m1BoAWkn0TDC34lUculryf7nUF25EgIMdjvGCkgo= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.36/go.mod h1:Rmw2M1hMVTwiUhjwMoIBFWFJMhvJbct06sSidxInkhY= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 h1:g+qlObJH4Kn4n21g69DjspU0hKTjWtq7naZ9OLCv0ew= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.27 h1:cZG7psLfqpkB6H+fIrgUDWmlzM474St1LP0jcz272yI= github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.27/go.mod h1:ZdjYvJpDlefgh8/hWelJhqgqJeodxu4SmbVsSdBlL7E= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 h1:6lJvvkQ9HmbHZ4h/IEwclwv2mrTW8Uq1SOB/kXy0mfw= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4/go.mod h1:1PrKYwxTM+zjpw9Y41KFtoJCQrJ34Z47Y4VgVbfndjo= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 h1:m0QTSI6pZYJTk5WSKx3fm5cNW/DCicVzULBgU/6IyD0= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14/go.mod h1:dDilntgHy9WnHXsh7dDtUPgHKEfTJIBUTHM8OWm0f/0= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.30 h1:Bje8Xkh2OWpjBdNfXLrnn8eZg569dUQmhgtydxAYyP0= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.30/go.mod h1:qQtIBl5OVMfmeQkz8HaVyh5DzFmmFXyvK27UgIgOr4c= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 h1:eev2yZX7esGRjqRbnVk1UxMLw4CyVZDpZXRCcy75oQk= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36/go.mod h1:lGnOkH9NJATw0XEPcAknFBj3zzNTEGRHtSw+CwC1YTg= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.29 h1:IiDolu/eLmuB18DRZibj77n1hHQT7z12jnGO7Ze3pLc= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.29/go.mod h1:fDbkK4o7fpPXWn8YAPmTieAMuB9mk/VgvW64uaUqxd4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 h1:CdzPW9kKitgIiLV1+MHobfR5Xg25iYnyzWZhyQuSlDI= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.4 h1:hx4WksB0NRQ9utR+2c3gEGzl6uKj3eM6PMQ6tN3lgXs= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.4/go.mod h1:JniVpqvw90sVjNqanGLufrVapWySL28fhBlYgl96Q/w= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 h1:v0jkRigbSD6uOdwcaUQmgEwG1BkPfAPDqaeNt/29ghg= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4/go.mod h1:LhTyt8J04LL+9cIt7pYJ5lbS/U98ZmXovLOR/4LUsk8= github.com/aws/aws-sdk-go-v2/service/s3 v1.37.0 h1:PalLOEGZ/4XfQxpGZFTLaoJSmPoybnqJYotaIZEf/Rg= github.com/aws/aws-sdk-go-v2/service/s3 v1.37.0/go.mod h1:PwyKKVL0cNkC37QwLcrhyeCrAk+5bY8O2ou7USyAS2A= -github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0 h1:wl5dxN1NONhTDQD9uaEvNsDRX29cBmGED/nl0jkWlt4= -github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0/go.mod h1:rDGMZA7f4pbmTtPOk5v5UM2lmX6UAbRnMDJeDvnH7AM= github.com/aws/aws-sdk-go-v2/service/sso v1.12.13 h1:sWDv7cMITPcZ21QdreULwxOOAmE05JjEsT6fCDtDA9k= github.com/aws/aws-sdk-go-v2/service/sso v1.12.13/go.mod h1:DfX0sWuT46KpcqbMhJ9QWtxAIP1VozkDWf8VAkByjYY= -github.com/aws/aws-sdk-go-v2/service/sso v1.15.0 h1:vuGK1vHNP9zx0PfOrtPumbwR2af0ATQ1Z2H6p75AgRQ= -github.com/aws/aws-sdk-go-v2/service/sso v1.15.0/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.13 h1:BFubHS/xN5bjl818QaroN6mQdjneYQ+AOx44KNXlyH4= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.13/go.mod h1:BzqsVVFduubEmzrVtUFQQIQdFqvUItF8XUq2EnS8Wog= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= github.com/aws/aws-sdk-go-v2/service/sts v1.19.3 h1:e5mnydVdCVWxP+5rPAGi2PYxC7u2OZgH1ypC114H04U= github.com/aws/aws-sdk-go-v2/service/sts v1.19.3/go.mod h1:yVGZA1CPkmUhBdA039jXNJJG7/6t+G+EBWmFq23xqnY= -github.com/aws/aws-sdk-go-v2/service/sts v1.23.0 h1:pyvfUqkNLMipdKNAtu7OVbRxUrR2BMaKccIPpk/Hkak= -github.com/aws/aws-sdk-go-v2/service/sts v1.23.0/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= -github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= @@ -107,7 +67,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= @@ -132,8 +91,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= @@ -148,8 +105,6 @@ github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -159,8 +114,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= @@ -184,12 +137,8 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs github.com/snowflakedb/gosnowflake v1.6.23-0.20230717195239-fec38ba82d2a h1:F7fKVj3t12jr3Bopzngsp/PZDm1or8zpk+29NN4YFGk= github.com/snowflakedb/gosnowflake v1.6.23-0.20230717195239-fec38ba82d2a/go.mod h1:KfO4F7bk+aXPUIvBqYxvPhxLlu2/w4TtSC8Rw/yr5Mg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= @@ -197,65 +146,38 @@ github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/exp v0.0.0-20181106170214-d68db9428509/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= -golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 h1:vlzZttNJGVqTsRFU9AmdnrcO1Znh8Ew9kCD//yjigk0= -google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -270,50 +192,23 @@ lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo= lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw= modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= -modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q= -modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y= -modernc.org/cc/v4 v4.2.1 h1:xwwaXFwiPaVZpGRMd19NPLsaiNyNBO8oChey4501g1M= -modernc.org/cc/v4 v4.2.1/go.mod h1:0O8vuqhQfwBy+piyfEjzWIUGV4I3TPsXSf0W05+lgN8= modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw= modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= -modernc.org/ccgo/v3 v3.16.15 h1:KbDR3ZAVU+wiLyMESPtbtE/Add4elztFyfsWoNTgxS0= -modernc.org/ccgo/v3 v3.16.15/go.mod h1:yT7B+/E2m43tmMOT51GMoM98/MtHIcQQSleGnddkUNI= -modernc.org/ccgo/v4 v4.0.0-20230612200659-63de3e82e68d h1:3yB/pQNL5kVPDifGFqoZjeRxf8m0+Us15rB7ertNASQ= -modernc.org/ccgo/v4 v4.0.0-20230612200659-63de3e82e68d/go.mod h1:austqj6cmEDRfewsUvmGmyIgsI/Nq87oTXlfTgY85Fc= modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= -modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= -modernc.org/gc/v2 v2.1.2-0.20220923113132-f3b5abcf8083 h1:rGoLVwiOxdeVkGYMOF/8Pw7xpDd3OqScJU/tqHgvY1c= -modernc.org/gc/v2 v2.1.2-0.20220923113132-f3b5abcf8083/go.mod h1:Zt5HLUW0j+l02wj99UsPs+1DOFwwsGnqfcw+BGyyP/A= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= -modernc.org/lex v1.1.0/go.mod h1:+ojes+j0JYCaqwKYCBjcUavscJHmWFKvViUTMU4VjLA= -modernc.org/lexer v1.0.0/go.mod h1:F/Dld0YKYdZCLQ7bD0USbWL4YKCyTDRDHiDTOs0q0vk= modernc.org/libc v1.22.4 h1:wymSbZb0AlrjdAVX3cjreCHTPCpPARbQXNz6BHPzdwQ= modernc.org/libc v1.22.4/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= -modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM= -modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak= modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= -modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= -modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/scannertest v1.0.0/go.mod h1:9qnOCV+wSvq1o9hcOPNwRorND4qpZdtmTvmcdKyN3iE= modernc.org/sqlite v1.21.2 h1:ixuUG0QS413Vfzyx6FWx6PYTmHaOegTY+hjzhn7L+a0= modernc.org/sqlite v1.21.2/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0= -modernc.org/sqlite v1.26.0 h1:SocQdLRSYlA8W99V8YH0NES75thx19d9sB/aFc4R8Lw= -modernc.org/sqlite v1.26.0/go.mod h1:FL3pVXie73rg3Rii6V/u5BoHlSoyeZeIgKZEgHARyCU= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= -modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws= -modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= -modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE= -modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY= diff --git a/r/adbcdrivermanager/NAMESPACE b/r/adbcdrivermanager/NAMESPACE index 48a0aa9425..74ba9797e4 100644 --- a/r/adbcdrivermanager/NAMESPACE +++ b/r/adbcdrivermanager/NAMESPACE @@ -31,9 +31,16 @@ S3method(str,adbc_driver) S3method(str,adbc_error) S3method(str,adbc_xptr) S3method(write_adbc,default) +export(adbc_connection_cancel) export(adbc_connection_commit) export(adbc_connection_get_info) export(adbc_connection_get_objects) +export(adbc_connection_get_option) +export(adbc_connection_get_option_bytes) +export(adbc_connection_get_option_double) +export(adbc_connection_get_option_int) +export(adbc_connection_get_statistic_names) +export(adbc_connection_get_statistics) export(adbc_connection_get_table_schema) export(adbc_connection_get_table_types) export(adbc_connection_init) @@ -45,6 +52,10 @@ export(adbc_connection_read_partition) export(adbc_connection_release) export(adbc_connection_rollback) export(adbc_connection_set_options) +export(adbc_database_get_option) +export(adbc_database_get_option_bytes) +export(adbc_database_get_option_double) +export(adbc_database_get_option_int) export(adbc_database_init) export(adbc_database_init_default) export(adbc_database_release) @@ -53,9 +64,15 @@ export(adbc_driver) export(adbc_driver_log) export(adbc_driver_monkey) export(adbc_driver_void) +export(adbc_error_from_array_stream) export(adbc_statement_bind) export(adbc_statement_bind_stream) export(adbc_statement_execute_query) +export(adbc_statement_execute_schema) +export(adbc_statement_get_option) +export(adbc_statement_get_option_bytes) +export(adbc_statement_get_option_double) +export(adbc_statement_get_option_int) export(adbc_statement_get_parameter_schema) export(adbc_statement_init) export(adbc_statement_init_default) diff --git a/r/adbcdrivermanager/R/adbc.R b/r/adbcdrivermanager/R/adbc.R index 53756f413d..6be5fceb3b 100644 --- a/r/adbcdrivermanager/R/adbc.R +++ b/r/adbcdrivermanager/R/adbc.R @@ -19,6 +19,7 @@ #' #' @param driver An [adbc_driver()]. #' @param database An [adbc_database][adbc_database_init]. +#' @param option A specific option name #' @param ... Driver-specific options. For the default method, these are #' named values that are converted to strings. #' @param options A named `character()` or `list()` whose values are converted @@ -66,26 +67,6 @@ adbc_database_init_default <- function(driver, options = NULL, subclass = charac }) } -#' @rdname adbc_database_init -#' @export -adbc_database_set_options <- function(database, options) { - options <- key_value_options(options) - error <- adbc_allocate_error() - for (i in seq_along(options)) { - key <- names(options)[i] - value <- options[i] - status <- .Call( - RAdbcDatabaseSetOption, - database, - key, - value, - error - ) - stop_for_error(status, error) - } - invisible(database) -} - #' @rdname adbc_database_init #' @export adbc_database_release <- function(database) { @@ -135,26 +116,6 @@ adbc_connection_init_default <- function(database, options = NULL, subclass = ch }) } -#' @rdname adbc_connection_init -#' @export -adbc_connection_set_options <- function(connection, options) { - options <- key_value_options(options) - error <- adbc_allocate_error() - for (i in seq_along(options)) { - key <- names(options)[i] - value <- options[i] - status <- .Call( - RAdbcConnectionSetOption, - connection, - key, - value, - error - ) - stop_for_error(status, error) - } - invisible(connection) -} - #' @rdname adbc_connection_init #' @export adbc_connection_release <- function(connection) { @@ -184,14 +145,18 @@ adbc_connection_release <- function(connection) { #' @param db_schema Only show tables in the given database schema. If NULL, do #' not filter by database schema. If an empty string, only show tables without #' a database schema. May be a search pattern. -#' @param table_name Only show tables with the given name. If NULL, do not -#' filter by name. May be a search pattern. +#' @param table_name Constrain an object or statistics query for a specific table. +#' If NULL, do not filter by name. May be a search pattern. #' @param table_type Only show tables matching one of the given table types. If #' NULL, show tables of any type. Valid table types can be fetched from #' GetTableTypes. Terminate the list with a NULL entry. #' @param column_name Only show columns with the given name. If NULL, do not #' filter by name. May be a search pattern. #' @param serialized_partition The partition descriptor. +#' @param approximate If `FALSE`, request exact values of statistics, +#' else allow for best-effort, approximate, or cached values. The database +#' may return approximate values regardless, as indicated in the result. +#' Requesting exact values may be expensive or unsupported. #' @param value A string or identifier. #' #' @return @@ -210,13 +175,13 @@ adbc_connection_release <- function(connection) { #' # (not implemented by the void driver) #' try(adbc_connection_get_info(con, 0)) #' -adbc_connection_get_info <- function(connection, info_codes) { +adbc_connection_get_info <- function(connection, info_codes = NULL) { error <- adbc_allocate_error() out_stream <- nanoarrow::nanoarrow_allocate_array_stream() status <- .Call( RAdbcConnectionGetInfo, connection, - as.integer(info_codes), + info_codes, out_stream, error ) @@ -303,6 +268,56 @@ adbc_connection_commit <- function(connection) { invisible(connection) } + +#' @rdname adbc_connection_get_info +#' @export +adbc_connection_rollback <- function(connection) { + error <- adbc_allocate_error() + .Call(RAdbcConnectionRollback, connection, error) + invisible(connection) +} + +#' @rdname adbc_connection_get_info +#' @export +adbc_connection_cancel <- function(connection) { + error <- adbc_allocate_error() + .Call(RAdbcConnectionCancel, connection, error) + invisible(connection) +} + +#' @rdname adbc_connection_get_info +#' @export +adbc_connection_get_statistic_names <- function(connection) { + error <- adbc_allocate_error() + out_stream <- nanoarrow::nanoarrow_allocate_array_stream() + status <- .Call(RAdbcConnectionGetStatisticNames, connection, out_stream, error) + stop_for_error(status, error) + + out_stream +} + +#' @rdname adbc_connection_get_info +#' @export +adbc_connection_get_statistics <- function(connection, catalog, db_schema, + table_name, approximate = FALSE) { + error <- adbc_allocate_error() + out_stream <- nanoarrow::nanoarrow_allocate_array_stream() + + status <- .Call( + RAdbcConnectionGetStatistics, + connection, + catalog, + db_schema, + table_name, + approximate, + out_stream, + error + ) + stop_for_error(status, error) + + out_stream +} + #' @rdname adbc_connection_get_info #' @export adbc_connection_quote_identifier <- function(connection, value, ...) { @@ -327,14 +342,6 @@ adbc_connection_quote_string.default <- function(connection, value, ...) { paste0("'", out, "'") } -#' @rdname adbc_connection_get_info -#' @export -adbc_connection_rollback <- function(connection) { - error <- adbc_allocate_error() - .Call(RAdbcConnectionRollback, connection, error) - invisible(connection) -} - #' Statements #' #' @inheritParams adbc_connection_init @@ -370,26 +377,6 @@ adbc_statement_init_default <- function(connection, options = NULL, subclass = c }) } -#' @rdname adbc_statement_init -#' @export -adbc_statement_set_options <- function(statement, options) { - options <- key_value_options(options) - error <- adbc_allocate_error() - for (i in seq_along(options)) { - key <- names(options)[i] - value <- options[i] - status <- .Call( - RAdbcStatementSetOption, - statement, - key, - value, - error - ) - stop_for_error(status, error) - } - invisible(statement) -} - #' @rdname adbc_statement_init #' @export adbc_statement_release <- function(statement) { @@ -498,3 +485,15 @@ adbc_statement_execute_query <- function(statement, stream = NULL) { stop_for_error(result$status, error) result$rows_affected } + +#' @rdname adbc_statement_set_sql_query +#' @export +adbc_statement_execute_schema <- function(statement) { + error <- adbc_allocate_error() + out_schema <- nanoarrow::nanoarrow_allocate_schema() + + status <- .Call(RAdbcStatementExecuteSchema, statement, out_schema, error) + stop_for_error(status, error) + + out_schema +} diff --git a/r/adbcdrivermanager/R/error.R b/r/adbcdrivermanager/R/error.R index e87e4eae15..565f509612 100644 --- a/r/adbcdrivermanager/R/error.R +++ b/r/adbcdrivermanager/R/error.R @@ -15,6 +15,33 @@ # specific language governing permissions and limitations # under the License. + +#' Get extended error information from an array stream +#' +#' @param stream A [nanoarrow_array_stream][nanoarrow::as_nanoarrow_array_stream] +#' +#' @return `NULL` if stream was not created by a driver that supports +#' extended error information or a list whose first element is the +#' status code and second element is the `adbc_error` object. The +#' `acbc_error` must not be accessed if `stream` is explicitly released. +#' @export +#' +#' @examples +#' db <- adbc_database_init(adbc_driver_monkey()) +#' con <- adbc_connection_init(db) +#' stmt <- adbc_statement_init(con, mtcars) +#' stream <- nanoarrow::nanoarrow_allocate_array_stream() +#' adbc_statement_execute_query(stmt, stream) +#' adbc_error_from_array_stream(stream) +#' +adbc_error_from_array_stream <- function(stream) { + if (!inherits(stream, "nanoarrow_array_stream") || !adbc_xptr_is_valid(stream)) { + stop("`stream` must be a valid nanoarrow_array_stream") + } + + .Call(RAdbcErrorFromArrayStream, stream) +} + adbc_allocate_error <- function(shelter = NULL) { .Call(RAdbcAllocateError, shelter) } @@ -62,12 +89,12 @@ str.adbc_error <- function(object, ...) { #' @export length.adbc_error <- function(x, ...) { - 3L + 4L } #' @export names.adbc_error <- function(x, ...) { - c("message", "vendor_code", "sqlstate") + c("message", "vendor_code", "sqlstate", "details") } #' @export diff --git a/r/adbcdrivermanager/R/options.R b/r/adbcdrivermanager/R/options.R new file mode 100644 index 0000000000..be258bbd4b --- /dev/null +++ b/r/adbcdrivermanager/R/options.R @@ -0,0 +1,162 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +#' @rdname adbc_database_init +#' @export +adbc_database_set_options <- function(database, options) { + options <- key_value_options(options) + error <- adbc_allocate_error() + for (i in seq_along(options)) { + key <- names(options)[i] + value <- options[i] + status <- .Call( + RAdbcDatabaseSetOption, + database, + key, + value, + error + ) + stop_for_error(status, error) + } + invisible(database) +} + +#' @rdname adbc_connection_init +#' @export +adbc_connection_set_options <- function(connection, options) { + options <- key_value_options(options) + error <- adbc_allocate_error() + for (i in seq_along(options)) { + key <- names(options)[i] + value <- options[i] + status <- .Call( + RAdbcConnectionSetOption, + connection, + key, + value, + error + ) + stop_for_error(status, error) + } + invisible(connection) +} + +#' @rdname adbc_statement_init +#' @export +adbc_statement_set_options <- function(statement, options) { + options <- key_value_options(options) + error <- adbc_allocate_error() + for (i in seq_along(options)) { + key <- names(options)[i] + value <- options[i] + status <- .Call( + RAdbcStatementSetOption, + statement, + key, + value, + error + ) + stop_for_error(status, error) + } + invisible(statement) +} + +#' @rdname adbc_database_init +#' @export +adbc_database_get_option <- function(database, option) { + error <- adbc_allocate_error() + .Call(RAdbcDatabaseGetOption, database, option, error) +} + +#' @rdname adbc_database_init +#' @export +adbc_database_get_option_bytes <- function(database, option) { + error <- adbc_allocate_error() + .Call(RAdbcDatabaseGetOptionBytes, database, option, error) +} + +#' @rdname adbc_database_init +#' @export +adbc_database_get_option_int <- function(database, option) { + error <- adbc_allocate_error() + .Call(RAdbcDatabaseGetOptionInt, database, option, error) +} + +#' @rdname adbc_database_init +#' @export +adbc_database_get_option_double <- function(database, option) { + error <- adbc_allocate_error() + .Call(RAdbcDatabaseGetOptionDouble, database, option, error) +} + + +#' @rdname adbc_connection_init +#' @export +adbc_connection_get_option <- function(connection, option) { + error <- adbc_allocate_error() + .Call(RAdbcConnectionGetOption, connection, option, error) +} + +#' @rdname adbc_connection_init +#' @export +adbc_connection_get_option_bytes <- function(connection, option) { + error <- adbc_allocate_error() + .Call(RAdbcConnectionGetOptionBytes, connection, option, error) +} + +#' @rdname adbc_connection_init +#' @export +adbc_connection_get_option_int <- function(connection, option) { + error <- adbc_allocate_error() + .Call(RAdbcConnectionGetOptionInt, connection, option, error) +} + +#' @rdname adbc_connection_init +#' @export +adbc_connection_get_option_double <- function(connection, option) { + error <- adbc_allocate_error() + .Call(RAdbcConnectionGetOptionDouble, connection, option, error) +} + + +#' @rdname adbc_statement_init +#' @export +adbc_statement_get_option <- function(statement, option) { + error <- adbc_allocate_error() + .Call(RAdbcStatementGetOption, statement, option, error) +} + +#' @rdname adbc_statement_init +#' @export +adbc_statement_get_option_bytes <- function(statement, option) { + error <- adbc_allocate_error() + .Call(RAdbcStatementGetOptionBytes, statement, option, error) +} + +#' @rdname adbc_statement_init +#' @export +adbc_statement_get_option_int <- function(statement, option) { + error <- adbc_allocate_error() + .Call(RAdbcStatementGetOptionInt, statement, option, error) +} + +#' @rdname adbc_statement_init +#' @export +adbc_statement_get_option_double <- function(statement, option) { + error <- adbc_allocate_error() + .Call(RAdbcStatementGetOptionDouble, statement, option, error) +} diff --git a/r/adbcdrivermanager/man/adbc_connection_get_info.Rd b/r/adbcdrivermanager/man/adbc_connection_get_info.Rd index 12f5afa5c5..bc90893ffc 100644 --- a/r/adbcdrivermanager/man/adbc_connection_get_info.Rd +++ b/r/adbcdrivermanager/man/adbc_connection_get_info.Rd @@ -7,12 +7,15 @@ \alias{adbc_connection_get_table_types} \alias{adbc_connection_read_partition} \alias{adbc_connection_commit} +\alias{adbc_connection_rollback} +\alias{adbc_connection_cancel} +\alias{adbc_connection_get_statistic_names} +\alias{adbc_connection_get_statistics} \alias{adbc_connection_quote_identifier} \alias{adbc_connection_quote_string} -\alias{adbc_connection_rollback} \title{Connection methods} \usage{ -adbc_connection_get_info(connection, info_codes) +adbc_connection_get_info(connection, info_codes = NULL) adbc_connection_get_objects( connection, @@ -32,11 +35,23 @@ adbc_connection_read_partition(connection, serialized_partition) adbc_connection_commit(connection) +adbc_connection_rollback(connection) + +adbc_connection_cancel(connection) + +adbc_connection_get_statistic_names(connection) + +adbc_connection_get_statistics( + connection, + catalog, + db_schema, + table_name, + approximate = FALSE +) + adbc_connection_quote_identifier(connection, value, ...) adbc_connection_quote_string(connection, value, ...) - -adbc_connection_rollback(connection) } \arguments{ \item{connection}{An \link[=adbc_connection_init]{adbc_connection}} @@ -56,8 +71,8 @@ a search pattern.} not filter by database schema. If an empty string, only show tables without a database schema. May be a search pattern.} -\item{table_name}{Only show tables with the given name. If NULL, do not -filter by name. May be a search pattern.} +\item{table_name}{Constrain an object or statistics query for a specific table. +If NULL, do not filter by name. May be a search pattern.} \item{table_type}{Only show tables matching one of the given table types. If NULL, show tables of any type. Valid table types can be fetched from @@ -68,6 +83,11 @@ filter by name. May be a search pattern.} \item{serialized_partition}{The partition descriptor.} +\item{approximate}{If \code{FALSE}, request exact values of statistics, +else allow for best-effort, approximate, or cached values. The database +may return approximate values regardless, as indicated in the result. +Requesting exact values may be expensive or unsupported.} + \item{value}{A string or identifier.} \item{...}{Driver-specific options. For the default method, these are diff --git a/r/adbcdrivermanager/man/adbc_connection_init.Rd b/r/adbcdrivermanager/man/adbc_connection_init.Rd index 1c545f1ab7..72edbbd5ca 100644 --- a/r/adbcdrivermanager/man/adbc_connection_init.Rd +++ b/r/adbcdrivermanager/man/adbc_connection_init.Rd @@ -1,19 +1,31 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/adbc.R +% Please edit documentation in R/adbc.R, R/options.R \name{adbc_connection_init} \alias{adbc_connection_init} \alias{adbc_connection_init_default} -\alias{adbc_connection_set_options} \alias{adbc_connection_release} +\alias{adbc_connection_set_options} +\alias{adbc_connection_get_option} +\alias{adbc_connection_get_option_bytes} +\alias{adbc_connection_get_option_int} +\alias{adbc_connection_get_option_double} \title{Connections} \usage{ adbc_connection_init(database, ...) adbc_connection_init_default(database, options = NULL, subclass = character()) +adbc_connection_release(connection) + adbc_connection_set_options(connection, options) -adbc_connection_release(connection) +adbc_connection_get_option(connection, option) + +adbc_connection_get_option_bytes(connection, option) + +adbc_connection_get_option_int(connection, option) + +adbc_connection_get_option_double(connection, option) } \arguments{ \item{database}{An \link[=adbc_database_init]{adbc_database}.} @@ -28,6 +40,8 @@ to strings.} finer-grained control over behaviour at the R level.} \item{connection}{An \link[=adbc_connection_init]{adbc_connection}} + +\item{option}{A specific option name} } \value{ An object of class 'adbc_connection' diff --git a/r/adbcdrivermanager/man/adbc_database_init.Rd b/r/adbcdrivermanager/man/adbc_database_init.Rd index 612aaa3a4e..cc011844da 100644 --- a/r/adbcdrivermanager/man/adbc_database_init.Rd +++ b/r/adbcdrivermanager/man/adbc_database_init.Rd @@ -1,19 +1,31 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/adbc.R +% Please edit documentation in R/adbc.R, R/options.R \name{adbc_database_init} \alias{adbc_database_init} \alias{adbc_database_init_default} -\alias{adbc_database_set_options} \alias{adbc_database_release} +\alias{adbc_database_set_options} +\alias{adbc_database_get_option} +\alias{adbc_database_get_option_bytes} +\alias{adbc_database_get_option_int} +\alias{adbc_database_get_option_double} \title{Databases} \usage{ adbc_database_init(driver, ...) adbc_database_init_default(driver, options = NULL, subclass = character()) +adbc_database_release(database) + adbc_database_set_options(database, options) -adbc_database_release(database) +adbc_database_get_option(database, option) + +adbc_database_get_option_bytes(database, option) + +adbc_database_get_option_int(database, option) + +adbc_database_get_option_double(database, option) } \arguments{ \item{driver}{An \code{\link[=adbc_driver]{adbc_driver()}}.} @@ -28,6 +40,8 @@ to strings.} finer-grained control over behaviour at the R level.} \item{database}{An \link[=adbc_database_init]{adbc_database}.} + +\item{option}{A specific option name} } \value{ An object of class adbc_database diff --git a/r/adbcdrivermanager/man/adbc_error_from_array_stream.Rd b/r/adbcdrivermanager/man/adbc_error_from_array_stream.Rd new file mode 100644 index 0000000000..458c289429 --- /dev/null +++ b/r/adbcdrivermanager/man/adbc_error_from_array_stream.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/error.R +\name{adbc_error_from_array_stream} +\alias{adbc_error_from_array_stream} +\title{Get extended error information from an array stream} +\usage{ +adbc_error_from_array_stream(stream) +} +\arguments{ +\item{stream}{A \link[nanoarrow:as_nanoarrow_array_stream]{nanoarrow_array_stream}} +} +\value{ +\code{NULL} if stream was not created by a driver that supports +extended error information or a list whose first element is the +status code and second element is the \code{adbc_error} object. The +\code{acbc_error} must not be accessed if \code{stream} is explicitly released. +} +\description{ +Get extended error information from an array stream +} +\examples{ +db <- adbc_database_init(adbc_driver_monkey()) +con <- adbc_connection_init(db) +stmt <- adbc_statement_init(con, mtcars) +stream <- nanoarrow::nanoarrow_allocate_array_stream() +adbc_statement_execute_query(stmt, stream) +adbc_error_from_array_stream(stream) + +} diff --git a/r/adbcdrivermanager/man/adbc_statement_init.Rd b/r/adbcdrivermanager/man/adbc_statement_init.Rd index f951555dbe..75a728dd0f 100644 --- a/r/adbcdrivermanager/man/adbc_statement_init.Rd +++ b/r/adbcdrivermanager/man/adbc_statement_init.Rd @@ -1,19 +1,31 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/adbc.R +% Please edit documentation in R/adbc.R, R/options.R \name{adbc_statement_init} \alias{adbc_statement_init} \alias{adbc_statement_init_default} -\alias{adbc_statement_set_options} \alias{adbc_statement_release} +\alias{adbc_statement_set_options} +\alias{adbc_statement_get_option} +\alias{adbc_statement_get_option_bytes} +\alias{adbc_statement_get_option_int} +\alias{adbc_statement_get_option_double} \title{Statements} \usage{ adbc_statement_init(connection, ...) adbc_statement_init_default(connection, options = NULL, subclass = character()) +adbc_statement_release(statement) + adbc_statement_set_options(statement, options) -adbc_statement_release(statement) +adbc_statement_get_option(statement, option) + +adbc_statement_get_option_bytes(statement, option) + +adbc_statement_get_option_int(statement, option) + +adbc_statement_get_option_double(statement, option) } \arguments{ \item{connection}{An \link[=adbc_connection_init]{adbc_connection}} @@ -28,6 +40,8 @@ to strings.} finer-grained control over behaviour at the R level.} \item{statement}{An \link[=adbc_statement_init]{adbc_statement}} + +\item{option}{A specific option name} } \value{ An object of class 'adbc_statement' diff --git a/r/adbcdrivermanager/man/adbc_statement_set_sql_query.Rd b/r/adbcdrivermanager/man/adbc_statement_set_sql_query.Rd index 5102d81dda..ea955ddb2e 100644 --- a/r/adbcdrivermanager/man/adbc_statement_set_sql_query.Rd +++ b/r/adbcdrivermanager/man/adbc_statement_set_sql_query.Rd @@ -8,6 +8,7 @@ \alias{adbc_statement_bind} \alias{adbc_statement_bind_stream} \alias{adbc_statement_execute_query} +\alias{adbc_statement_execute_schema} \title{Statement methods} \usage{ adbc_statement_set_sql_query(statement, query) @@ -23,6 +24,8 @@ adbc_statement_bind(statement, values, schema = NULL) adbc_statement_bind_stream(statement, stream, schema = NULL) adbc_statement_execute_query(statement, stream = NULL) + +adbc_statement_execute_schema(statement) } \arguments{ \item{statement}{An \link[=adbc_statement_init]{adbc_statement}} diff --git a/r/adbcdrivermanager/src/error.cc b/r/adbcdrivermanager/src/error.cc index 79f8aaa162..ff24e89812 100644 --- a/r/adbcdrivermanager/src/error.cc +++ b/r/adbcdrivermanager/src/error.cc @@ -48,9 +48,28 @@ extern "C" SEXP RAdbcAllocateError(SEXP shelter_sexp) { return error_xptr; } +static SEXP wrap_error_details(AdbcError* error) { + int n_details = AdbcErrorGetDetailCount(error); + SEXP result_names = PROTECT(Rf_allocVector(STRSXP, n_details)); + SEXP result = PROTECT(Rf_allocVector(VECSXP, n_details)); + + for (int i = 0; i < n_details; i++) { + AdbcErrorDetail item = AdbcErrorGetDetail(error, i); + SET_STRING_ELT(result_names, i, Rf_mkCharCE(item.key, CE_UTF8)); + SEXP item_sexp = PROTECT(Rf_allocVector(RAWSXP, item.value_length)); + memcpy(RAW(item_sexp), item.value, item.value_length); + SET_VECTOR_ELT(result, i, item_sexp); + UNPROTECT(1); + } + + Rf_setAttrib(result, R_NamesSymbol, result_names); + UNPROTECT(2); + return result; +} + extern "C" SEXP RAdbcErrorProxy(SEXP error_xptr) { AdbcError* error = adbc_from_xptr(error_xptr); - const char* names[] = {"message", "vendor_code", "sqlstate", ""}; + const char* names[] = {"message", "vendor_code", "sqlstate", "details", ""}; SEXP result = PROTECT(Rf_mkNamed(VECSXP, names)); if (error->message != nullptr) { @@ -67,8 +86,38 @@ extern "C" SEXP RAdbcErrorProxy(SEXP error_xptr) { SEXP sqlstate = PROTECT(Rf_allocVector(RAWSXP, sizeof(error->sqlstate))); memcpy(RAW(sqlstate), error->sqlstate, sizeof(error->sqlstate)); SET_VECTOR_ELT(result, 2, sqlstate); + UNPROTECT(1); - UNPROTECT(2); + SEXP details = PROTECT(wrap_error_details(error)); + SET_VECTOR_ELT(result, 3, details); + UNPROTECT(1); + + UNPROTECT(1); + return result; +} + +extern "C" SEXP RAdbcErrorFromArrayStream(SEXP stream_xptr) { + struct ArrowArrayStream* stream = + reinterpret_cast(R_ExternalPtrAddr(stream_xptr)); + + AdbcStatusCode status = ADBC_STATUS_OK; + const AdbcError* error = AdbcErrorFromArrayStream(stream, &status); + if (error == nullptr) { + return R_NilValue; + } + + // Not using a normal error_xptr here because the lifecycle is managed by the stream. + // This logic won't survive accesses to the error following an explicit stream release; + // however will at least keep a stream from being released via the garbage collector. + SEXP error_xptr = + PROTECT(adbc_borrow_xptr(const_cast(error), stream_xptr)); + + SEXP status_sexp = PROTECT(adbc_wrap_status(status)); + + SEXP result = PROTECT(Rf_allocVector(VECSXP, 2)); + SET_VECTOR_ELT(result, 0, status_sexp); + SET_VECTOR_ELT(result, 1, error_xptr); + UNPROTECT(3); return result; } diff --git a/r/adbcdrivermanager/src/init.c b/r/adbcdrivermanager/src/init.c index 0d9f65e408..7c5ad3f28e 100644 --- a/r/adbcdrivermanager/src/init.c +++ b/r/adbcdrivermanager/src/init.c @@ -25,21 +25,54 @@ SEXP RAdbcMonkeyDriverInitFunc(void); SEXP RAdbcVoidDriverInitFunc(void); SEXP RAdbcAllocateError(SEXP shelter_sexp); SEXP RAdbcErrorProxy(SEXP error_xptr); +SEXP RAdbcErrorFromArrayStream(SEXP stream_xptr); SEXP RAdbcStatusCodeMessage(SEXP status_sexp); +SEXP RAdbcDatabaseSetOption(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcDatabaseSetOptionBytes(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcDatabaseSetOptionInt(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcDatabaseSetOptionDouble(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcConnectionSetOption(SEXP connection_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcConnectionSetOptionBytes(SEXP connection_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcConnectionSetOptionInt(SEXP connection_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcConnectionSetOptionDouble(SEXP connection_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcStatementSetOption(SEXP statement_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcStatementSetOptionBytes(SEXP statement_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcStatementSetOptionInt(SEXP statement_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcStatementSetOptionDouble(SEXP statement_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr); +SEXP RAdbcDatabaseGetOption(SEXP database_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcDatabaseGetOptionBytes(SEXP database_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcDatabaseGetOptionInt(SEXP database_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcDatabaseGetOptionDouble(SEXP database_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcConnectionGetOption(SEXP connection_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcConnectionGetOptionBytes(SEXP connection_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcConnectionGetOptionInt(SEXP connection_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcConnectionGetOptionDouble(SEXP connection_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcStatementGetOption(SEXP statement_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcStatementGetOptionBytes(SEXP statement_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcStatementGetOptionInt(SEXP statement_xptr, SEXP key_sexp, SEXP error_xptr); +SEXP RAdbcStatementGetOptionDouble(SEXP statement_xptr, SEXP key_sexp, SEXP error_xptr); SEXP RAdbcLoadDriver(SEXP driver_name_sexp, SEXP entrypoint_sexp); SEXP RAdbcLoadDriverFromInitFunc(SEXP driver_init_func_xptr); SEXP RAdbcDatabaseNew(SEXP driver_init_func_xptr); SEXP RAdbcMoveDatabase(SEXP database_xptr); SEXP RAdbcDatabaseValid(SEXP database_xptr); -SEXP RAdbcDatabaseSetOption(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, - SEXP error_xptr); SEXP RAdbcDatabaseInit(SEXP database_xptr, SEXP error_xptr); SEXP RAdbcDatabaseRelease(SEXP database_xptr, SEXP error_xptr); SEXP RAdbcConnectionNew(void); SEXP RAdbcMoveConnection(SEXP connection_xptr); SEXP RAdbcConnectionValid(SEXP connection_xptr); -SEXP RAdbcConnectionSetOption(SEXP connection_xptr, SEXP key_sexp, SEXP value_sexp, - SEXP error_xptr); SEXP RAdbcConnectionInit(SEXP connection_xptr, SEXP database_xptr, SEXP error_xptr); SEXP RAdbcConnectionRelease(SEXP connection_xptr, SEXP error_xptr); SEXP RAdbcConnectionGetInfo(SEXP connection_xptr, SEXP info_codes_sexp, @@ -57,11 +90,16 @@ SEXP RAdbcConnectionReadPartition(SEXP connection_xptr, SEXP serialized_partitio SEXP out_stream_xptr, SEXP error_xptr); SEXP RAdbcConnectionCommit(SEXP connection_xptr, SEXP error_xptr); SEXP RAdbcConnectionRollback(SEXP connection_xptr, SEXP error_xptr); +SEXP RAdbcConnectionCancel(SEXP connection_xptr, SEXP error_xptr); +SEXP RAdbcConnectionGetStatisticNames(SEXP connection_xptr, SEXP out_stream_xptr, + SEXP error_xptr); +SEXP RAdbcConnectionGetStatistics(SEXP connection_xptr, SEXP catalog_sexp, + SEXP db_schema_sexp, SEXP table_name_sexp, + SEXP approximate_sexp, SEXP out_stream_xptr, + SEXP error_xptr); SEXP RAdbcStatementNew(SEXP connection_xptr); SEXP RAdbcMoveStatement(SEXP statement_xptr); SEXP RAdbcStatementValid(SEXP statement_xptr); -SEXP RAdbcStatementSetOption(SEXP statement_xptr, SEXP key_sexp, SEXP value_sexp, - SEXP error_xptr); SEXP RAdbcStatementRelease(SEXP statement_xptr, SEXP error_xptr); SEXP RAdbcStatementSetSqlQuery(SEXP statement_xptr, SEXP query_sexp, SEXP error_xptr); SEXP RAdbcStatementSetSubstraitPlan(SEXP statement_xptr, SEXP plan_sexp, SEXP error_xptr); @@ -73,6 +111,8 @@ SEXP RAdbcStatementBind(SEXP statement_xptr, SEXP values_xptr, SEXP schema_xptr, SEXP RAdbcStatementBindStream(SEXP statement_xptr, SEXP stream_xptr, SEXP error_xptr); SEXP RAdbcStatementExecuteQuery(SEXP statement_xptr, SEXP out_stream_xptr, SEXP error_xptr); +SEXP RAdbcStatementExecuteSchema(SEXP statement_xptr, SEXP out_schema_xptr, + SEXP error_xptr); SEXP RAdbcStatementExecutePartitions(SEXP statement_xptr, SEXP out_schema_xptr, SEXP partitions_xptr, SEXP error_xptr); SEXP RAdbcXptrEnv(SEXP xptr); @@ -83,19 +123,42 @@ static const R_CallMethodDef CallEntries[] = { {"RAdbcVoidDriverInitFunc", (DL_FUNC)&RAdbcVoidDriverInitFunc, 0}, {"RAdbcAllocateError", (DL_FUNC)&RAdbcAllocateError, 1}, {"RAdbcErrorProxy", (DL_FUNC)&RAdbcErrorProxy, 1}, + {"RAdbcErrorFromArrayStream", (DL_FUNC)&RAdbcErrorFromArrayStream, 1}, {"RAdbcStatusCodeMessage", (DL_FUNC)&RAdbcStatusCodeMessage, 1}, + {"RAdbcDatabaseSetOption", (DL_FUNC)&RAdbcDatabaseSetOption, 4}, + {"RAdbcDatabaseSetOptionBytes", (DL_FUNC)&RAdbcDatabaseSetOptionBytes, 4}, + {"RAdbcDatabaseSetOptionInt", (DL_FUNC)&RAdbcDatabaseSetOptionInt, 4}, + {"RAdbcDatabaseSetOptionDouble", (DL_FUNC)&RAdbcDatabaseSetOptionDouble, 4}, + {"RAdbcConnectionSetOption", (DL_FUNC)&RAdbcConnectionSetOption, 4}, + {"RAdbcConnectionSetOptionBytes", (DL_FUNC)&RAdbcConnectionSetOptionBytes, 4}, + {"RAdbcConnectionSetOptionInt", (DL_FUNC)&RAdbcConnectionSetOptionInt, 4}, + {"RAdbcConnectionSetOptionDouble", (DL_FUNC)&RAdbcConnectionSetOptionDouble, 4}, + {"RAdbcStatementSetOption", (DL_FUNC)&RAdbcStatementSetOption, 4}, + {"RAdbcStatementSetOptionBytes", (DL_FUNC)&RAdbcStatementSetOptionBytes, 4}, + {"RAdbcStatementSetOptionInt", (DL_FUNC)&RAdbcStatementSetOptionInt, 4}, + {"RAdbcStatementSetOptionDouble", (DL_FUNC)&RAdbcStatementSetOptionDouble, 4}, + {"RAdbcDatabaseGetOption", (DL_FUNC)&RAdbcDatabaseGetOption, 3}, + {"RAdbcDatabaseGetOptionBytes", (DL_FUNC)&RAdbcDatabaseGetOptionBytes, 3}, + {"RAdbcDatabaseGetOptionInt", (DL_FUNC)&RAdbcDatabaseGetOptionInt, 3}, + {"RAdbcDatabaseGetOptionDouble", (DL_FUNC)&RAdbcDatabaseGetOptionDouble, 3}, + {"RAdbcConnectionGetOption", (DL_FUNC)&RAdbcConnectionGetOption, 3}, + {"RAdbcConnectionGetOptionBytes", (DL_FUNC)&RAdbcConnectionGetOptionBytes, 3}, + {"RAdbcConnectionGetOptionInt", (DL_FUNC)&RAdbcConnectionGetOptionInt, 3}, + {"RAdbcConnectionGetOptionDouble", (DL_FUNC)&RAdbcConnectionGetOptionDouble, 3}, + {"RAdbcStatementGetOption", (DL_FUNC)&RAdbcStatementGetOption, 3}, + {"RAdbcStatementGetOptionBytes", (DL_FUNC)&RAdbcStatementGetOptionBytes, 3}, + {"RAdbcStatementGetOptionInt", (DL_FUNC)&RAdbcStatementGetOptionInt, 3}, + {"RAdbcStatementGetOptionDouble", (DL_FUNC)&RAdbcStatementGetOptionDouble, 3}, {"RAdbcLoadDriver", (DL_FUNC)&RAdbcLoadDriver, 2}, {"RAdbcLoadDriverFromInitFunc", (DL_FUNC)&RAdbcLoadDriverFromInitFunc, 1}, {"RAdbcDatabaseNew", (DL_FUNC)&RAdbcDatabaseNew, 1}, {"RAdbcMoveDatabase", (DL_FUNC)&RAdbcMoveDatabase, 1}, {"RAdbcDatabaseValid", (DL_FUNC)&RAdbcDatabaseValid, 1}, - {"RAdbcDatabaseSetOption", (DL_FUNC)&RAdbcDatabaseSetOption, 4}, {"RAdbcDatabaseInit", (DL_FUNC)&RAdbcDatabaseInit, 2}, {"RAdbcDatabaseRelease", (DL_FUNC)&RAdbcDatabaseRelease, 2}, {"RAdbcConnectionNew", (DL_FUNC)&RAdbcConnectionNew, 0}, {"RAdbcMoveConnection", (DL_FUNC)&RAdbcMoveConnection, 1}, {"RAdbcConnectionValid", (DL_FUNC)&RAdbcConnectionValid, 1}, - {"RAdbcConnectionSetOption", (DL_FUNC)&RAdbcConnectionSetOption, 4}, {"RAdbcConnectionInit", (DL_FUNC)&RAdbcConnectionInit, 3}, {"RAdbcConnectionRelease", (DL_FUNC)&RAdbcConnectionRelease, 2}, {"RAdbcConnectionGetInfo", (DL_FUNC)&RAdbcConnectionGetInfo, 4}, @@ -105,10 +168,12 @@ static const R_CallMethodDef CallEntries[] = { {"RAdbcConnectionReadPartition", (DL_FUNC)&RAdbcConnectionReadPartition, 4}, {"RAdbcConnectionCommit", (DL_FUNC)&RAdbcConnectionCommit, 2}, {"RAdbcConnectionRollback", (DL_FUNC)&RAdbcConnectionRollback, 2}, + {"RAdbcConnectionCancel", (DL_FUNC)&RAdbcConnectionCancel, 2}, + {"RAdbcConnectionGetStatisticNames", (DL_FUNC)&RAdbcConnectionGetStatisticNames, 3}, + {"RAdbcConnectionGetStatistics", (DL_FUNC)&RAdbcConnectionGetStatistics, 7}, {"RAdbcStatementNew", (DL_FUNC)&RAdbcStatementNew, 1}, {"RAdbcMoveStatement", (DL_FUNC)&RAdbcMoveStatement, 1}, {"RAdbcStatementValid", (DL_FUNC)&RAdbcStatementValid, 1}, - {"RAdbcStatementSetOption", (DL_FUNC)&RAdbcStatementSetOption, 4}, {"RAdbcStatementRelease", (DL_FUNC)&RAdbcStatementRelease, 2}, {"RAdbcStatementSetSqlQuery", (DL_FUNC)&RAdbcStatementSetSqlQuery, 3}, {"RAdbcStatementSetSubstraitPlan", (DL_FUNC)&RAdbcStatementSetSubstraitPlan, 3}, @@ -117,6 +182,7 @@ static const R_CallMethodDef CallEntries[] = { {"RAdbcStatementBind", (DL_FUNC)&RAdbcStatementBind, 4}, {"RAdbcStatementBindStream", (DL_FUNC)&RAdbcStatementBindStream, 3}, {"RAdbcStatementExecuteQuery", (DL_FUNC)&RAdbcStatementExecuteQuery, 3}, + {"RAdbcStatementExecuteSchema", (DL_FUNC)&RAdbcStatementExecuteSchema, 3}, {"RAdbcStatementExecutePartitions", (DL_FUNC)&RAdbcStatementExecutePartitions, 4}, {"RAdbcXptrEnv", (DL_FUNC)&RAdbcXptrEnv, 1}, {NULL, NULL, 0}}; diff --git a/r/adbcdrivermanager/src/options.cc b/r/adbcdrivermanager/src/options.cc new file mode 100644 index 0000000000..377d633094 --- /dev/null +++ b/r/adbcdrivermanager/src/options.cc @@ -0,0 +1,272 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#define R_NO_REMAP +#include +#include + +#include + +#include "radbc.h" + +template +static inline T adbc_as_c(SEXP sexp); + +template <> +inline const char* adbc_as_c(SEXP sexp) { + return adbc_as_const_char(sexp); +} + +template <> +inline int64_t adbc_as_c(SEXP sexp) { + return adbc_as_int64(sexp); +} + +template <> +inline double adbc_as_c(SEXP sexp) { + return adbc_as_double(sexp); +} + +template +SEXP adbc_set_option(SEXP obj_xptr, SEXP key_sexp, SEXP value_sexp, SEXP error_xptr, + AdbcStatusCode (*SetOption)(T*, const char*, ValueT, AdbcError*)) { + auto obj = adbc_from_xptr(obj_xptr); + const char* key = adbc_as_const_char(key_sexp); + ValueT value = adbc_as_c(value_sexp); + auto error = adbc_from_xptr(error_xptr); + return adbc_wrap_status(SetOption(obj, key, value, error)); +} + +template +SEXP adbc_set_option_bytes(SEXP obj_xptr, SEXP key_sexp, SEXP value_sexp, SEXP error_xptr, + AdbcStatusCode (*SetOption)(T*, const char*, const uint8_t*, + size_t, AdbcError*)) { + auto obj = adbc_from_xptr(obj_xptr); + const char* key = adbc_as_const_char(key_sexp); + const uint8_t* value = RAW(value_sexp); + size_t value_length = Rf_xlength(value_sexp); + auto error = adbc_from_xptr(error_xptr); + + int status = SetOption(obj, key, value, value_length, error); + return adbc_wrap_status(status); +} + +extern "C" SEXP RAdbcDatabaseSetOption(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, + SEXP error_xptr) { + return adbc_set_option(database_xptr, key_sexp, value_sexp, + error_xptr, &AdbcDatabaseSetOption); +} + +extern "C" SEXP RAdbcDatabaseSetOptionBytes(SEXP database_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option_bytes(database_xptr, key_sexp, value_sexp, + error_xptr, &AdbcDatabaseSetOptionBytes); +} + +extern "C" SEXP RAdbcDatabaseSetOptionInt(SEXP database_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option(database_xptr, key_sexp, value_sexp, + error_xptr, &AdbcDatabaseSetOptionInt); +} + +extern "C" SEXP RAdbcDatabaseSetOptionDouble(SEXP database_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option(database_xptr, key_sexp, value_sexp, + error_xptr, &AdbcDatabaseSetOptionDouble); +} + +extern "C" SEXP RAdbcConnectionSetOption(SEXP connection_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option( + connection_xptr, key_sexp, value_sexp, error_xptr, &AdbcConnectionSetOption); +} + +extern "C" SEXP RAdbcConnectionSetOptionBytes(SEXP connection_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option_bytes(connection_xptr, key_sexp, value_sexp, + error_xptr, &AdbcConnectionSetOptionBytes); +} + +extern "C" SEXP RAdbcConnectionSetOptionInt(SEXP connection_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option( + connection_xptr, key_sexp, value_sexp, error_xptr, &AdbcConnectionSetOptionInt); +} + +extern "C" SEXP RAdbcConnectionSetOptionDouble(SEXP connection_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option( + connection_xptr, key_sexp, value_sexp, error_xptr, &AdbcConnectionSetOptionDouble); +} + +extern "C" SEXP RAdbcStatementSetOption(SEXP statement_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option(statement_xptr, key_sexp, value_sexp, + error_xptr, &AdbcStatementSetOption); +} + +extern "C" SEXP RAdbcStatementSetOptionBytes(SEXP statement_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option_bytes(statement_xptr, key_sexp, value_sexp, + error_xptr, &AdbcStatementSetOptionBytes); +} + +extern "C" SEXP RAdbcStatementSetOptionInt(SEXP statement_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option(statement_xptr, key_sexp, value_sexp, + error_xptr, &AdbcStatementSetOptionInt); +} + +extern "C" SEXP RAdbcStatementSetOptionDouble(SEXP statement_xptr, SEXP key_sexp, + SEXP value_sexp, SEXP error_xptr) { + return adbc_set_option( + statement_xptr, key_sexp, value_sexp, error_xptr, &AdbcStatementSetOptionDouble); +} + +template +static inline SEXP adbc_get_option_bytes(SEXP obj_xptr, SEXP key_sexp, SEXP error_xptr, + AdbcStatusCode (*GetOption)(T*, const char*, + CharT*, size_t*, + AdbcError*)) { + auto obj = adbc_from_xptr(obj_xptr); + const char* key = adbc_as_const_char(key_sexp); + auto error = adbc_from_xptr(error_xptr); + + size_t length = 0; + int status = GetOption(obj, key, nullptr, &length, error); + adbc_error_stop(status, error); + + SEXP result_shelter = PROTECT(Rf_allocVector(RAWSXP, length)); + auto result = reinterpret_cast(RAW(result_shelter)); + status = GetOption(obj, key, result, &length, error); + adbc_error_stop(status, error); + + UNPROTECT(1); + return result_shelter; +} + +template +static inline SEXP adbc_get_option(SEXP obj_xptr, SEXP key_sexp, SEXP error_xptr, + AdbcStatusCode (*GetOption)(T*, const char*, char*, + size_t*, AdbcError*)) { + SEXP bytes_sexp = + adbc_get_option_bytes(obj_xptr, key_sexp, error_xptr, GetOption); + PROTECT(bytes_sexp); + + char* result = reinterpret_cast(RAW(bytes_sexp)); + SEXP result_char = PROTECT(Rf_mkCharLenCE(result, Rf_length(bytes_sexp), CE_UTF8)); + SEXP result_string = PROTECT(Rf_ScalarString(result_char)); + UNPROTECT(3); + return result_string; +} + +static inline SEXP adbc_wrap(int64_t value) { + if (value <= NA_INTEGER || value >= INT_MAX) { + return Rf_ScalarReal(value); + } else { + return Rf_ScalarInteger(value); + } +} + +static inline SEXP adbc_wrap(double value) { return Rf_ScalarReal(value); } + +template +static inline SEXP adbc_get_option_numeric(SEXP obj_xptr, SEXP key_sexp, SEXP error_xptr, + AdbcStatusCode (*GetOption)(T*, const char*, + ResultT*, + AdbcError*)) { + auto obj = adbc_from_xptr(obj_xptr); + const char* key = adbc_as_const_char(key_sexp); + auto error = adbc_from_xptr(error_xptr); + + ResultT value = 0; + int status = GetOption(obj, key, &value, error); + adbc_error_stop(status, error); + return adbc_wrap(value); +} + +extern "C" SEXP RAdbcDatabaseGetOption(SEXP database_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option(database_xptr, key_sexp, error_xptr, + &AdbcDatabaseGetOption); +} + +extern "C" SEXP RAdbcDatabaseGetOptionBytes(SEXP database_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_bytes(database_xptr, key_sexp, error_xptr, + &AdbcDatabaseGetOptionBytes); +} + +extern "C" SEXP RAdbcDatabaseGetOptionInt(SEXP database_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_numeric( + database_xptr, key_sexp, error_xptr, &AdbcDatabaseGetOptionInt); +} + +extern "C" SEXP RAdbcDatabaseGetOptionDouble(SEXP database_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_numeric( + database_xptr, key_sexp, error_xptr, &AdbcDatabaseGetOptionDouble); +} + +extern "C" SEXP RAdbcConnectionGetOption(SEXP connection_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option(connection_xptr, key_sexp, error_xptr, + &AdbcConnectionGetOption); +} + +extern "C" SEXP RAdbcConnectionGetOptionBytes(SEXP connection_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_bytes( + connection_xptr, key_sexp, error_xptr, &AdbcConnectionGetOptionBytes); +} + +extern "C" SEXP RAdbcConnectionGetOptionInt(SEXP connection_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_numeric( + connection_xptr, key_sexp, error_xptr, &AdbcConnectionGetOptionInt); +} + +extern "C" SEXP RAdbcConnectionGetOptionDouble(SEXP connection_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_numeric( + connection_xptr, key_sexp, error_xptr, &AdbcConnectionGetOptionDouble); +} + +extern "C" SEXP RAdbcStatementGetOption(SEXP statement_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option(statement_xptr, key_sexp, error_xptr, + &AdbcStatementGetOption); +} + +extern "C" SEXP RAdbcStatementGetOptionBytes(SEXP statement_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_bytes( + statement_xptr, key_sexp, error_xptr, &AdbcStatementGetOptionBytes); +} + +extern "C" SEXP RAdbcStatementGetOptionInt(SEXP statement_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_numeric( + statement_xptr, key_sexp, error_xptr, &AdbcStatementGetOptionInt); +} + +extern "C" SEXP RAdbcStatementGetOptionDouble(SEXP statement_xptr, SEXP key_sexp, + SEXP error_xptr) { + return adbc_get_option_numeric( + statement_xptr, key_sexp, error_xptr, &AdbcStatementGetOptionDouble); +} diff --git a/r/adbcdrivermanager/src/radbc.cc b/r/adbcdrivermanager/src/radbc.cc index f5afdd9d85..fb271296e4 100644 --- a/r/adbcdrivermanager/src/radbc.cc +++ b/r/adbcdrivermanager/src/radbc.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include "adbc_driver_manager.h" @@ -40,12 +41,6 @@ static void adbc_error_warn(int code, AdbcError* error, const char* context) { } } -static void adbc_error_stop(int code, AdbcError* error, const char* context) { - if (code != ADBC_STATUS_OK) { - Rf_error("<%s> %s", context, adbc_error_message(error)); - } -} - static void finalize_driver_xptr(SEXP driver_xptr) { auto driver = reinterpret_cast(R_ExternalPtrAddr(driver_xptr)); if (driver == nullptr) { @@ -135,7 +130,7 @@ extern "C" SEXP RAdbcDatabaseNew(SEXP driver_init_func_xptr) { AdbcError error; memset(&error, 0, sizeof(AdbcError)); int status = AdbcDatabaseNew(database, &error); - adbc_error_stop(status, &error, "RAdbcDatabaseNew()"); + adbc_error_stop(status, &error); if (driver_init_func_xptr != R_NilValue) { auto driver_init_func = @@ -145,7 +140,7 @@ extern "C" SEXP RAdbcDatabaseNew(SEXP driver_init_func_xptr) { } status = AdbcDriverManagerDatabaseSetInitFunc(database, driver_init_func, &error); - adbc_error_stop(status, &error, "RAdbcDatabaseNew()"); + adbc_error_stop(status, &error); } UNPROTECT(1); @@ -167,19 +162,10 @@ extern "C" SEXP RAdbcMoveDatabase(SEXP database_xptr) { } extern "C" SEXP RAdbcDatabaseValid(SEXP database_xptr) { - AdbcDatabase* database = adbc_from_xptr(database_xptr, true); + AdbcDatabase* database = adbc_from_xptr(database_xptr, /*nullable=*/true); return Rf_ScalarLogical(database != nullptr && database->private_data != nullptr); } -extern "C" SEXP RAdbcDatabaseSetOption(SEXP database_xptr, SEXP key_sexp, SEXP value_sexp, - SEXP error_xptr) { - auto database = adbc_from_xptr(database_xptr); - const char* key = adbc_as_const_char(key_sexp); - const char* value = adbc_as_const_char(value_sexp); - auto error = adbc_from_xptr(error_xptr); - return adbc_wrap_status(AdbcDatabaseSetOption(database, key, value, error)); -} - extern "C" SEXP RAdbcDatabaseInit(SEXP database_xptr, SEXP error_xptr) { auto database = adbc_from_xptr(database_xptr); auto error = adbc_from_xptr(error_xptr); @@ -218,7 +204,7 @@ extern "C" SEXP RAdbcConnectionNew(void) { AdbcError error; memset(&error, 0, sizeof(AdbcError)); int status = AdbcConnectionNew(connection, &error); - adbc_error_stop(status, &error, "RAdbcConnectionNew()"); + adbc_error_stop(status, &error); UNPROTECT(1); return connection_xptr; @@ -239,19 +225,11 @@ extern "C" SEXP RAdbcMoveConnection(SEXP connection_xptr) { } extern "C" SEXP RAdbcConnectionValid(SEXP connection_xptr) { - AdbcConnection* connection = adbc_from_xptr(connection_xptr, true); + AdbcConnection* connection = + adbc_from_xptr(connection_xptr, /*nullable=*/true); return Rf_ScalarLogical(connection != nullptr && connection->private_data != nullptr); } -extern "C" SEXP RAdbcConnectionSetOption(SEXP connection_xptr, SEXP key_sexp, - SEXP value_sexp, SEXP error_xptr) { - auto connection = adbc_from_xptr(connection_xptr); - const char* key = adbc_as_const_char(key_sexp); - const char* value = adbc_as_const_char(value_sexp); - auto error = adbc_from_xptr(error_xptr); - return adbc_wrap_status(AdbcConnectionSetOption(connection, key, value, error)); -} - extern "C" SEXP RAdbcConnectionInit(SEXP connection_xptr, SEXP database_xptr, SEXP error_xptr) { auto connection = adbc_from_xptr(connection_xptr); @@ -280,10 +258,13 @@ extern "C" SEXP RAdbcConnectionGetInfo(SEXP connection_xptr, SEXP info_codes_sex auto connection = adbc_from_xptr(connection_xptr); auto error = adbc_from_xptr(error_xptr); auto out_stream = adbc_from_xptr(out_stream_xptr); - auto info_codes = reinterpret_cast(INTEGER(info_codes_sexp)); + std::pair info_codes = adbc_as_int_list(info_codes_sexp); + PROTECT(info_codes.first); size_t info_codes_length = Rf_xlength(info_codes_sexp); int status = - AdbcConnectionGetInfo(connection, info_codes, info_codes_length, out_stream, error); + AdbcConnectionGetInfo(connection, reinterpret_cast(info_codes.second), + info_codes_length, out_stream, error); + UNPROTECT(1); return adbc_wrap_status(status); } @@ -294,36 +275,19 @@ extern "C" SEXP RAdbcConnectionGetObjects(SEXP connection_xptr, SEXP depth_sexp, SEXP error_xptr) { auto connection = adbc_from_xptr(connection_xptr); int depth = adbc_as_int(depth_sexp); - const char* catalog = adbc_as_const_char(catalog_sexp, true); - const char* db_schema = adbc_as_const_char(db_schema_sexp, true); - const char* table_name = adbc_as_const_char(table_name_sexp, true); - - // Build the null-terminated const char** used to filter by table type - int table_type_length = Rf_length(table_type_sexp); - SEXP table_type_shelter = - PROTECT(Rf_allocVector(RAWSXP, (table_type_length + 1) * sizeof(const char*))); - auto table_type = reinterpret_cast(RAW(table_type_shelter)); - for (int i = 0; i < table_type_length; i++) { - table_type[i] = Rf_translateCharUTF8(STRING_ELT(table_type_sexp, i)); - } - table_type[table_type_length] = nullptr; - - // Ensure that R_NilValue maps to null and not a null-termianted const char** - // of length 0. - const char** table_type_maybe_null; - if (table_type_sexp == R_NilValue) { - table_type_maybe_null = nullptr; - } else { - table_type_maybe_null = table_type; - } + const char* catalog = adbc_as_const_char(catalog_sexp, /*nullable=*/true); + const char* db_schema = adbc_as_const_char(db_schema_sexp, /*nullable=*/true); + const char* table_name = adbc_as_const_char(table_name_sexp, /*nullable=*/true); + std::pair table_type = adbc_as_const_char_list(table_type_sexp); + PROTECT(table_type.first); - const char* column_name = adbc_as_const_char(column_name_sexp, true); + const char* column_name = adbc_as_const_char(column_name_sexp, /*nullable=*/true); auto out_stream = adbc_from_xptr(out_stream_xptr); auto error = adbc_from_xptr(error_xptr); int status = AdbcConnectionGetObjects(connection, depth, catalog, db_schema, table_name, - table_type_maybe_null, column_name, out_stream, error); + table_type.second, column_name, out_stream, error); UNPROTECT(1); return adbc_wrap_status(status); } @@ -332,8 +296,8 @@ extern "C" SEXP RAdbcConnectionGetTableSchema(SEXP connection_xptr, SEXP catalog SEXP db_schema_sexp, SEXP table_name_sexp, SEXP schema_xptr, SEXP error_xptr) { auto connection = adbc_from_xptr(connection_xptr); - const char* catalog = adbc_as_const_char(catalog_sexp); - const char* db_schema = adbc_as_const_char(db_schema_sexp); + const char* catalog = adbc_as_const_char(catalog_sexp, /*nullable=*/true); + const char* db_schema = adbc_as_const_char(db_schema_sexp, /*nullable=*/true); const char* table_name = adbc_as_const_char(table_name_sexp); auto schema = adbc_from_xptr(schema_xptr); auto error = adbc_from_xptr(error_xptr); @@ -377,7 +341,41 @@ extern "C" SEXP RAdbcConnectionCommit(SEXP connection_xptr, SEXP error_xptr) { extern "C" SEXP RAdbcConnectionRollback(SEXP connection_xptr, SEXP error_xptr) { auto connection = adbc_from_xptr(connection_xptr); auto error = adbc_from_xptr(error_xptr); - int status = AdbcConnectionCommit(connection, error); + int status = AdbcConnectionRollback(connection, error); + return adbc_wrap_status(status); +} + +extern "C" SEXP RAdbcConnectionCancel(SEXP connection_xptr, SEXP error_xptr) { + auto connection = adbc_from_xptr(connection_xptr); + auto error = adbc_from_xptr(error_xptr); + int status = AdbcConnectionCancel(connection, error); + return adbc_wrap_status(status); +} + +extern "C" SEXP RAdbcConnectionGetStatisticNames(SEXP connection_xptr, + SEXP out_stream_xptr, SEXP error_xptr) { + auto connection = adbc_from_xptr(connection_xptr); + auto out_stream = adbc_from_xptr(out_stream_xptr); + auto error = adbc_from_xptr(error_xptr); + + int status = AdbcConnectionGetStatisticNames(connection, out_stream, error); + return adbc_wrap_status(status); +} + +extern "C" SEXP RAdbcConnectionGetStatistics(SEXP connection_xptr, SEXP catalog_sexp, + SEXP db_schema_sexp, SEXP table_name_sexp, + SEXP approximate_sexp, SEXP out_stream_xptr, + SEXP error_xptr) { + auto connection = adbc_from_xptr(connection_xptr); + const char* catalog = adbc_as_const_char(catalog_sexp, /*nullable=*/true); + const char* db_schema = adbc_as_const_char(db_schema_sexp, /*nullable=*/true); + const char* table_name = adbc_as_const_char(table_name_sexp); + char approximate = adbc_as_bool(approximate_sexp); + auto out_stream = adbc_from_xptr(out_stream_xptr); + auto error = adbc_from_xptr(error_xptr); + + int status = AdbcConnectionGetStatistics(connection, catalog, db_schema, table_name, + approximate, out_stream, error); return adbc_wrap_status(status); } @@ -407,7 +405,7 @@ extern "C" SEXP RAdbcStatementNew(SEXP connection_xptr) { AdbcError error; memset(&error, 0, sizeof(AdbcError)); int status = AdbcStatementNew(connection, statement, &error); - adbc_error_stop(status, &error, "RAdbcStatementNew()"); + adbc_error_stop(status, &error); R_SetExternalPtrProtected(statement_xptr, connection_xptr); @@ -430,19 +428,11 @@ extern "C" SEXP RAdbcMoveStatement(SEXP statement_xptr) { } extern "C" SEXP RAdbcStatementValid(SEXP statement_xptr) { - AdbcStatement* statement = adbc_from_xptr(statement_xptr, true); + AdbcStatement* statement = + adbc_from_xptr(statement_xptr, /*nullable=*/true); return Rf_ScalarLogical(statement != nullptr && statement->private_data != nullptr); } -extern "C" SEXP RAdbcStatementSetOption(SEXP statement_xptr, SEXP key_sexp, - SEXP value_sexp, SEXP error_xptr) { - auto statement = adbc_from_xptr(statement_xptr); - const char* key = adbc_as_const_char(key_sexp); - const char* value = adbc_as_const_char(value_sexp); - auto error = adbc_from_xptr(error_xptr); - return adbc_wrap_status(AdbcStatementSetOption(statement, key, value, error)); -} - extern "C" SEXP RAdbcStatementRelease(SEXP statement_xptr, SEXP error_xptr) { auto statement = adbc_from_xptr(statement_xptr); auto error = adbc_from_xptr(error_xptr); @@ -537,6 +527,16 @@ extern "C" SEXP RAdbcStatementExecuteQuery(SEXP statement_xptr, SEXP out_stream_ return result; } +extern "C" SEXP RAdbcStatementExecuteSchema(SEXP statement_xptr, SEXP out_schema_xptr, + SEXP error_xptr) { + auto statement = adbc_from_xptr(statement_xptr); + auto out_schema = adbc_from_xptr(out_schema_xptr); + auto error = adbc_from_xptr(error_xptr); + + int status = AdbcStatementExecuteSchema(statement, out_schema, error); + return adbc_wrap_status(status); +} + extern "C" SEXP RAdbcStatementExecutePartitions(SEXP statement_xptr, SEXP out_schema_xptr, SEXP partitions_xptr, SEXP error_xptr) { return adbc_wrap_status(ADBC_STATUS_NOT_IMPLEMENTED); diff --git a/r/adbcdrivermanager/src/radbc.h b/r/adbcdrivermanager/src/radbc.h index 9c20686d90..27772802ad 100644 --- a/r/adbcdrivermanager/src/radbc.h +++ b/r/adbcdrivermanager/src/radbc.h @@ -20,6 +20,8 @@ #include #include +#include + template static inline const char* adbc_xptr_class(); @@ -77,13 +79,7 @@ static inline T* adbc_from_xptr(SEXP xptr, bool null_ok = false) { } template -static inline SEXP adbc_allocate_xptr(SEXP shelter_sexp = R_NilValue) { - void* ptr = malloc(sizeof(T)); - if (ptr == nullptr) { - Rf_error("Failed to allocate T"); - } - - memset(ptr, 0, sizeof(T)); +static inline SEXP adbc_borrow_xptr(T* ptr, SEXP shelter_sexp = R_NilValue) { SEXP xptr = PROTECT(R_MakeExternalPtr(ptr, R_NilValue, shelter_sexp)); SEXP xptr_class = PROTECT(Rf_allocVector(STRSXP, 2)); SET_STRING_ELT(xptr_class, 0, Rf_mkChar(adbc_xptr_class())); @@ -103,6 +99,17 @@ static inline SEXP adbc_allocate_xptr(SEXP shelter_sexp = R_NilValue) { return xptr; } +template +static inline SEXP adbc_allocate_xptr(SEXP shelter_sexp = R_NilValue) { + void* ptr = malloc(sizeof(T)); + if (ptr == nullptr) { + Rf_error("Failed to allocate T"); + } + + memset(ptr, 0, sizeof(T)); + return adbc_borrow_xptr(reinterpret_cast(ptr), shelter_sexp); +} + template static inline void adbc_xptr_default_finalize(SEXP xptr) { T* ptr = reinterpret_cast(R_ExternalPtrAddr(xptr)); @@ -136,6 +143,10 @@ static inline const char* adbc_as_const_char(SEXP sexp, bool nullable = false) { return nullptr; } + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to const char*"); + } + if (TYPEOF(sexp) != STRSXP || Rf_length(sexp) != 1) { Rf_error("Expected character(1) for conversion to const char*"); } @@ -149,18 +160,187 @@ static inline const char* adbc_as_const_char(SEXP sexp, bool nullable = false) { } static inline int adbc_as_int(SEXP sexp) { + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to int"); + } + + if (Rf_length(sexp) == 1) { + switch (TYPEOF(sexp)) { + case REALSXP: { + double value = REAL(sexp)[0]; + if (!R_finite(value)) { + Rf_error("Can't convert non-finite double(1) to int"); + } + + return value; + } + + case INTSXP: + case LGLSXP: + // NA is OK here (or should be handled by the caller for a specific ADBC method) + return INTEGER(sexp)[0]; + } + } + + Rf_error("Expected integer(1) or double(1) for conversion to int"); +} + +static inline bool adbc_as_bool(SEXP sexp) { + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to bool"); + } + + if (Rf_length(sexp) == 1) { + switch (TYPEOF(sexp)) { + case REALSXP: { + double value = REAL(sexp)[0]; + if (!R_finite(value)) { + Rf_error("Can't convert non-finite double(1) to bool"); + } + + return value != 0; + } + + case INTSXP: + case LGLSXP: { + int value = INTEGER(sexp)[0]; + if (value == NA_INTEGER) { + Rf_error("Can't convert NA to bool"); + } + + return value != 0; + } + } + } + + Rf_error("Expected integer(1) or double(1) for conversion to int"); +} + +static inline int64_t adbc_as_int64(SEXP sexp) { + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to int64"); + } + + if (Rf_length(sexp) == 1) { + switch (TYPEOF(sexp)) { + case REALSXP: { + double value = REAL(sexp)[0]; + if (!R_finite(value)) { + Rf_error("Can't convert non-finite double(1) to int64"); + } + + return value; + } + + case INTSXP: + case LGLSXP: + return INTEGER(sexp)[0]; + } + } + + Rf_error("Expected integer(1) or double(1) for conversion to int64"); +} + +static inline double adbc_as_double(SEXP sexp) { + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to double"); + } + if (Rf_length(sexp) == 1) { switch (TYPEOF(sexp)) { case REALSXP: return REAL(sexp)[0]; case INTSXP: + case LGLSXP: return INTEGER(sexp)[0]; } } - Rf_error("Expected integer(1) or double(1) for conversion to int"); + Rf_error("Expected integer(1) or double(1) for conversion to double"); +} + +static inline std::pair adbc_as_const_char_list(SEXP sexp) { + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to const char**"); + } + + switch (TYPEOF(sexp)) { + case NILSXP: + return {R_NilValue, nullptr}; + case STRSXP: + break; + default: + Rf_error("Expected character() for conversion to const char**"); + } + + int sexp_length = Rf_length(sexp); + SEXP result_shelter = + PROTECT(Rf_allocVector(RAWSXP, (sexp_length + 1) * sizeof(const char*))); + auto result = reinterpret_cast(RAW(result_shelter)); + for (int i = 0; i < sexp_length; i++) { + SEXP item = STRING_ELT(sexp, i); + if (item == NA_STRING) { + Rf_error("Can't convert NA_character_ element to const char*"); + } + + result[i] = Rf_translateCharUTF8(STRING_ELT(sexp, i)); + } + result[sexp_length] = nullptr; + UNPROTECT(1); + return {result_shelter, result}; +} + +static inline std::pair adbc_as_int_list(SEXP sexp) { + if (Rf_isObject(sexp)) { + Rf_error("Can't convert classed object to int*"); + } + + int result_length = Rf_length(sexp); + + switch (TYPEOF(sexp)) { + case NILSXP: + return {R_NilValue, nullptr}; + + case INTSXP: { + int* result = INTEGER(sexp); + // NA is OK here (otherwise it would be hard to work around a driver that + // maybe used INT_MIN as a sentinel for something) + return {sexp, result}; + } + + case REALSXP: { + SEXP result_shelter = PROTECT(Rf_allocVector(INTSXP, result_length)); + int* result = INTEGER(result_shelter); + for (int i = 0; i < result_length; i++) { + double item = REAL(sexp)[i]; + if (!R_finite(item)) { + Rf_error("Can't convert non-finite element to int"); + } + + result[i] = item; + } + + UNPROTECT(1); + return {result_shelter, result}; + } + + default: + Rf_error("Expected integer() or double() for conversion to int*"); + } } static inline SEXP adbc_wrap_status(AdbcStatusCode code) { return Rf_ScalarInteger(code); } + +static inline void adbc_error_stop(int code, AdbcError* error) { + SEXP status_sexp = PROTECT(adbc_wrap_status(code)); + SEXP error_xptr = PROTECT(adbc_borrow_xptr(error)); + + SEXP fun_sym = PROTECT(Rf_install("stop_for_error")); + SEXP fun_call = PROTECT(Rf_lang3(fun_sym, status_sexp, error_xptr)); + SEXP pkg_chr = PROTECT(Rf_mkString("adbcdrivermanager")); + SEXP pkg_ns = PROTECT(R_FindNamespace(pkg_chr)); + Rf_eval(fun_call, pkg_ns); + UNPROTECT(6); +} diff --git a/r/adbcdrivermanager/tests/testthat/test-error.R b/r/adbcdrivermanager/tests/testthat/test-error.R index e6b1cc182b..15a9c21e61 100644 --- a/r/adbcdrivermanager/tests/testthat/test-error.R +++ b/r/adbcdrivermanager/tests/testthat/test-error.R @@ -15,17 +15,31 @@ # specific language governing permissions and limitations # under the License. +test_that("adbc_error_from_array_stream() errors for invalid streams", { + stream <- nanoarrow::nanoarrow_allocate_array_stream() + expect_error( + adbc_error_from_array_stream(stream), + "must be a valid nanoarrow_array_stream" + ) +}) + +test_that("adbc_error_from_array_stream() returns NULL for unrelated streams", { + stream <- nanoarrow::basic_array_stream(list(1:5)) + expect_null(adbc_error_from_array_stream(stream)) +}) + test_that("error allocator works", { err <- adbc_allocate_error() expect_s3_class(err, "adbc_error") expect_output(expect_identical(print(err), err), "adbc_error") expect_output(expect_identical(str(err), err), "adbc_error") - expect_identical(length(err), 3L) - expect_identical(names(err), c("message", "vendor_code", "sqlstate")) + expect_identical(length(err), 4L) + expect_identical(names(err), c("message", "vendor_code", "sqlstate", "details")) expect_null(err$message) expect_identical(err$vendor_code, 0L) expect_identical(err$sqlstate, as.raw(c(0x00, 0x00, 0x00, 0x00, 0x00))) + expect_identical(err$details, setNames(list(), character())) }) test_that("stop_for_error() gives a custom error class with extra info", { diff --git a/r/adbcdrivermanager/tests/testthat/test-options.R b/r/adbcdrivermanager/tests/testthat/test-options.R new file mode 100644 index 0000000000..74ad63e811 --- /dev/null +++ b/r/adbcdrivermanager/tests/testthat/test-options.R @@ -0,0 +1,90 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +test_that("get option methods work on a database for the void driver", { + db <- adbc_database_init(adbc_driver_void()) + expect_error( + adbc_database_get_option(db, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_database_get_option_bytes(db, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_database_get_option_int(db, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_database_get_option_double(db, "some_key"), + class = "adbc_status_not_found" + ) +}) + +test_that("get option methods work on a connection for the void driver", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) + + expect_error( + adbc_connection_get_option(con, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_connection_get_option_bytes(con, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_connection_get_option_int(con, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_connection_get_option_double(con, "some_key"), + class = "adbc_status_not_found" + ) +}) + +test_that("get option methods work on a statment for the void driver", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) + stmt <- adbc_statement_init(con) + + expect_error( + adbc_statement_get_option(stmt, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_statement_get_option_bytes(stmt, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_statement_get_option_int(stmt, "some_key"), + class = "adbc_status_not_found" + ) + + expect_error( + adbc_statement_get_option_double(stmt, "some_key"), + class = "adbc_status_not_found" + ) +}) diff --git a/r/adbcdrivermanager/tests/testthat/test-radbc.R b/r/adbcdrivermanager/tests/testthat/test-radbc.R index 1ee836604f..b332e711e3 100644 --- a/r/adbcdrivermanager/tests/testthat/test-radbc.R +++ b/r/adbcdrivermanager/tests/testthat/test-radbc.R @@ -39,6 +39,23 @@ test_that("connection methods work for the void driver", { "NOT_IMPLEMENTED" ) + expect_error( + adbc_connection_get_info(con, double()), + "NOT_IMPLEMENTED" + ) + + expect_error( + adbc_connection_get_info(con, NULL), + "NOT_IMPLEMENTED" + ) + + # With defaults of NULL/OL + expect_error( + adbc_connection_get_objects(con), + "NOT_IMPLEMENTED" + ) + + # With explicit args expect_error( adbc_connection_get_objects( con, 0, @@ -76,6 +93,21 @@ test_that("connection methods work for the void driver", { con ) + expect_identical( + adbc_connection_cancel(con), + con + ) + + expect_error( + adbc_connection_get_statistic_names(con), + "NOT_IMPLEMENTED" + ) + + expect_error( + adbc_connection_get_statistics(con, NULL, NULL, "table name"), + "NOT_IMPLEMENTED" + ) + expect_identical( adbc_connection_quote_identifier(con, 'some"identifier'), '"some""identifier"' @@ -136,9 +168,14 @@ test_that("statement methods work for the void driver", { adbc_statement_execute_query(stmt), "NOT_IMPLEMENTED" ) + + expect_error( + adbc_statement_execute_schema(stmt), + "NOT_IMPLEMENTED" + ) }) -test_that("invalid parameter types generate errors", { +test_that("invalid external pointer inputs generate errors", { db <- adbc_database_init(adbc_driver_void()) con <- adbc_connection_init(db) stmt <- adbc_statement_init(con) @@ -153,31 +190,131 @@ test_that("invalid parameter types generate errors", { "Expected external pointer with class 'adbc_statement'" ) + # (makes a NULL xptr) + stmt2 <- unserialize(serialize(stmt, NULL)) + expect_error( + adbc_statement_set_sql_query(stmt2, "some query"), + "Can't convert external pointer to NULL to T*" + ) +}) + +test_that("invalid integer inputs generate errors", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) + expect_error( - adbc_connection_get_objects( - con, NULL, - "catalog", "db_schema", - "table_name", "table_type", "column_name" - ), + adbc_connection_get_objects(con, depth = "abc"), "Expected integer(1) or double(1)", fixed = TRUE ) expect_error( - adbc_statement_set_sql_query(stmt, NULL), - "Expected character(1)", + adbc_connection_get_objects(con, depth = 1:5), + "Expected integer(1) or double(1)", fixed = TRUE ) + expect_error( + adbc_connection_get_objects(con, structure(1L, class = "non-empty")), + "Can't convert classed object" + ) + + expect_error( + adbc_connection_get_objects(con, NA_real_), + "Can't convert non-finite" + ) +}) + +test_that("invalid int list inputs generate errors", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) + + expect_error( + adbc_connection_get_info(con, character()), + "Expected integer" + ) + + expect_error( + adbc_connection_get_info(con, structure(integer(), class = "non-empty")), + "Can't convert classed object" + ) + + expect_error( + adbc_connection_get_info(con, NA_real_), + "Can't convert non-finite element" + ) +}) + +test_that("invalid const char* list inputs generate errors", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) + + expect_error( + adbc_connection_get_objects( + con, + table_type = integer() + ), + "Expected character" + ) + + expect_error( + adbc_connection_get_objects( + con, + table_type = NA_character_ + ), + "Can't convert NA_character_ element" + ) + + expect_error( + adbc_connection_get_objects( + con, + table_type = structure("abc", class = "non-empty") + ), + "Can't convert classed object" + ) +}) + +test_that("invalid const char* inputs generate errors", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) + stmt <- adbc_statement_init(con) + + expect_error( + adbc_statement_set_sql_query(stmt, NULL), + "Expected character" + ) + + expect_error( + adbc_statement_set_sql_query(stmt, structure("abc", class = "non-empty")), + "Can't convert classed object to const char" + ) + expect_error( adbc_statement_set_sql_query(stmt, NA_character_), "Can't convert NA_character_" ) +}) + +test_that("invalid bool inputs generate errors", { + db <- adbc_database_init(adbc_driver_void()) + con <- adbc_connection_init(db) - # (makes a NULL xptr) - stmt2 <- unserialize(serialize(stmt, NULL)) expect_error( - adbc_statement_set_sql_query(stmt2, "some query"), - "Can't convert external pointer to NULL to T*" + adbc_connection_get_statistics(con, NULL, NULL, "table name", character()), + "Expected integer(1) or double(1)", + fixed = TRUE + ) + + expect_error( + adbc_connection_get_statistics(con, NULL, NULL, "table name", NA), + "Can't convert NA to bool" + ) + + expect_error( + adbc_connection_get_statistics( + con, NULL, NULL, "table name", + structure(TRUE, class = "non-empty") + ), + "Can't convert classed object to bool" ) }) diff --git a/r/adbcpostgresql/src/.gitignore b/r/adbcpostgresql/src/.gitignore index cd8318e2e9..44d84da682 100644 --- a/r/adbcpostgresql/src/.gitignore +++ b/r/adbcpostgresql/src/.gitignore @@ -31,4 +31,6 @@ statement.cc postgres_type.h postgres_copy_reader.h postgres_util.h +result_helper.h +result_helper.cc Makevars diff --git a/r/adbcpostgresql/src/common/.gitignore b/r/adbcpostgresql/src/common/.gitignore index 4c355d6bd4..10c3978702 100644 --- a/r/adbcpostgresql/src/common/.gitignore +++ b/r/adbcpostgresql/src/common/.gitignore @@ -17,3 +17,4 @@ utils.c utils.h +options.h diff --git a/r/adbcsnowflake/DESCRIPTION b/r/adbcsnowflake/DESCRIPTION index 7ab2a38b54..8b4a5d255d 100644 --- a/r/adbcsnowflake/DESCRIPTION +++ b/r/adbcsnowflake/DESCRIPTION @@ -17,6 +17,7 @@ Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 Suggests: + arrow, nanoarrow, testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/r/adbcsqlite/src/common/.gitignore b/r/adbcsqlite/src/common/.gitignore index 4c355d6bd4..10c3978702 100644 --- a/r/adbcsqlite/src/common/.gitignore +++ b/r/adbcsqlite/src/common/.gitignore @@ -17,3 +17,4 @@ utils.c utils.h +options.h