Incubator-superset: Queries with nested fields for presto fail with " 'The number of data values and number of nestedfields are not equal'"

Created on 27 Sep 2019  路  5Comments  路  Source: apache/incubator-superset

A clear and concise description of what the bug is.
When querying a deeply nested field in presto, a "The number of data values and number of nestedfields are not equal'" error.
This appears related to http://mail-archives.apache.org/mod_mbox/superset-notifications/201905.mbox/%3C155925893590.16760.17217802552102811180.gitbox@gitbox.apache.org%3E

Expected results

The data

Actual results

Exception: 'The number of data values and number of nestedfields are not equal'

Screenshots

If applicable, add screenshots to help explain your problem.

How to reproduce the bug

  1. Query a deeply nested field (a row of array of row) in sql lab
  2. If the rows have different shape, i.e. one is null, the other has data only the shape of the first row determines the data.
  3. The code comes from ./superset/db_engine_specs/presto.py in the _expand_row_data function.

Environment

(please complete the following information):

  • superset version: 0.34.1rc1
  • python version: python --version 3.6
  • node.js version: node -v
  • npm version: npm -v

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • [X ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [ X] I have reproduced the issue with at least the latest released version of superset.
  • [ X] I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Add any other context about the problem here.

#bug inactive

All 5 comments

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.93. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

I patched our local deployment with the following in the function mentioned above:
Replaced

            if row_data and len(row_data) != len(row_children):
                raise Exception(
                    "The number of data values and number of nested"
                    "fields are not equal"
                )

with

if row_data and len(row_data) != len(row_children):
                for index, data_value in enumerate(row_data):
                    if index >= len(row_children):
                        row_children.append("col_{}".format(index))
                    datum[row_children[index]] = data_value

Hi @elonazoulay - feel free to contribute that fix back to core. Thanks for digging in!

Sure, I'll submit a pr for that:)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

Was this page helpful?
0 / 5 - 0 ratings