Skip to content

Commit

Permalink
Fix geoarrow sonar (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry authored Jun 27, 2024
1 parent cf534c1 commit 73a8144
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,18 @@ protected Converter makeConverter(Context child) {
return new StructConverter(child) {

@Override
public void start() {}
public void start() {
// don't start a new struct
}

@Override
protected Converter makeConverter(Context child) {
return new StructConverter(child) {

@Override
public void start() {}
public void start() {
// don't start a new struct
}

@Override
public void end() {
Expand Down Expand Up @@ -235,12 +239,6 @@ public void addDouble(double value) {

@Override
protected Converter makeConverter(Context child) {
class CoordinateSetter extends PrimitiveConverter {
@Override
public void addDouble(double value) {
super.addDouble(value);
}
}
return switch (child.type.getName()) {
case "x" -> ordinateSetter(0);
case "y" -> ordinateSetter(1);
Expand Down Expand Up @@ -593,12 +591,12 @@ public boolean isGeoArrowCoordSeq() {
repeatedElement.asGroupType().getFieldCount() != 1) {
return false;
}
return isGeoarrowCoordinate(repeatedElement.asGroupType().getType(0));
return isGeoArrowCoordinate(repeatedElement.asGroupType().getType(0));
}

public boolean isGeoArrowCoordinate() {
String geoArrowType = getGeoArrowType();
return geoArrowType != null && geoArrowType.contains("point") && isGeoarrowCoordinate(type);
return geoArrowType != null && geoArrowType.contains("point") && isGeoArrowCoordinate(type);
}

private String getGeoArrowType() {
Expand All @@ -612,7 +610,7 @@ private String getGeoArrowType() {
}
}

private static boolean isGeoarrowCoordinate(Type struct) {
private static boolean isGeoArrowCoordinate(Type struct) {
if (struct.isPrimitive()) {
return false;
}
Expand Down

0 comments on commit 73a8144

Please sign in to comment.