Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-3353

Non data-type related schema changes errors

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.5.0
    • Component/s: Storage - JSON
    • Labels:
      None

      Description

      I'm having trouble querying a data set with varying schema for a nested object fields. The majority of my data for a specific type of record has the following nested data:

      "attributes":{"daysSinceInstall":0,"destination":"none","logged":"no","nth":1,"type":"organic","wearable":"no"}}
      

      Among those records (hundreds of them) I have only two with a slightly different schema:

      "attributes":{"adSet":"Teste-Adwords-Engagement-Branch-iOS-230615-adset","campaign":"Teste-Adwords-Engagement-Branch-iOS-230615","channel":"Adwords","daysSinceInstall":0,"destination":"none","logged":"no","nth":4,"type":"branch","wearable":"no"}}
      

      When trying to query the "new" fields, my queries fail:

      With

      ALTER SYSTEM SET `store.json.all_text_mode` = true;
      0: jdbc:drill:zk=local> select log.event.attributes from `dfs`.`root`.`/file.json` as log where log.si = '07A3F985-4B34-4A01-9B83-3B14548EF7BE' and log.event.attributes.ad = 'Teste-FB-Engagement-Puro-iOS-230615';
      Error: SYSTEM ERROR: java.lang.NumberFormatException: Teste-FB-Engagement-Puro-iOS-230615"
      
      Fragment 0:0
      
      [Error Id: 22d37a65-7dd0-4661-bbfc-7a50bbee9388 on ip-10-0-1-16.sa-east-1.compute.internal:31010] (state=,code=0)
      

      With

      ALTER SYSTEM SET `store.json.all_text_mode` = false;`
      0: jdbc:drill:zk=local> select log.event.attributes from `dfs`.`root`.`/file.json` as log where log.si = '07A3F985-4B34-4A01-9B83-3B14548EF7BE';
      Error: DATA_READ ERROR: Error parsing JSON - You tried to write a Bit type when you are using a ValueWriter of type NullableVarCharWriterImpl.
      
      File  file.json
      Record  35
      Fragment 0:0
      
      [Error Id: 5746e3e9-48c0-44b1-8e5f-7c94e7c64d0f on ip-10-0-1-16.sa-east-1.compute.internal:31010] (state=,code=0)
      

      If I try to extract all "attributes" from those events, Drill will only return a subset of the fields, ignoring the others.

      0: jdbc:drill:zk=local> select log.event.attributes from `dfs`.`root`.`/file.json` as log where log.si = '07A3F985-4B34-4A01-9B83-3B14548EF7BE' and log.type ='Opens App';
      +----------------------------------------------------+
      |                       EXPR$0                       |
      +----------------------------------------------------+
      | {"logged":"no","wearable":"no","type":"xxxx"}   |
      | {"logged":"no","wearable":"no","type":"xxxx"}  |
      | {"logged":"no","wearable":"no","type":"xxxx"}  |
      | {"logged":"no","wearable":"no","type":"xxxx"}    |
      | {"logged":"no","wearable":"no","type":"xxxx"}   |
      +----------------------------------------------------+
      

      What I find strange is that I have thousands of records in the same file with different schema for different record types and all other queries seem run well.

      Is there something about how Drill infers schema that I might be missing here? Does it infer based on a sample % of the data and fail for records that were not taken into account while inferring schema? I suspect I wouldn't have this error if I had 100's of records with that other schema inside the file, but I can't find anything in the docs or code to support that hypothesis. Perhaps it's just a bug? Is it expected?

      Troubleshooting guide seems to mention something about this but it's very vague in implying Drill doesn't fully support schema changes. I thought that was for data type changes mostly, for which there are other well documented issues.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sphillips Steven Phillips
                Reporter:
                obernal Oscar Bernal
                Reviewer:
                Chun Chang
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: