Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.3k stars 1.96k forks source link

[BUG]Schema inferrence in Cosmos DB Spark connector maps empty array incorrectly to string #35353

Open FabianMeiswinkel opened 1 year ago

FabianMeiswinkel commented 1 year ago

Describe the bug Document in Cosmos DB - when querying with schema inferrence creates a schema that has NotActions/DataActions/NotDataActions as String - not Array[String]

In Spark 2 this was inferred correctly.

{
    "RoleDefinition": {
        "ApplicationId": "797f4846-ba00-4fd7-ba43-dac1f8f63013",
        "NormalizedName": "Something",
        "NormalizedScopes": [
            "/SUBSCRIPTIONS/0A7BA347-E33A-4DFB-BB7A-63A9E1730819/"
        ],
        "Description": "description",
        "DataLayerProperty": {
            "CreatedTime": "2017-06-16T01:23:27.9974669Z",
            "ChangedTime": "2017-06-16T01:23:28.0615756Z",
            "DeletedTime": "1970-01-01T00:00:00Z",
            "DataStore": "Local"
        },
        "Metadata": {
            "CreatedBy": "3b0b2a7e-4f29-4b5a-8bf1-041799650f9f",
            "CreatedOn": "2018-12-07T01:08:25.5777023Z",
            "UpdatedBy": "3b0b2a7e-4f29-4b5a-8bf1-041799650f9f",
            "UpdatedOn": "2018-12-07T01:08:25.5777023Z"
        },
        "IsBuiltIn": false,
        "AdminSecurityClaim": null,
        "Id": "8424c5fea9794d91b33a2ce9d9a19d0f",
        "Name": "Role1",
        "IsServiceRole": false,
        "Permissions": [
            {
                "Actions": [
                    "Microsoft.Storage/storageAccounts/read"
                ],
                "NotActions": [],
                "DataActions": [],
                "NotDataActions": [],
                "Condition": null
            }
        ],
        "Scopes": [
            "subscriptions/0a7ba347-e33a-4dfb-bb7a-63a9e1730819"
        ]
    },
    "PartitionKey": "a4d1b191c1af4cefa14bf670e0beea52:797f4846ba004fd7ba43dac1f8f63013",
    "DataType": 1,
    "id": "f5a95f0c-76f2-4cb9-b507-588a7907c6c3",
    "_rid": "CCllAKMbIiEBAAAAAAAAAA==",
    "_self": "dbs/CCllAA==/colls/CCllAKMbIiE=/docs/CCllAKMbIiEBAAAAAAAAAA==/",
    "_etag": "\"0000d839-0000-0700-0000-64804da20000\"",
    "_attachments": "attachments/",
    "_ts": 1686130082
}

Exception or Stack Trace Add the exception log and stack trace if available

To Reproduce Steps to reproduce the behavior:

Code Snippet Add the code snippet that causes the issue.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

kushagraThapar commented 6 months ago

@tvaron3 please take a look at this, thanks!