MCPcopy Index your code
hub / github.com/apache/orc / MaskFactory

Class MaskFactory

java/core/src/java/org/apache/orc/impl/mask/MaskFactory.java:32–116  ·  view source on GitHub ↗

A mask factory framework that automatically builds a recursive mask. The subclass defines how to mask the primitive types and the factory builds a recursive tree of data masks that matches the schema tree.

Source from the content-addressed store, hash-verified

30 * builds a recursive tree of data masks that matches the schema tree.
31 */
32public abstract class MaskFactory {
33
34 protected abstract DataMask buildBooleanMask(TypeDescription schema);
35 protected abstract DataMask buildLongMask(TypeDescription schema);
36 protected abstract DataMask buildDecimalMask(TypeDescription schema);
37 protected abstract DataMask buildDoubleMask(TypeDescription schema);
38 protected abstract DataMask buildStringMask(TypeDescription schema);
39 protected abstract DataMask buildDateMask(TypeDescription schema);
40 protected abstract DataMask buildTimestampMask(TypeDescription schema);
41 protected abstract DataMask buildBinaryMask(TypeDescription schema);
42
43 public DataMask build(TypeDescription schema,
44 DataMask.MaskOverrides overrides) {
45 switch(schema.getCategory()) {
46 case BOOLEAN:
47 return buildBooleanMask(schema);
48 case BYTE:
49 case SHORT:
50 case INT:
51 case LONG:
52 return buildLongMask(schema);
53 case FLOAT:
54 case DOUBLE:
55 return buildDoubleMask(schema);
56 case DECIMAL:
57 return buildDecimalMask(schema);
58 case STRING:
59 case CHAR:
60 case VARCHAR:
61 return buildStringMask(schema);
62 case TIMESTAMP:
63 case TIMESTAMP_INSTANT:
64 return buildTimestampMask(schema);
65 case DATE:
66 return buildDateMask(schema);
67 case BINARY:
68 return buildBinaryMask(schema);
69 case UNION:
70 return buildUnionMask(schema, overrides);
71 case STRUCT:
72 return buildStructMask(schema, overrides);
73 case LIST:
74 return buildListMask(schema, overrides);
75 case MAP:
76 return buildMapMask(schema, overrides);
77 default:
78 throw new IllegalArgumentException("Unhandled type " + schema);
79 }
80 }
81
82 protected DataMask[] buildChildren(List<TypeDescription> children,
83 DataMask.MaskOverrides overrides) {
84 DataMask[] result = new DataMask[children.size()];
85 for(int i = 0; i < result.length; ++i) {
86 TypeDescription child = children.get(i);
87 DataMaskDescription over = overrides.hasOverride(child);
88 if (over != null) {
89 result[i] = DataMask.Factory.build(over, child, overrides);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected