2 package com.cloudera.impala.catalog;
4 import com.cloudera.impala.thrift.THdfsCompression;
5 import com.google.common.base.Preconditions;
6 import com.google.common.collect.ImmutableMap;
26 private static final ImmutableMap<String, HdfsCompression> SUFFIX_MAP =
28 put(
"deflate", DEFLATE).
31 put(
"snappy", SNAPPY).
33 put(
"index", LZO_INDEX).
38 int index = fileName.lastIndexOf(
".");
43 String suffix = fileName.substring(index + 1);
45 return compression == null ? NONE : compression;
50 case NONE:
return THdfsCompression.NONE;
51 case DEFLATE:
return THdfsCompression.DEFLATE;
52 case GZIP:
return THdfsCompression.GZIP;
53 case BZIP2:
return THdfsCompression.BZIP2;
54 case SNAPPY:
return THdfsCompression.SNAPPY_BLOCKED;
55 case LZO:
return THdfsCompression.LZO;
56 default:
throw new IllegalStateException(
"Unexpected codec: " +
this);
63 Preconditions.checkNotNull(inputFormatClass);
static HdfsCompression fromFileName(String fileName)
THdfsCompression toThrift()
static HdfsCompression fromHdfsInputFormatClass(String inputFormatClass)