0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 package org.apache.spark.sql.execution.columnar;
0019
0020 import org.apache.spark.sql.execution.vectorized.Dictionary;
0021
0022 public final class ColumnDictionary implements Dictionary {
0023 private int[] intDictionary;
0024 private long[] longDictionary;
0025
0026 public ColumnDictionary(int[] dictionary) {
0027 this.intDictionary = dictionary;
0028 }
0029
0030 public ColumnDictionary(long[] dictionary) {
0031 this.longDictionary = dictionary;
0032 }
0033
0034 @Override
0035 public int decodeToInt(int id) {
0036 return intDictionary[id];
0037 }
0038
0039 @Override
0040 public long decodeToLong(int id) {
0041 return longDictionary[id];
0042 }
0043
0044 @Override
0045 public float decodeToFloat(int id) {
0046 throw new UnsupportedOperationException("Dictionary encoding does not support float");
0047 }
0048
0049 @Override
0050 public double decodeToDouble(int id) {
0051 throw new UnsupportedOperationException("Dictionary encoding does not support double");
0052 }
0053
0054 @Override
0055 public byte[] decodeToBinary(int id) {
0056 throw new UnsupportedOperationException("Dictionary encoding does not support String");
0057 }
0058 }