public Integer getScale(){ return type.accept(new AbstractArrowTypeVisitor<Integer>(){ @Override public Integer visit(Decimal type) { return type.getScale(); } @Override protected Integer visitGeneric(ArrowType type) { return null; } }); }
public boolean isComparable() { switch(type.getTypeID()) { case Struct: case List: return false; default: return true; } }
public int getField(FlatBufferBuilder builder) { int nameOffset = name == null ? -1 : builder.createString(name); int typeOffset = getType().getType(builder); int dictionaryOffset = -1; DictionaryEncoding dictionary = getDictionary(); org.apache.arrow.flatbuf.Field.addTypeType(builder, getType().getTypeID().getFlatbufID()); org.apache.arrow.flatbuf.Field.addType(builder, typeOffset); org.apache.arrow.flatbuf.Field.addChildren(builder, childrenOffset);
int nameOffset = oldField.name() == null ? -1 : builder.createString(oldField.name()); ArrowType arrowType = getTypeForField(oldField); int typeOffset = arrowType.getType(builder); int dictionaryOffset = -1; org.apache.arrow.flatbuf.DictionaryEncoding oldDictionaryEncoding = oldField.dictionary();
public static Field convertField(org.apache.arrow.flatbuf.Field field) { String name = field.name(); boolean nullable = field.nullable(); ArrowType type = getTypeForField(field); DictionaryEncoding dictionary = null; org.apache.arrow.flatbuf.DictionaryEncoding dictionaryFB = field.dictionary();
public CodeGenContext annotateExpression(BatchSchema batchSchema, CodeGenContext contextExpr) { try { BatchSchema.SelectionVectorMode incomingSelectionVectorMode = batchSchema.getSelectionVectorMode(); if (incomingSelectionVectorMode != BatchSchema.SelectionVectorMode.NONE) { return contextExpr; } // if schema contains complex fields, skip annotation with Gandiva for(Field field : batchSchema.getFields()) { if (field.getType().isComplex()) { return contextExpr; } } CodeGenContext codeGenContextModifiedExpr = contextExpr.getChild().accept(this, contextExpr); if (!isSupportedReturnType(contextExpr.getCompleteType())) { // If the final expression's return type is not supported, remove Gandiva support codeGenContextModifiedExpr.removeSupporteExecutionEngineForExpression(SupportedEngines.Engine.GANDIVA); codeGenContextModifiedExpr.removeSupporteExecutionEngineForSubExpression(SupportedEngines.Engine.GANDIVA); } return codeGenContextModifiedExpr; } catch (GandivaException gandivaException) { logger.error("Exception in running sieve", gandivaException); // ignore exception // fall-through and return false } return contextExpr; }
public static String describe(ArrowType type){ return type.accept(INSTANCE); }
public boolean isScalar() { switch(type.getTypeID()){ case List: case Struct: case Union: return false; default: return true; } }
public boolean isSigned() { return type.accept(new AbstractArrowTypeVisitor<Boolean>(){ @Override public Boolean visit(Int type) { return true; } @Override public Boolean visit(FloatingPoint type) { return true; } @Override public Boolean visit(Decimal type) { return true; } @Override protected Boolean visitGeneric(ArrowType type) { return false; } }); }
public boolean isFixedWidthScalar() { switch(type.getTypeID()){ case List: case Struct: case Union: case Binary: case Utf8: return false; default: return true; } }
public boolean isSortable() { return type.accept(new AbstractArrowTypeVisitor<Boolean>(){ @Override public Boolean visit(Null type) { return false; } @Override public Boolean visit(Struct type) { return false; } @Override public Boolean visit(org.apache.arrow.vector.types.pojo.ArrowType.List type) { return false; } @Override public Boolean visit(Union type) { return false; } @Override protected Boolean visitGeneric(ArrowType type) { return true; }}); }
public boolean isVariableWidthScalar() { switch(type.getTypeID()){ case Utf8: case Binary: return true; default: return false; } }
public Integer getPrecision(){ return type.accept(new AbstractArrowTypeVisitor<Integer>(){ @Override public Integer visit(Utf8 type) { return 65536; } @Override public Integer visit(Binary type) { return 65536; } @Override public Integer visit(Decimal type) { return type.getPrecision(); } @Override public Integer visit(Time type) { return getPrecision(type.getUnit()); } @Override public Integer visit(Timestamp type) { return getPrecision(type.getUnit()); } @Override protected Integer visitGeneric(ArrowType type) { return null; } }); }
public boolean isNumeric() { switch(type.getTypeID()){ case Decimal: case FloatingPoint: case Int: return true; default: return false; } }
return type.accept(new ArrowTypeVisitor<Class<? extends ValueHolder>>() {
public boolean isTemporal() { switch(type.getTypeID()){ case Date: case Time: case Timestamp: return true; default: return false; } }
/*** * Gets SQL data type name for given Dremio RPC-/protobuf-level data type. * @return * canonical keyword sequence for SQL data type (leading keywords in * corresponding {@code <data type>}; what * {@code INFORMATION_SCHEMA.COLUMNS.TYPE_NAME} would list) */ public String getSqlTypeName() { return type.accept(new SqlTypeNameVisitor()); }
public boolean isBoolean() { return type.getTypeID() == ArrowTypeID.Bool; }
public int getSqlDisplaySize() { return type.accept(new SqlDisplaySizeVisitor()); }
public boolean isUnion() { return type.getTypeID() == ArrowTypeID.Union; }