GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Apache Avro library failed to parse file - when uploading avro file · Issue #1379 · googleapis/google-cloud-node

Apache Avro library failed to parse file - when uploading avro file  #1379

New issue
Copy link
New issue
Copy link
Closed
Closed
Apache Avro library failed to parse file - when uploading avro file #1379
Copy link
Assignees
stephenplusplus
Labels
api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@DinaWork
DinaWork
opened on Jun 13, 2016
Issue body actions

here is a reference to the issue
http://stackoverflow.com/questions/37790813/apache-avro-library-failed-to-parse-file-nodejs

also had to add avro formats in gcloud/lib/bigquery files.

 var formats = {
    csv: 'CSV',
    json: 'NEWLINE_DELIMITED_JSON',
    avro: 'AVRO' /// added by me 
  };

Activity

  1. stephenplusplus
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: bigqueryIssues related to the BigQuery API.
    on Jun 13, 2016
  2. stephenplusplus commented on Jun 13, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 13, 2016
    Contributor
    More actions

    Thanks for the bug catch-- PR incoming. I think the problem you're having is because you're uploading the actual zip file. You'll have to extract the .avro file first before BigQuery can handle it.

  3. stephenplusplus commented on Jun 13, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 13, 2016
    Contributor
    More actions

    Also, in case you find it useful, we have a built-in event emitter to the Job object:

    job
      .on('error', console.log)
      .on('complete', function(metadata) {
        console.log('job completed', metadata);
      });
  4. DinaWork commented on Jun 13, 2016

    @DinaWork
    DinaWork
    on Jun 13, 2016
    Author
    More actions

    no, It isn't the zip file.. I extracted it..
    I attached it here...

    On Mon, Jun 13, 2016 at 5:45 PM, Stephen Sawchuk [email protected]
    wrote:

    Thanks for the bug catch-- PR incoming. I think the problem you're having
    is because you're uploading the actual zip file. You'll have to extract the
    .avro file first before BigQuery can handle it.

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #1379 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/ARWSndrgU0sCdYLMbgNwxu4RiyhANEvTks5qLW0MgaJpZM4I0YOj
    .

  5. stephenplusplus commented on Jun 13, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 13, 2016
    Contributor
    More actions

    Okay, sorry that I missed that. After making the fix you pointed out to add support for AVRO files, I was able to import the .avro file successfully:

    fs.createReadStream('./local-avro-file.avro')
      .pipe(table.createWriteStream(metadata))
      .on('complete', function(job) {
        job
          .on('error', console.log)
          .on('complete', function(metadata) {
            console.log('job completed', metadata);
          });
      });

    Can you try it this way to help track down where the problem is coming from?

  6. stephenplusplus commented on Jun 13, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 13, 2016
    Contributor
    More actions

    PR sent with the AVRO fix: #1380.

  7. DinaWork commented on Jun 13, 2016

    @DinaWork
    DinaWork
    on Jun 13, 2016
    Author
    More actions

    Yes, it works now. Thanks!!
    Though I still have some open issues:

    a) This works only for a table which has the same schema,
    But when trying to upload to an empty table with no schema - it doesn't
    work.

    b) In general: how do I use gcloud for uploading jsons with their schema -
    to a new table (documentation isn't clear enough)

    On Mon, Jun 13, 2016 at 6:20 PM, Stephen Sawchuk [email protected]
    wrote:

    PR sent with the AVRO fix: #1380
    #1380.

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #1379 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/ARWSnXtNIKE11AU3Gfc-vbhN1mTrSTJLks5qLXVYgaJpZM4I0YOj
    .

  8. stephenplusplus commented on Jun 13, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 13, 2016
    Contributor
    More actions

    A) Good question. The official API request we make when uploading to a new table is Jobs: insert, specifically a load operation. The request body is outlined here, and the description for schema:

    configuration.load.schema | nested object | [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.

    The UI handles detecting a schema from the AVRO file when dumping to a new table, so I'm not sure why we aren't able to reproduce the same behavior.

    B) I'm not sure those can be done in a single operation. I believe the table has to first be created before loading data. If I took your question too literally, and you just want to know how to load JSON data into an empty table, it should look like this:

    table.import('./data.json', {
      schema: 'name:string, servings:integer, cookingTime:float, quick:boolean'
    }, function(err) {});

    If you want the schema inferred from the JSON file itself, it seems like that's either not supported by the API or we're using it wrong.

    @jgeewax anyone from BigQuery who can help with these questions?

  9. stephenplusplus commented on Jun 27, 2016

    @stephenplusplus
    stephenplusplus
    on Jun 27, 2016
    Contributor
    More actions

    @DinaWork - do you mind taking this question to StackOverflow? I think the right eyes from BigQuery members will be able to see it over there, this channel must be off their radar. Please cross-link in your post. I'll be sure to implement any changes to make how we're using BigQuery better for users.

  10. stephenplusplus
    closed this as completedon Jun 27, 2016
  11. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  12. miguelvelezsa
    added 2 commits that reference this issue on Jul 23, 2025

    fix: include Long import in d.ts files (#1379)

    628d9bf

    chore(main): release 3.5.5 (#1416)

    aa46733
  13. sofisl
    added a commit that references this issue on Feb 24, 2026

    chore: simplify Bulk Writer (#1379)

    cfe76d2
  14. GautamSharda
    added a commit that references this issue on Mar 11, 2026

    chore: release 2.16.5 (#1379)

    6f53e7f
  15. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    fix: improve retry logic for streaming API calls (#1372)

    8aaffa1

    fix: improve retry logic for streaming API calls (#1372)

    4c2ce16
  16. feywind
    added a commit that references this issue on Mar 27, 2026

    chore: release 2.16.5 (#1379)

    92895dd
  17. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    fix: improve retry logic for streaming API calls (#1372)

    78bca2d
  18. thiyaguk09
    added a commit that references this issue on May 5, 2026

    fix: improve retry logic for streaming API calls (googleapis#1372)

    4bb2003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

Labels

api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.