Skip to content

Commit 398dd0b

Browse files
committed
add more tests and fix some comments
1 parent e88268d commit 398dd0b

7 files changed

Lines changed: 12 additions & 22 deletions

File tree

parquet-column/src/main/java/org/apache/parquet/column/impl/ColumnValueCollector.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class ColumnValueCollector {
3939
private final ColumnDescriptor path;
4040
private final boolean statisticsEnabled;
4141
private final boolean sizeStatisticsEnabled;
42-
private final boolean geospatialStatisticsEnabled;
4342
private BloomFilterWriter bloomFilterWriter;
4443
private BloomFilter bloomFilter;
4544
private Statistics<?> statistics;
@@ -50,7 +49,6 @@ class ColumnValueCollector {
5049
this.path = path;
5150
this.statisticsEnabled = props.getStatisticsEnabled(path);
5251
this.sizeStatisticsEnabled = props.getSizeStatisticsEnabled(path);
53-
this.geospatialStatisticsEnabled = props.getStatisticsEnabled(path);
5452
resetPageStatistics();
5553
initBloomFilter(bloomFilterWriter, props);
5654
}
@@ -64,7 +62,7 @@ void resetPageStatistics() {
6462
path.getPrimitiveType(), path.getMaxRepetitionLevel(), path.getMaxDefinitionLevel())
6563
: SizeStatistics.noopBuilder(
6664
path.getPrimitiveType(), path.getMaxRepetitionLevel(), path.getMaxDefinitionLevel());
67-
this.geospatialStatisticsBuilder = geospatialStatisticsEnabled
65+
this.geospatialStatisticsBuilder = statisticsEnabled
6866
? GeospatialStatistics.newBuilder(path.getPrimitiveType())
6967
: GeospatialStatistics.noopBuilder();
7068
}

parquet-column/src/main/java/org/apache/parquet/column/statistics/geometry/EdgeInterpolationAlgorithm.java renamed to parquet-column/src/main/java/org/apache/parquet/column/schema/EdgeInterpolationAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.apache.parquet.column.statistics.geometry;
19+
package org.apache.parquet.column.schema;
2020

2121
/**
2222
* Edge interpolation algorithm for Geography logical type

parquet-column/src/main/java/org/apache/parquet/column/statistics/geometry/BoundingBox.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public double getMMax() {
8181

8282
/**
8383
* Checks if the bounding box is valid.
84-
* A bounding box is considered valid if none of the bounds are in their initial state
85-
* (i.e., xMin = +Infinity, xMax = -Infinity, etc.) and none of the bounds contain NaN.
84+
* A bounding box is considered valid if none of the bounds contain NaN.
8685
*
8786
* @return true if the bounding box is valid, false otherwise.
8887
*/
@@ -92,26 +91,22 @@ public boolean isValid() {
9291

9392
/**
9493
* Checks if the Z dimension of the bounding box is valid.
95-
* The Z dimension is considered valid if zMin and zMax are not infinite
96-
* and don't contain NaN values.
94+
* The Z dimension is considered valid if none of the bounds contain NaN.
9795
*
9896
* @return true if the Z dimension is valid, false otherwise.
9997
*/
10098
public boolean isZValid() {
101-
return !(Double.isInfinite(zMin) || Double.isInfinite(zMax) ||
102-
Double.isNaN(zMin) || Double.isNaN(zMax));
99+
return !(Double.isNaN(zMin) || Double.isNaN(zMax));
103100
}
104101

105102
/**
106103
* Checks if the M dimension of the bounding box is valid.
107-
* The M dimension is considered valid if mMin and mMax are not infinite
108-
* and don't contain NaN values.
104+
* The M dimension is considered valid if none of the bounds contain NaN.
109105
*
110106
* @return true if the M dimension is valid, false otherwise.
111107
*/
112108
public boolean isMValid() {
113-
return !(Double.isInfinite(mMin) || Double.isInfinite(mMax) ||
114-
Double.isNaN(mMin) || Double.isNaN(mMax));
109+
return !(Double.isNaN(mMin) || Double.isNaN(mMax));
115110
}
116111

117112
/**

parquet-column/src/main/java/org/apache/parquet/column/statistics/geometry/GeospatialStatistics.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.parquet.column.statistics.geometry;
2020

2121
import org.apache.parquet.Preconditions;
22+
import org.apache.parquet.column.schema.EdgeInterpolationAlgorithm;
2223
import org.apache.parquet.io.api.Binary;
2324
import org.apache.parquet.schema.LogicalTypeAnnotation;
2425
import org.apache.parquet.schema.PrimitiveType;

parquet-column/src/main/java/org/apache/parquet/column/statistics/geometry/GeospatialTypes.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,8 @@ private int getGeometryTypeCode(Geometry geometry) {
136136
boolean hasZ = false;
137137
boolean hasM = false;
138138
for (Coordinate coordinate : coordinates) {
139-
if (!Double.isNaN(coordinate.getZ())) {
140-
hasZ = true;
141-
}
142-
if (!Double.isNaN(coordinate.getM())) {
143-
hasM = true;
144-
}
139+
hasZ = !Double.isNaN(coordinate.getZ());
140+
hasM = !Double.isNaN(coordinate.getM());
145141
if (hasZ && hasM) {
146142
break;
147143
}

parquet-column/src/main/java/org/apache/parquet/schema/LogicalTypeAnnotation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import java.util.Set;
4242
import java.util.function.Supplier;
4343
import org.apache.parquet.Preconditions;
44-
import org.apache.parquet.column.statistics.geometry.EdgeInterpolationAlgorithm;
44+
import org.apache.parquet.column.schema.EdgeInterpolationAlgorithm;
4545

4646
public abstract class LogicalTypeAnnotation {
4747

parquet-hadoop/src/main/java/org/apache/parquet/format/converter/ParquetMetadataConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ LogicalTypeAnnotation getLogicalTypeAnnotation(LogicalType type) {
13231323
if (geography.getAlgorithm() != null) {
13241324
return LogicalTypeAnnotation.geographyType(
13251325
geography.getCrs(),
1326-
org.apache.parquet.column.statistics.geometry.EdgeInterpolationAlgorithm.valueOf(
1326+
org.apache.parquet.column.schema.EdgeInterpolationAlgorithm.valueOf(
13271327
String.valueOf(geography.getAlgorithm())));
13281328
} else {
13291329
return LogicalTypeAnnotation.geographyType(geography.getCrs(), null);

0 commit comments

Comments
 (0)