-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add query
table function for query pass-through to Cassandra connector
#15973
Conversation
094257d
to
9a6a0d4
Compare
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraSplitManager.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraTableHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraTableHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraTableHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java
Outdated
Show resolved
Hide resolved
@@ -37,20 +37,24 @@ | |||
public class TestJsonCassandraHandles | |||
{ | |||
private static final Map<String, Object> TABLE_HANDLE_AS_MAP = ImmutableMap.of( | |||
"schemaName", "cassandra_schema", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a follow up - can we use assertJsonRoundTrip
for testing these handles ?
plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java
Show resolved
Hide resolved
Addressed comments. |
650d3aa
to
176e091
Compare
@@ -119,16 +125,31 @@ public CassandraTableHandle getTableHandle(ConnectorSession session, SchemaTable | |||
|
|||
private static SchemaTableName getTableName(ConnectorTableHandle tableHandle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no changes requested : Maybe as a followup - can we inline the method - we could do the cast operation in method which invokes this one.
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/ptf/Query.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/ptf/Query.java
Show resolved
Hide resolved
onCassandra("CREATE TABLE " + tableName + "(col BIGINT PRIMARY KEY)"); | ||
|
||
onCassandra("INSERT INTO " + tableName + "(col) VALUES (1)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use testTable
so we don't have to have a dedicated query executor for cassandra and we don't have to drop the table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that TestCassandraTable
doesn't support single column with primary key. Using onCassandra
is simpler than TestCassandraTable
style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case can we move dropping operations to finally
block ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we use onCassandra
at a some places - Can we add support for TestCassandraTable
with a single column primary key ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me handle in follow-up PR.
plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraTableHandle.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraSplitManager.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraSplitManager.java
Outdated
Show resolved
Hide resolved
@@ -270,7 +270,7 @@ public CassandraTable getTable(SchemaTableName schemaTableName) | |||
.sorted(comparing(CassandraColumnHandle::getOrdinalPosition)) | |||
.collect(toList()); | |||
|
|||
CassandraTableHandle tableHandle = new CassandraTableHandle(tableMeta.getKeyspace().asInternal(), tableMeta.getName().asInternal()); | |||
CassandraTableHandle tableHandle = new CassandraTableHandle(new CassandraNamedRelationHandle(tableMeta.getKeyspace().asInternal(), tableMeta.getName().asInternal())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your opinion on returning as CassandraNamedRelationHandle
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently CassandraTable
has two fields - CassandraTableHandle
and List<CassandraColumnHandle
. CassandraTableHandle
is wrapper for both named and query based relation - which might be an overkill here. Instead can we have something like this
public CassandraTable(CassandraNamedRelationHandle tableHandle, List<CassandraColumnHandle> columns)
Just thinking out aloud.
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraRecordCursor.java
Show resolved
Hide resolved
176e091
to
45cb706
Compare
Addressed comments. |
I found a correctness issue when duplicated columns exist with different cases. e.g. col & COL. I'm fixing the issue now. |
This is needed for upcoming query pass-through function.
45cb706
to
38fb388
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Minor comments. Thanks for working on this.
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java
Outdated
Show resolved
Hide resolved
plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraMetadata.java
Outdated
Show resolved
Hide resolved
@@ -270,7 +270,7 @@ public CassandraTable getTable(SchemaTableName schemaTableName) | |||
.sorted(comparing(CassandraColumnHandle::getOrdinalPosition)) | |||
.collect(toList()); | |||
|
|||
CassandraTableHandle tableHandle = new CassandraTableHandle(tableMeta.getKeyspace().asInternal(), tableMeta.getName().asInternal()); | |||
CassandraTableHandle tableHandle = new CassandraTableHandle(new CassandraNamedRelationHandle(tableMeta.getKeyspace().asInternal(), tableMeta.getName().asInternal())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently CassandraTable
has two fields - CassandraTableHandle
and List<CassandraColumnHandle
. CassandraTableHandle
is wrapper for both named and query based relation - which might be an overkill here. Instead can we have something like this
public CassandraTable(CassandraNamedRelationHandle tableHandle, List<CassandraColumnHandle> columns)
Just thinking out aloud.
onCassandra("CREATE TABLE " + tableName + "(col BIGINT PRIMARY KEY)"); | ||
|
||
onCassandra("INSERT INTO " + tableName + "(col) VALUES (1)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case can we move dropping operations to finally
block ?
plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java
Show resolved
Hide resolved
onCassandra("CREATE TABLE " + tableName + "(col BIGINT PRIMARY KEY)"); | ||
|
||
onCassandra("INSERT INTO " + tableName + "(col) VALUES (1)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we use onCassandra
at a some places - Can we add support for TestCassandraTable
with a single column primary key ?
plugin/trino-cassandra/src/test/java/io/trino/plugin/cassandra/TestCassandraConnectorTest.java
Show resolved
Hide resolved
38fb388
to
f825e49
Compare
Description
Add
query
table function for query pass-through to Cassandra connectorRelease notes
(x) Release notes are required, with the following suggested text: