Skip to content

Invalid query results when querying with non-existent column #6143

@lgo

Description

@lgo

While testing some results, I accidentally used the wrong name to refer to a column. When querying, rather than raising an error the query actually returned but with 0 results, as shown below. This isn't a big deal, but is a usability hiccup that can be pretty confusion when adhoc querying Pinot.

Query
Note: amount does not exist on the table. This was meant to be balance!

select count(*), sum(amount) from adjustments where type = 'foobar'

Result

{
  "resultTable": {
    "dataSchema": {
      "columnNames": [
        "count(*)",
        "sum(amount)"
      ],
      "columnDataTypes": [
        "LONG",
        "DOUBLE"
      ]
    },
    "rows": [
      [
        0,
        0
      ]
    ]
  },
  "exceptions": [],
  "numServersQueried": ...,
  "numServersResponded": ...,
  "numSegmentsQueried": ...,
  "numSegmentsProcessed": 0,
  "numSegmentsMatched": 0,
  "numConsumingSegmentsQueried": 0,
  "numDocsScanned": 0,
  "numEntriesScannedInFilter": 0,
  "numEntriesScannedPostFilter": 0,
  "numGroupsLimitReached": false,
  "totalDocs": ...,
  "timeUsedMs": 10,
  "segmentStatistics": [],
  "traceInfo": {},
  "minConsumingFreshnessTimeMs": 0
}

Here is a simplified example configuration we were using, in case this ends up being particular about the table config. (irrelevant columns were prunted from the example).

Schema

{
  "schemaName": "adjustment",
  "dimensionFieldSpecs": [
    {
      "name": "type",
      "dataType": "STRING"
    },
  ],
  "metricFieldSpecs": [
    {
      "name": "balance",
      "dataType": "DOUBLE"
    },
  ],
  "dateTimeFieldSpecs": [
    {
      "name": "created_at",
      "dataType": "LONG",
      "format": "1:SECONDS:EPOCH",
      "granularity": "1:HOURS"
    }
  ]
}

Table config

{
  "OFFLINE": {
    "tableName": "adjustment_OFFLINE",
    "tableType": "OFFLINE",
    "segmentsConfig": {
      "timeType": "SECONDS",
      "schemaName": "adjustment",
      "segmentPushFrequency": "HOURLY",
      "segmentPushType": "APPEND",
      "timeColumnName": "created_at",
      "replication": "1"
    },
    "tenants": {
      "broker": "DefaultTenant",
      "server": "DefaultTenant"
    },
    "tableIndexConfig": {
      "bloomFilterColumns": [
        "type"
      ],
      "loadMode": "MMAP",
      "noDictionaryColumns": [],
      "enableDefaultStarTree": false,
      "starTreeIndexConfigs": [
        {
          "dimensionsSplitOrder": [
            "type",
          ],
          "functionColumnPairs": [
            "SUM__balance",
            "COUNT"
          ],
          "maxLeafRecords": 1
        }
      ],
      "enableDynamicStarTreeCreation": false,
      "segmentPartitionConfig": {
        "columnPartitionMap": {
          "type": {
            "functionName": "Murmur",
            "numPartitions": 100
          }
        }
      },
      "aggregateMetrics": false,
      "nullHandlingEnabled": false,
      "invertedIndexColumns": [
        "type"
      ],
      "autoGeneratedInvertedIndex": false,
      "createInvertedIndexDuringSegmentGeneration": false
    },
    "metadata": {},
    "routing": {
      "segmentPrunerTypes": [
        "partition"
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions