/** * This method will form the path for dictionary file for a given column */ protected void initFileLocation() { this.columnDictionaryFilePath = dictionaryColumnUniqueIdentifier.getDictionaryFilePath(); }
protected void initPaths() { this.dictionaryFilePath = dictionaryColumnUniqueIdentifier.getDictionaryFilePath(); this.dictionaryMetaFilePath = dictionaryColumnUniqueIdentifier.getDictionaryMetaFilePath(); }
/** * This method will return the carbon file objetc based on its type (local, HDFS) * * @param dictionaryColumnUniqueIdentifier * @return */ private CarbonFile getDictionaryMetaCarbonFile( DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) throws IOException { String dictionaryFilePath = dictionaryColumnUniqueIdentifier.getDictionaryFilePath(); FileFactory.FileType fileType = FileFactory.getFileType(dictionaryFilePath); CarbonFile dictFile = FileFactory.getCarbonFile(dictionaryFilePath, fileType); // When rename table triggered parallely with select query, dictionary files may not exist if (!dictFile.exists()) { throw new IOException("Dictionary file does not exist: " + dictionaryFilePath); } return dictFile; }
protected void initPath() { String dictionaryFilePath = dictionaryColumnUniqueIdentifier.getDictionaryFilePath(); long dictOffset = CarbonUtil.getFileSize(dictionaryFilePath); this.sortIndexFilePath = dictionaryColumnUniqueIdentifier.getSortIndexFilePath(dictOffset); cleanUpOldSortIndex(dictionaryFilePath); }
/** * This method will check if dictionary and its metadata file exists for a given column * * @param dictionaryColumnUniqueIdentifier unique identifier which contains dbName, * tableName and columnIdentifier * @return */ public static boolean isFileExistsForGivenColumn( DictionaryColumnUniqueIdentifier dictionaryColumnUniqueIdentifier) { String dictionaryFilePath = dictionaryColumnUniqueIdentifier.getDictionaryFilePath(); String dictionaryMetadataFilePath = dictionaryColumnUniqueIdentifier.getDictionaryMetaFilePath(); // check if both dictionary and its metadata file exists for a given column return isFileExists(dictionaryFilePath) && isFileExists(dictionaryMetadataFilePath); }