Hello,

When two column names collide in a join, the user is forced to change the
name of one of the columns for the join to be valid. However, if those
columns are primary keys such as "id", won't that therefore change the key
used to reference the state in RockDB and in a checkpoint for the
associated table? How might this effect state storage and checkpointing?
Will the pk that was renamed remain a key for state or is some other
mechanism used to form a key?

My example

as you can see, I alter "id" to . This is because the following code must
join two tables which both have PK "id".

tableEnv.executeSql("""
CREATE TABLE topic_users (
id BIGINT,
deleted_at BIGINT,
PRIMARY KEY (id) NOT ENFORCED
) WITH (
...
)
""")
val usersNotDeletedTable =
tableEnv
.from("topic_users")
.select($"*")
// Will PK automatically change to "users_user_id"?
.renameColumns($"id".as("users_user_id"))
.filter($"deleted_at".isNull)

val membershipsNotDeletedTable =
membershipsTable // This table also has "id" PK
.join(
usersNotDeletedTable,
$"user_id" === $"users_user_id"
)
.dropColumns($"users_user_id")

Thanks!

-- 

Rex Fenley  |  Software Engineer - Mobile and Backend


Remind.com <https://www.remind.com/> |  BLOG <http://blog.remind.com/>
 |  FOLLOW
US <https://twitter.com/remindhq>  |  LIKE US
<https://www.facebook.com/remindhq>

Reply via email to