forked from trinodb/trino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added support adb array type - added support adb hstore (trino map) type - fixed types tests
- Loading branch information
1 parent
3470969
commit 599b9c2
Showing
15 changed files
with
649 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
plugin/trino-adb/src/main/java/io/trino/plugin/adb/connector/datatype/ArrayDataType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* 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 io.trino.plugin.adb.connector.datatype; | ||
|
||
import io.trino.spi.type.ArrayType; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
|
||
public class ArrayDataType | ||
implements ColumnDataType | ||
{ | ||
private final String name; | ||
private final ArrayType arrayType; | ||
private final ColumnDataType elementType; | ||
|
||
public ArrayDataType(ArrayType arrayType, ColumnDataType elementType) | ||
{ | ||
checkArgument(arrayType != null, "arrayType is null"); | ||
checkArgument(elementType != null, "elementType is null"); | ||
this.name = elementType.getName() + "[]"; | ||
this.arrayType = arrayType; | ||
this.elementType = elementType; | ||
} | ||
|
||
@Override | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
@Override | ||
public ConnectorDataType getType() | ||
{ | ||
return ConnectorDataType.ARRAY; | ||
} | ||
|
||
public ArrayType getArrayType() | ||
{ | ||
return arrayType; | ||
} | ||
|
||
public ColumnDataType getElementType() | ||
{ | ||
return elementType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,5 +37,6 @@ public enum ConnectorDataType | |
TIMESTAMP_WITHOUT_TIME_ZONE, | ||
ENUM, | ||
ARRAY, | ||
MAP, | ||
UNSUPPORTED | ||
} |
46 changes: 46 additions & 0 deletions
46
plugin/trino-adb/src/main/java/io/trino/plugin/adb/connector/datatype/MapDataType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 io.trino.plugin.adb.connector.datatype; | ||
|
||
import io.trino.spi.type.MapType; | ||
|
||
public class MapDataType | ||
implements ColumnDataType | ||
{ | ||
private final String name; | ||
private final MapType mapType; | ||
|
||
public MapDataType(MapType mapType) | ||
{ | ||
this.name = "hstore"; | ||
this.mapType = mapType; | ||
} | ||
|
||
@Override | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
@Override | ||
public ConnectorDataType getType() | ||
{ | ||
return ConnectorDataType.MAP; | ||
} | ||
|
||
public MapType getTrinoMapType() | ||
{ | ||
return mapType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.