-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add coordinator implementation of CLP connector. #15
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
Changes from 8 commits
f4391c1
93e9bfe
0431bb7
98ce665
889dea6
6873557
657c9ad
70f07dd
996d67c
75fea65
1b51c3f
2f0424d
50fded9
20c1539
a3b7cb7
12f2515
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| <?xml version="1.0"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>com.facebook.presto</groupId> | ||
| <artifactId>presto-root</artifactId> | ||
| <version>0.293</version> | ||
| </parent> | ||
|
|
||
| <artifactId>presto-clp</artifactId> | ||
| <description>Presto - CLP Connector</description> | ||
| <packaging>presto-plugin</packaging> | ||
|
|
||
| <properties> | ||
| <air.main.basedir>${project.parent.basedir}</air.main.basedir> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.mysql</groupId> | ||
| <artifactId>mysql-connector-j</artifactId> | ||
| <scope>runtime</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.airlift</groupId> | ||
| <artifactId>bootstrap</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.airlift</groupId> | ||
| <artifactId>json</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.airlift</groupId> | ||
| <artifactId>log</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.airlift</groupId> | ||
| <artifactId>configuration</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.inject</groupId> | ||
| <artifactId>guice</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.guava</groupId> | ||
| <artifactId>guava</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>javax.inject</groupId> | ||
| <artifactId>javax.inject</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-annotations</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.presto</groupId> | ||
| <artifactId>presto-spi</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.presto</groupId> | ||
| <artifactId>presto-common</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>units</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.airlift</groupId> | ||
| <artifactId>slice</artifactId> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.testng</groupId> | ||
| <artifactId>testng</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.presto</groupId> | ||
| <artifactId>presto-main-base</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.presto</groupId> | ||
| <artifactId>presto-analyzer</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.h2database</groupId> | ||
| <artifactId>h2</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.facebook.presto</groupId> | ||
| <artifactId>presto-parser</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.apache.commons</groupId> | ||
| <artifactId>commons-math3</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,117 @@ | ||||||||
| /* | ||||||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||
| * you may not use this file except in compliance with the License. | ||||||||
| * You may obtain a copy of the License at | ||||||||
| * | ||||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||||
| * | ||||||||
| * Unless required by applicable law or agreed to in writing, software | ||||||||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||||||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||
| * See the License for the specific language governing permissions and | ||||||||
| * limitations under the License. | ||||||||
| */ | ||||||||
| package com.facebook.presto.plugin.clp; | ||||||||
|
|
||||||||
| import com.facebook.presto.common.type.Type; | ||||||||
| import com.facebook.presto.spi.ColumnHandle; | ||||||||
| import com.facebook.presto.spi.ColumnMetadata; | ||||||||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||||||||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||||||||
|
|
||||||||
| import java.util.Objects; | ||||||||
|
|
||||||||
| import static com.google.common.base.MoreObjects.toStringHelper; | ||||||||
|
|
||||||||
| public class ClpColumnHandle | ||||||||
| implements ColumnHandle | ||||||||
| { | ||||||||
| private final String columnName; | ||||||||
| private final String originalColumnName; | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is about the polymorphism, not about nested |
||||||||
| private final Type columnType; | ||||||||
| private final boolean nullable; | ||||||||
|
|
||||||||
| @JsonCreator | ||||||||
| public ClpColumnHandle( | ||||||||
| @JsonProperty("columnName") String columnName, | ||||||||
| @JsonProperty("originalColumnName") String originalColumnName, | ||||||||
| @JsonProperty("columnType") Type columnType, | ||||||||
| @JsonProperty("nullable") boolean nullable) | ||||||||
| { | ||||||||
| this.columnName = columnName; | ||||||||
| this.originalColumnName = originalColumnName; | ||||||||
| this.columnType = columnType; | ||||||||
| this.nullable = nullable; | ||||||||
| } | ||||||||
|
Comment on lines
+34
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Enforce non-null invariants for handle fields For consistency with other Presto handle implementations, validate all object references: -import java.util.Objects;
+import java.util.Objects;
+import static java.util.Objects.requireNonNull;
...
this.columnName = requireNonNull(columnName, "columnName is null");
this.originalColumnName = requireNonNull(originalColumnName, "originalColumnName is null");
this.columnType = requireNonNull(columnType, "columnType is null");
🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| public ClpColumnHandle(String columnName, Type columnType, boolean nullable) | ||||||||
| { | ||||||||
| this(columnName, columnName, columnType, nullable); | ||||||||
| } | ||||||||
|
|
||||||||
| @JsonProperty | ||||||||
| public String getColumnName() | ||||||||
| { | ||||||||
| return columnName; | ||||||||
| } | ||||||||
|
|
||||||||
| @JsonProperty | ||||||||
| public String getOriginalColumnName() | ||||||||
| { | ||||||||
| return originalColumnName; | ||||||||
| } | ||||||||
|
|
||||||||
| @JsonProperty | ||||||||
| public Type getColumnType() | ||||||||
| { | ||||||||
| return columnType; | ||||||||
| } | ||||||||
|
|
||||||||
| @JsonProperty | ||||||||
| public boolean isNullable() | ||||||||
| { | ||||||||
| return nullable; | ||||||||
| } | ||||||||
|
|
||||||||
| public ColumnMetadata getColumnMetadata() | ||||||||
| { | ||||||||
| return ColumnMetadata.builder() | ||||||||
| .setName(columnName) | ||||||||
| .setType(columnType) | ||||||||
| .setNullable(nullable) | ||||||||
| .build(); | ||||||||
| } | ||||||||
|
|
||||||||
| @Override | ||||||||
| public int hashCode() | ||||||||
| { | ||||||||
| return Objects.hash(columnName, originalColumnName, columnType, nullable); | ||||||||
wraymo marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| } | ||||||||
|
|
||||||||
| @Override | ||||||||
| public boolean equals(Object obj) | ||||||||
| { | ||||||||
| if (this == obj) { | ||||||||
| return true; | ||||||||
| } | ||||||||
| if (obj == null || getClass() != obj.getClass()) { | ||||||||
| return false; | ||||||||
| } | ||||||||
| ClpColumnHandle other = (ClpColumnHandle) obj; | ||||||||
| return Objects.equals(this.columnName, other.columnName) && | ||||||||
wraymo marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| Objects.equals(this.originalColumnName, other.originalColumnName) && | ||||||||
| Objects.equals(this.columnType, other.columnType) && | ||||||||
| Objects.equals(this.nullable, other.nullable); | ||||||||
| } | ||||||||
|
|
||||||||
| @Override | ||||||||
| public String toString() | ||||||||
| { | ||||||||
| return toStringHelper(this) | ||||||||
| .add("columnName", columnName) | ||||||||
| .add("originalColumnName", originalColumnName) | ||||||||
| .add("columnType", columnType) | ||||||||
| .add("nullable", nullable) | ||||||||
| .toString(); | ||||||||
| } | ||||||||
| } | ||||||||
Uh oh!
There was an error while loading. Please reload this page.