opensearch-project / opensearch-project/sql
[BUG] Opensearch returns null for all columns not listed in GROUP BY statement
Open
@dai-chen is already working on this.
Since Dec 14, 2022.
tdvt
- Dominant language
- Java
- Stars
- 176
- Forks
- 229
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 43
Description
Describe the bug
Opensearch returns null for all columns not listed in GROUP BY statement
To Reproduce
Steps to reproduce the behavior:
- Upload the test data using attached files or generate on your own
curl -s -H 'Content-Type: application/x-ndjson' -XPUT 'https://localhost:9200/calcs?pretty' -u admin:admin --insecure --data-binary @calcs_mappings.json
curl -s -H 'Content-Type: application/x-ndjson' -XPOST 'https://localhost:9200/calcs/_bulk?pretty' -u admin:admin --insecure --data-binary @calcs.json | grep -i error
See below for data sample:
opensearchsql> select `key` as KK, int1, bool0 from calcs;
fetched rows / total rows = 17/17
+-------+--------+---------+
| KK | int1 | bool0 |
|-------+--------+---------|
| key00 | -3 | True |
| key01 | -6 | False |
| key02 | null | null |
| key04 | null | False |
| key05 | null | null |
| key06 | null | True |
| key08 | 3 | null |
| key09 | 3 | null |
| key10 | null | True |
| key15 | null | False |
| key03 | -4 | True |
| key07 | 2 | False |
| key11 | -8 | False |
| key12 | null | null |
| key13 | null | null |
| key14 | null | True |
| key16 | -9 | null |
+-------+--------+---------+
- Execute a query with
GROUP BYstatement
opensearchsql> select `key` as KK, int1 from calcs GROUP BY bool0;
fetched rows / total rows = 3/3
+------+--------+
| KK | int1 |
|------+--------|
| null | null |
| null | null |
| null | null |
+------+--------+
Expected behavior
In this very specific query at least key column shouldn't be empty (filled by nulls)
Plugins
The default set:
curl "localhost:9200/_cat/plugins?h=component&pretty=true"
mapper-murmur3
opensearch-alerting
opensearch-anomaly-detection
opensearch-asynchronous-search
opensearch-index-management
opensearch-job-scheduler
opensearch-knn
opensearch-notebooks
opensearch-performance-analyzer
opensearch-reports-scheduler
opensearch-security
opensearch-sql
Host/Environment (please complete the following information):
Docker container v.1.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.