Joins don't work when one table has only one column
See original GitHub issueHi guys! I’m trying to do an inner join on simple tables:
val table1 = Table.create(
"table1",
StringColumn.create("customer_id", arrayOf("1", "2", "3", "4", "5")),
DoubleColumn.create("amount", arrayOf(1, 2, 3, 4, 5))
)
val table2 = Table.create(
"table2",
DoubleColumn.create("amount", arrayOf(1, 2, 3, 4, 5))
)
val joined = table1
.join("amount")
.inner(table2, "amount")
log(table1.shape())
log(table2.shape())
log(joined.shape())
and here is result:
2018-09-06 17:17:39,117 [main] INFO Script - 5 rows X 2 cols
2018-09-06 17:17:39,117 [main] INFO Script - 5 rows X 1 cols
2018-09-06 17:17:39,117 [main] INFO Script - 0 rows X 2 cols
The table is empty. Am i doing it wrong? I’m using v0.25.2
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
How to join only one column? - mysql - Stack Overflow
I need to join only one column from table 2, say first_name. How can I do that? mysql · join · Share.
Read more >SQL joins and how to use them - Launch School
A RIGHT JOIN is similar to a LEFT JOIN except that the roles between the two tables are reversed, and all the rows...
Read more >Can you Join two Tables Without a Common Column?
Yes, you can ! The longer answer is yes, there are a few ways to combine two tables without a common column, including...
Read more >Working with Joins - Snowflake Documentation
A natural join is used when two tables contain columns that have the same name and in which the data in those columns...
Read more >Joins (SQL Server) - Microsoft Learn
The SELECT list is not required to contain columns from every table in the join. For example, in a three-table join, only one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is this a real case? It doesn’t seem too useful unless you’re using the join as a filtering mechanism.
On the surface, this seems like a bug to me. We changed our parsing logic recently and that may have introduced something, but autodetection does not always work out of the box.
To check whether it’s a bug, it would be helpful to get a sample of a few lines of the file. Is that possible?
When autodetection does not work in general, there are a few work arounds.
In this case, again, I suspect this is a bug of some kind since it’s trying to parse a date (or date time, I can’t tell without the data) and the value looks like a date.
I found this surprising and I think it is worth fixing.
People familiar with SQL will always assume
SELECT * FROM table1 INNER JOIN table2
will equalSELECT * FROM table2 INNER JOIN table1
. This is currently not true when the only columns in the right hand side table are the join columns.