Skip to content

[BUG] implicit join returns wrong results #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Yury-Fridlyand opened this issue Jul 11, 2022 · 0 comments
Open

[BUG] implicit join returns wrong results #683

Yury-Fridlyand opened this issue Jul 11, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Yury-Fridlyand
Copy link
Collaborator

A query with implicit join returns very strange results:

  • column names
  • column list
  • rows number
opensearchsql> select * from logs, location limit 1;
Output longer than terminal width
Do you want to display data vertically for better visual effect? [y/N]: y
fetched rows / total rows = 1/10000
-[ RECORD 1 ]-------------------------
request   | null
referer   | null
agent     | null
extension | null
memory    | null
utc_time  | null
clientip  | null
host      | null
phpmemory | null
timestamp | null
ip        | null
index     | null
message   | null
url       | null
tags      | null
bytes     | null
response  | null
                               | null
                               | null
                               | null

opensearchsql> select * from location,logs limit 1;
fetched rows / total rows = 1/10000
+---------------+
| description   |
|---------------|
| square        |
+---------------+

Table (index) content:

opensearchsql> select * from location;
fetched rows / total rows = 2/2
+---------------+----------------------------+
| description   | center                     |
|---------------+----------------------------|
| square        | {'lat': 0.5, 'lon': 100.5} |
| bigSquare     | {'lat': 5.0, 'lon': 105.0} |
+---------------+----------------------------+

opensearchsql> select * from logs limit 1;
Output longer than terminal width
Do you want to display data vertically for better visual effect? [y/N]: y
fetched rows / total rows = 1/1
-[ RECORD 1 ]-------------------------
referer   | http://twitter.com/success/wendy-lawrence
request   | /opensearch/opensearch-1.0.0.deb
agent     | Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1
extension | deb
memory    | null
geo       | {'srcdest': 'IN:US', 'src': 'IN', 'coordinates': {'lat': 39.41042861, 'lon': -88.8454325}, 'dest': 'US'}
utc_time  | 2018-07-22 00:39:02.912
clientip  | 223.87.60.27
host      | artifacts.opensearch.org
event     | {'dataset': 'sample_web_logs'}
phpmemory | null
timestamp | 2018-07-22 00:39:02.912
ip        | 223.87.60.27
index     | opensearch_dashboards_sample_data_logs
message   | 223.87.60.27 - - [2018-07-22T00:39:02.912Z] "GET /opensearch/opensearch-1.0.0.deb_1 HTTP/1.1" 200 6219 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Fir>
url       | https://artifacts.opensearch.org/downloads/opensearch/opensearch-1.0.0.deb_1
tags      | success
bytes     | 6219
machine   | {'os': 'win 8', 'ram': 8589934592}
response  | 200

Table (index) size:

opensearchsql> select count(*) from location limit 1;
fetched rows / total rows = 1/1
+------------+
| count(*)   |
|------------|
| 2          |
+------------+

opensearchsql> select count(*) from logs limit 1;
fetched rows / total rows = 1/1
+------------+
| count(*)   |
|------------|
| 14074      |
+------------+

Test data
Logs table is taken from Kibana:
logs_mappings.json.txt
logs.json.txt
And location table from SQL integration tests:
location_index_mapping.json.txt
location.json.txt
Upload script:

curl -XDELETE 'http://localhost:9200/logs' -u admin:admin --insecure
curl -XDELETE 'http://localhost:9200/location' -u admin:admin --insecure
curl -s -H 'Content-Type: application/x-ndjson' -XPUT 'http://localhost:9200/logs?pretty' -u admin:admin --insecure --data-binary @logs_mappings.json.txt
curl -s -H 'Content-Type: application/x-ndjson' -XPOST 'http://localhost:9200/logs/_bulk?pretty' -u admin:admin --insecure --data-binary @logs.json.txt | grep -i error
curl -s -H 'Content-Type: application/x-ndjson' -XPUT 'http://localhost:9200/location?pretty' -u admin:admin --insecure --data-binary @location_index_mapping.json.txt
curl -s -H 'Content-Type: application/x-ndjson' -XPOST 'http://localhost:9200/location/_bulk?pretty' -u admin:admin --insecure --data-binary @location.json.txt | grep -i error

What is your host/environment?

  • OpenSearch: 388c80ad
  • Plugin: 8751994
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants