uros-db commented on code in PR #52629: URL: https://github.com/apache/spark/pull/52629#discussion_r2450631777
########## common/unsafe/src/main/java/org/apache/spark/unsafe/types/GeometryVal.java: ########## @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.spark.unsafe.types; + +import java.io.Serializable; + +// This class represents the physical type for the GEOMETRY data type. +public final class GeometryVal implements Comparable<GeometryVal>, Serializable { + + // The GEOMETRY type is implemented as a byte array. We provide `getBytes` and `fromBytes` + // methods for readers and writers to access this underlying array of bytes. + private final byte[] value; + + // We make the constructor private. We should use `fromBytes` to create new instances. + private GeometryVal(byte[] value) { + this.value = value; + } + + public byte[] getBytes() { + return value; + } + + public static GeometryVal fromBytes(byte[] bytes) { + return new GeometryVal(bytes); Review Comment: Good catch! I updated the methods and the tests to handle null values, for both `GeometryVal` and `GeographyVal`. We now do it in the same way as `UTF8String` for example. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
