Skip to content

Commit

Permalink
GIS #462: moved default mapping from Geometry to Text to SqlDialect
Browse files Browse the repository at this point in the history
  • Loading branch information
danylokravchenko committed Dec 10, 2023
1 parent f9a9802 commit a389260
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ protected String getTypeString( PolyType type ) {
return "DECIMAL";
case VARCHAR:
return "VARCHAR";
case GEOMETRY:
case JSON:
return "TEXT";
case DATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.google.common.base.Preconditions;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.sql.ResultSet;
import java.sql.Timestamp;
Expand Down Expand Up @@ -572,11 +573,7 @@ public CalendarPolicy getCalendarPolicy() {
public SqlNode getCastSpec( AlgDataType type ) {
if ( type instanceof BasicPolyType ) {
int precision = type.getPrecision();
if ( type.getPolyType() == PolyType.JSON ) {
precision = 2024;
type = new PolyTypeFactoryImpl( AlgDataTypeSystem.DEFAULT ).createPolyType( PolyType.VARCHAR, precision );
}
if ( type.getPolyType() == PolyType.NODE ) {
if ( List.of( PolyType.JSON, PolyType.NODE, PolyType.GEOMETRY ).contains( type.getPolyType() ) ) {
precision = 2024;
type = new PolyTypeFactoryImpl( AlgDataTypeSystem.DEFAULT ).createPolyType( PolyType.VARCHAR, precision );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public SqlNode getCastSpec( AlgDataType type ) {
String castSpec;
switch ( type.getPolyType() ) {
case ARRAY:
// We need to flag the type with a underscore to flag the type (the underscore is removed in the unparse method)
// We need to flag the type with an underscore to flag the type (the underscore is removed in the unparse method)
castSpec = "_LONGVARCHAR";
break;
case FILE:
case IMAGE:
case VIDEO:
case AUDIO:
// We need to flag the type with a underscore to flag the type (the underscore is removed in the unparse method)
// We need to flag the type with an underscore to flag the type (the underscore is removed in the unparse method)
castSpec = "_BLOB";
break;
case INTERVAL_YEAR_MONTH:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public SqlNode getCastSpec( AlgDataType type ) {
String castSpec;
switch ( type.getPolyType() ) {
case ARRAY:
// We need to flag the type with a underscore to flag the type (the underscore is removed in the unparse method)
// We need to flag the type with an underscore to flag the type (the underscore is removed in the unparse method)
castSpec = "_TEXT";
break;
case FILE:
case IMAGE:
case VIDEO:
case AUDIO:
// We need to flag the type with a underscore to flag the type (the underscore is removed in the unparse method)
// We need to flag the type with an underscore to flag the type (the underscore is removed in the unparse method)
castSpec = "_BLOB";
break;
default:
Expand Down

0 comments on commit a389260

Please sign in to comment.