List of usage examples for org.apache.hadoop.conf Configuration Configuration
public Configuration()
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createProjectShort(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_Short, ConstVar.Sizeof_Short, (short) 1)); Head head = new Head(); head.setFieldMap(fieldMap);/*w w w . ja v a2 s. c o m*/ String fileName = "Column_Short"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(shortFileName, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(1); record.addValue(new FieldValue((short) i, (short) 1)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createProjectInt(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_Int, ConstVar.Sizeof_Int, (short) 2)); Head head = new Head(); head.setFieldMap(fieldMap);// w w w .j a v a 2s .c om String fileName = "Column_Int"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(intFileName, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(1); record.addValue(new FieldValue((int) i, (short) 2)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createProjectLong(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_Long, ConstVar.Sizeof_Long, (short) 3)); Head head = new Head(); head.setFieldMap(fieldMap);// w w w . j av a 2 s .co m String fileName = "Column_Long"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(longFileName, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(1); record.addValue(new FieldValue((long) i, (short) 3)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createProjectFloat(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_Float, ConstVar.Sizeof_Float, (short) 4)); Head head = new Head(); head.setFieldMap(fieldMap);//from ww w .j av a 2 s . c om String fileName = "Column_Float"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(floatFileName, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(1); record.addValue(new FieldValue((float) i, (short) 4)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createProjectDouble(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_Double, ConstVar.Sizeof_Double, (short) 5)); Head head = new Head(); head.setFieldMap(fieldMap);// w ww . j a v a2 s . c o m String fileName = "Column_Double"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(doubleFileName, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(1); record.addValue(new FieldValue((double) i, (short) 5)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createProjectString(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_String, 0, (short) 6)); Head head = new Head(); head.setFieldMap(fieldMap);//from www. j a v a 2s.c om String fileName = "Column_String"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(stringFileName, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(1); record.addValue(new FieldValue(new String("hello konten") + i, (short) 6)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void createMultiProject(FileSystem fs) throws Exception { FieldMap fieldMap = new FieldMap(); fieldMap.addField(new Field(ConstVar.FieldType_Short, ConstVar.Sizeof_Short, (short) 7)); fieldMap.addField(new Field(ConstVar.FieldType_Short, ConstVar.Sizeof_Short, (short) 8)); fieldMap.addField(new Field(ConstVar.FieldType_Short, ConstVar.Sizeof_Short, (short) 9)); Head head = new Head(); head.setFieldMap(fieldMap);/*from w ww .jav a2 s .c o m*/ String fileName = "Column_Short_Short_Short"; FormatDataFile fd = new FormatDataFile(new Configuration()); fd.create(multiFileNameString, head); int count = 10; for (int i = 0; i < count; i++) { Record record = new Record(3); record.addValue(new FieldValue((short) i, (short) 7)); record.addValue(new FieldValue((short) i, (short) 8)); record.addValue(new FieldValue((short) i, (short) 9)); fd.addRecord(record); } fd.close(); }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void testLoadNaviFromHead() { try {/*from w w w . j a v a2 s .c o m*/ Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); Path path = new Path(prefix); fs.delete(path, true); createAllSingleProject(fs); ColumnProject cp = new ColumnProject(conf); cp.loadColmnInfoFromHeadInfo(fs, path); checkAllColumnInfo(cp.infos()); } catch (Exception e) { e.printStackTrace(); fail("get exception:" + e.getMessage()); } }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void testGetFileNameByFieldIndex() { try {//from ww w . j ava2 s . co m String navigator = prefix; Path path = new Path(navigator); Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); ColumnProject cp = new ColumnProject(conf); cp.loadColmnInfoFromHeadInfo(fs, path); ArrayList<String> fileList = null; fileList = cp.getFileNameByIndex(null); if (fileList != null) { fail("should null"); } ArrayList<Short> idxs = new ArrayList<Short>(10); idxs.add((short) 10); fileList = cp.getFileNameByIndex(idxs); if (fileList != null) { fail("should null"); } idxs.clear(); idxs.add((short) 0); fileList = cp.getFileNameByIndex(idxs); if (fileList == null) { fail("should not null"); } if (fileList.size() != 1) { fail("error fileList:" + fileList.size()); } if (!fileList.get(0).equals(byteFileName)) { fail("error file name:" + fileList.get(0)); } idxs.clear(); idxs.add((short) 0); idxs.add((short) 5); fileList = cp.getFileNameByIndex(idxs); if (fileList == null) { fail("should not null"); } if (fileList.size() != 2) { fail("error fileList:" + fileList.size()); } if (!fileList.get(0).equals(byteFileName)) { fail("error file name1:" + fileList.get(0)); } if (!fileList.get(1).equals(doubleFileName)) { fail("error file name2:" + fileList.get(1)); } idxs.clear(); idxs.add((short) 0); idxs.add((short) 5); idxs.add((short) 10); fileList = cp.getFileNameByIndex(idxs); if (fileList != null) { fail("should null"); } } catch (Exception e) { e.printStackTrace(); fail("get exception:" + e.getMessage()); } }
From source file:ColumnStorageBasicTest.java
License:Open Source License
public void testConstructorNullParamter() { try {/*from w w w . j a va 2 s. co m*/ String navigator = prefix + "navigator"; Path path = new Path(navigator); Configuration conf = new Configuration(); ArrayList<Short> idxs = new ArrayList<Short>(10); try { ColumnStorageClient client = new ColumnStorageClient(null, idxs, conf); fail("error should get exception"); } catch (SEException.InvalidParameterException e) { } try { ColumnStorageClient client = new ColumnStorageClient(path, null, conf); fail("error should get exception"); } catch (SEException.InvalidParameterException e) { } try { ColumnStorageClient client = new ColumnStorageClient(path, idxs, null); fail("error should get exception"); } catch (SEException.InvalidParameterException e) { } } catch (Exception e) { e.printStackTrace(); fail("get exception:" + e.getMessage()); } }