uros-db commented on code in PR #56104: URL: https://github.com/apache/spark/pull/56104#discussion_r3303248624
########## common/unsafe/src/main/java/org/apache/spark/unsafe/types/BinaryView.java: ########## @@ -0,0 +1,287 @@ +/* + * 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 com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.KryoSerializable; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.nio.ByteBuffer; + +import org.apache.spark.annotation.Unstable; +import org.apache.spark.unsafe.Platform; +import org.apache.spark.unsafe.array.ByteArrayMethods; +import org.apache.spark.unsafe.hash.Murmur3_x86_32; + +import static org.apache.spark.unsafe.Platform.BYTE_ARRAY_OFFSET; + +/** + * A non-owning view over a contiguous chunk of bytes that may live on-heap or off-heap, + * modelled on {@link UTF8String} but without UTF-8 semantics. It is intended as the shared Review Comment: Nit: it seems that the doc comment is self-sufficient, even without the `UTF8String` reference. There probably is no reason to mention UTF8String here. ########## common/unsafe/src/main/java/org/apache/spark/unsafe/types/BinaryView.java: ########## @@ -0,0 +1,287 @@ +/* + * 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 com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.KryoSerializable; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.nio.ByteBuffer; + +import org.apache.spark.annotation.Unstable; +import org.apache.spark.unsafe.Platform; +import org.apache.spark.unsafe.array.ByteArrayMethods; +import org.apache.spark.unsafe.hash.Murmur3_x86_32; + +import static org.apache.spark.unsafe.Platform.BYTE_ARRAY_OFFSET; + +/** + * A non-owning view over a contiguous chunk of bytes that may live on-heap or off-heap, + * modelled on {@link UTF8String} but without UTF-8 semantics. It is intended as the shared + * physical carrier for opaque-bytes SQL types whose values can be read directly out of an + * {@code UnsafeRow} / {@code UnsafeArrayData} / {@code ColumnVector} backing buffer. + * <p> + * Lifetime: a {@code BinaryView} is only valid for as long as the memory it points to is + * alive. Callers that need to retain a value across the source buffer's lifetime must call + * {@link #copy()} first. This is the same discipline {@code UTF8String} uses. Review Comment: Same as https://github.com/apache/spark/pull/56104/changes#r3303248624. -- 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]
