|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +package org.apache.arrow.gandiva.evaluator; |
| 18 | + |
| 19 | +import org.apache.arrow.memory.BufferAllocator; |
| 20 | +import org.apache.arrow.vector.FieldVector; |
| 21 | +import org.apache.arrow.vector.FixedSizeBinaryVector; |
| 22 | +import org.apache.arrow.vector.types.pojo.ArrowType; |
| 23 | +import org.apache.arrow.vector.types.pojo.ArrowType.ExtensionType; |
| 24 | +import org.apache.arrow.vector.types.pojo.FieldType; |
| 25 | + |
| 26 | +/** UUID extension type for Gandiva. THIS SHOULD NOT BE INCLUDED!!!*/ |
| 27 | +public class UuidType extends ExtensionType { |
| 28 | + |
| 29 | + @Override |
| 30 | + public ArrowType storageType() { |
| 31 | + return new ArrowType.FixedSizeBinary(16); |
| 32 | + } |
| 33 | + |
| 34 | + @Override |
| 35 | + public String extensionName() { |
| 36 | + return "arrow.uuid"; |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public boolean extensionEquals(ExtensionType other) { |
| 41 | + return other instanceof UuidType; |
| 42 | + } |
| 43 | + |
| 44 | + @Override |
| 45 | + public ArrowType deserialize(ArrowType storageType, String serializedData) { |
| 46 | + if (!storageType.equals(storageType())) { |
| 47 | + throw new UnsupportedOperationException( |
| 48 | + "Cannot construct UuidType from underlying type " + storageType); |
| 49 | + } |
| 50 | + return new UuidType(); |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + public String serialize() { |
| 55 | + return ""; |
| 56 | + } |
| 57 | + |
| 58 | + @Override |
| 59 | + public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator) { |
| 60 | + return new FixedSizeBinaryVector(name, allocator, 16); |
| 61 | + } |
| 62 | +} |
0 commit comments