Tabnine Logo
CarbonColumn.getDataType
Code IndexAdd Tabnine to your IDE (free)

How to use
getDataType
method
in
org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn

Best Java code snippets using org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn.getDataType (Showing top 20 results out of 315)

origin: org.apache.carbondata/carbondata-bloom

@Override
protected byte[] convertNonDictionaryValue(int indexColIdx, Object value) {
 // no dictionary measure columns will be of original data, so convert it to bytes
 if (DataTypeUtil.isPrimitiveColumn(indexColumns.get(indexColIdx).getDataType())) {
  return CarbonUtil.getValueAsBytes(indexColumns.get(indexColIdx).getDataType(), value);
 }
 return (byte[]) value;
}
origin: org.apache.carbondata/carbondata-bloom

protected byte[] convertNonDictionaryValue(int indexColIdx, Object value) {
 if (DataTypes.VARCHAR == indexColumns.get(indexColIdx).getDataType()) {
  return DataConvertUtil.getRawBytesForVarchar((byte[]) value);
 } else if (DataTypeUtil.isPrimitiveColumn(indexColumns.get(indexColIdx).getDataType())) {
  // get bytes for the original value of the no dictionary column
  return CarbonUtil.getValueAsBytes(indexColumns.get(indexColIdx).getDataType(), value);
 } else {
  return DataConvertUtil.getRawBytes((byte[]) value);
 }
}
origin: org.apache.carbondata/carbondata-processing

public NonDictionaryFieldConverterImpl(DataField dataField, String nullformat, int index,
  boolean isEmptyBadRecord) {
 this.dataField = dataField;
 this.dataType = dataField.getColumn().getDataType();
 this.column = dataField.getColumn();
 this.index = index;
 this.nullformat = nullformat;
 this.isEmptyBadRecord = isEmptyBadRecord;
}
origin: org.apache.carbondata/carbondata-processing

private static String getComplexTypeString(DataField[] dataFields) {
 StringBuilder dimString = new StringBuilder();
 for (DataField dataField : dataFields) {
  if (dataField.getColumn().getDataType().isComplexType()) {
   addAllComplexTypeChildren((CarbonDimension) dataField.getColumn(), dimString, "");
   dimString.append(CarbonCommonConstants.SEMICOLON_SPC_CHARACTER);
  }
 }
 return dimString.toString();
}
origin: org.apache.carbondata/carbondata-processing

public DataType[] getMeasureDataType() {
 List<Integer> measureIndexes = new ArrayList<>(dataFields.length);
 int measureCount = 0;
 for (int i = 0; i < dataFields.length; i++) {
  if (!dataFields[i].getColumn().isDimension()) {
   measureIndexes.add(i);
   measureCount++;
  }
 }
 DataType[] type = new DataType[measureCount];
 for (int i = 0; i < type.length; i++) {
  type[i] = dataFields[measureIndexes.get(i)].getColumn().getDataType();
 }
 return type;
}
origin: org.apache.carbondata/carbondata-core

public CarbonColumn(ColumnSchema columnSchema, int ordinal, int schemaOrdinal) {
 this.columnSchema = columnSchema;
 this.ordinal = ordinal;
 this.schemaOrdinal = schemaOrdinal;
 this.columnIdentifier =
  new ColumnIdentifier(getColumnId(), getColumnProperties(), getDataType());
}
origin: org.apache.carbondata/carbondata-spark

if (DataType.TIMESTAMP == carbonColumns[i].getDataType()) {
 data[i] = new Timestamp((long) data[i] / 1000L);
} else if (DataType.DATE == carbonColumns[i].getDataType()) {
 data[i] = new Date((long) data[i]);
origin: org.apache.carbondata/carbondata-core

if (DataTypeUtil.isPrimitiveColumn(noDicAndComplexColumns[i].getDataType())) {
 noDictKeys[i] = DataTypeUtil
   .getDataBasedOnDataTypeForNoDictionaryColumn(noDictionaryKeys[i],
     noDicAndComplexColumns[i].getDataType());
   && noDicAndComplexColumns[i].getDataType() == DataTypes.TIMESTAMP) {
  noDictKeys[i] = (long) noDictKeys[i] / 1000L;
origin: org.apache.carbondata/carbondata-processing

public DirectDictionaryFieldConverterImpl(DataField dataField, String nullFormat, int index,
  boolean isEmptyBadRecord) {
 this.nullFormat = nullFormat;
 this.column = dataField.getColumn();
 if (dataField.getColumn().getDataType() == DataTypes.DATE && dataField.getDateFormat() != null
   && !dataField.getDateFormat().isEmpty()) {
  this.directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory
    .getDirectDictionaryGenerator(dataField.getColumn().getDataType(),
      dataField.getDateFormat());
 } else if (dataField.getColumn().getDataType() == DataTypes.TIMESTAMP
   && dataField.getTimestampFormat() != null && !dataField.getTimestampFormat().isEmpty()) {
  this.directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory
    .getDirectDictionaryGenerator(dataField.getColumn().getDataType(),
      dataField.getTimestampFormat());
 } else {
  this.directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory
    .getDirectDictionaryGenerator(dataField.getColumn().getDataType());
 }
 this.index = index;
 this.isEmptyBadRecord = isEmptyBadRecord;
}
origin: org.apache.carbondata/carbondata-bloom

protected void addValue2BloomIndex(int indexColIdx, Object value) {
 byte[] indexValue;
 // convert measure to bytes
 // convert non-dict dimensions to simple bytes without length
 // convert internal-dict dimensions to simple bytes without any encode
 if (indexColumns.get(indexColIdx).isMeasure()) {
  // NULL value of all measures are already processed in `ColumnPage.getData`
  // or `RawBytesReadSupport.readRow` with actual data type
  // Carbon stores boolean as byte. Here we convert it for `getValueAsBytes`
  if (indexColumns.get(indexColIdx).getDataType().equals(DataTypes.BOOLEAN)) {
   value = BooleanConvert.boolean2Byte((Boolean)value);
  }
  indexValue = CarbonUtil.getValueAsBytes(indexColumns.get(indexColIdx).getDataType(), value);
 } else {
  if (indexColumns.get(indexColIdx).hasEncoding(Encoding.DICTIONARY)
    || indexColumns.get(indexColIdx).hasEncoding(Encoding.DIRECT_DICTIONARY)) {
   indexValue = convertDictionaryValue(indexColIdx, value);
  } else {
   indexValue = convertNonDictionaryValue(indexColIdx, value);
  }
 }
 if (indexValue.length == 0) {
  indexValue = CarbonCommonConstants.MEMBER_DEFAULT_VAL_ARRAY;
 }
 indexBloomFilters.get(indexColIdx).add(new Key(indexValue));
}
origin: org.apache.carbondata/carbondata-lucene

 /**
  * Further validate whether it is string column and dictionary column.
  * Currently only string and non-dictionary column is supported for Lucene DataMap
  */
 @Override
 public void validate() throws MalformedDataMapCommandException {
  super.validate();
  List<CarbonColumn> indexColumns = getCarbonTable().getIndexedColumns(getDataMapSchema());

  for (CarbonColumn column : indexColumns) {
   if (column.getDataType() != DataTypes.STRING) {
    throw new MalformedDataMapCommandException(String.format(
      "Only String column is supported, column '%s' is %s type. ",
      column.getColName(), column.getDataType()));
   } else if (column.getEncoder().contains(Encoding.DICTIONARY)) {
    throw new MalformedDataMapCommandException(String.format(
      "Dictionary column is not supported, column '%s' is dictionary column",
      column.getColName()));
   }
  }
 }
}
origin: org.apache.carbondata/carbondata-core

/**
 * Match the columns for transactional and non transactional tables
 * @param isTransactionalTable
 * @param queryColumn
 * @param tableColumn
 * @return
 */
private static boolean isColumnMatches(boolean isTransactionalTable,
  CarbonColumn queryColumn, CarbonColumn tableColumn) {
 // If it is non transactional table just check the column names, no need to validate
 // column id as multiple sdk's output placed in a single folder doesn't have same
 // column ID but can have same column name
 if (tableColumn.getDataType().isComplexType() && !(tableColumn.getDataType().getId()
   == DataTypes.ARRAY_TYPE_ID)) {
  if (tableColumn.getColumnId().equalsIgnoreCase(queryColumn.getColumnId())) {
   return true;
  } else {
   return isColumnMatchesStruct(tableColumn, queryColumn);
  }
 } else {
  return (tableColumn.getColumnId().equalsIgnoreCase(queryColumn.getColumnId()) || (
    !isTransactionalTable && tableColumn.getColName()
      .equalsIgnoreCase(queryColumn.getColName())));
 }
}
origin: org.apache.carbondata/carbondata-processing

@Override
public Object convert(Object value, BadRecordLogHolder logHolder)
  throws RuntimeException {
 String literalValue = (String) value;
 if (literalValue == null) {
  logHolder.setReason(
    CarbonDataProcessorUtil.prepareFailureReason(column.getColName(), column.getDataType()));
  return CarbonCommonConstants.DIRECT_DICT_VALUE_NULL;
 } else if (literalValue.equals(nullFormat)) {
  return CarbonCommonConstants.DIRECT_DICT_VALUE_NULL;
 } else {
  int key = directDictionaryGenerator.generateDirectSurrogateKey(literalValue);
  if (key == CarbonCommonConstants.DIRECT_DICT_VALUE_NULL) {
   if ((literalValue.length() > 0) || (literalValue.length() == 0 && isEmptyBadRecord)) {
    String message = logHolder.getColumnMessageMap().get(column.getColName());
    if (null == message) {
     message = CarbonDataProcessorUtil.prepareFailureReason(
       column.getColName(), column.getDataType());
     logHolder.getColumnMessageMap().put(column.getColName(), message);
    }
    logHolder.setReason(message);
   }
  }
  return key;
 }
}
origin: org.apache.carbondata/carbondata-streaming

public static GenericQueryType[] getComplexDimensions(CarbonTable carbontable,
  CarbonColumn[] carbonColumns, Cache<DictionaryColumnUniqueIdentifier, Dictionary> cache)
  throws IOException {
 GenericQueryType[] queryTypes = new GenericQueryType[carbonColumns.length];
 for (int i = 0; i < carbonColumns.length; i++) {
  if (carbonColumns[i].isComplex()) {
   if (DataTypes.isArrayType(carbonColumns[i].getDataType())) {
    queryTypes[i] = new ArrayQueryType(carbonColumns[i].getColName(),
      carbonColumns[i].getColName(), i);
   } else if (DataTypes.isStructType(carbonColumns[i].getDataType())) {
    queryTypes[i] = new StructQueryType(carbonColumns[i].getColName(),
      carbonColumns[i].getColName(), i);
   } else {
    throw new UnsupportedOperationException(
      carbonColumns[i].getDataType().getName() + " is not supported");
   }
   fillChildren(carbontable, queryTypes[i], (CarbonDimension) carbonColumns[i], i, cache);
  }
 }
 return queryTypes;
}
origin: org.apache.carbondata/carbondata-core

  Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET));
row.setValues(new Object[] { DataTypeUtil.getDataBasedOnDataType(stringValue,
  columnExpression.getCarbonColumn().getDataType()) });
Boolean rslt = expression.evaluate(row).getBoolean();
if (null != rslt) {
origin: org.apache.carbondata/carbondata-hadoop

/**
 * This initialization is done inside executor task
 * for column dictionary involved in decoding.
 *
 * @param carbonColumns column list
 * @param carbonTable table identifier
 */
@Override public void initialize(CarbonColumn[] carbonColumns,
  CarbonTable carbonTable) throws IOException {
 this.carbonColumns = carbonColumns;
 dictionaries = new Dictionary[carbonColumns.length];
 dataTypes = new DataType[carbonColumns.length];
 for (int i = 0; i < carbonColumns.length; i++) {
  if (carbonColumns[i].hasEncoding(Encoding.DICTIONARY) && !carbonColumns[i]
    .hasEncoding(Encoding.DIRECT_DICTIONARY) && !carbonColumns[i].isComplex()) {
   CacheProvider cacheProvider = CacheProvider.getInstance();
   Cache<DictionaryColumnUniqueIdentifier, Dictionary> forwardDictionaryCache = cacheProvider
     .createCache(CacheType.FORWARD_DICTIONARY);
   dataTypes[i] = carbonColumns[i].getDataType();
   String dictionaryPath = carbonTable.getTableInfo().getFactTable().getTableProperties()
     .get(CarbonCommonConstants.DICTIONARY_PATH);
   dictionaries[i] = forwardDictionaryCache.get(new DictionaryColumnUniqueIdentifier(
     carbonTable.getAbsoluteTableIdentifier(),
     carbonColumns[i].getColumnIdentifier(), dataTypes[i], dictionaryPath));
  } else {
   dataTypes[i] = carbonColumns[i].getDataType();
  }
 }
}
origin: org.apache.carbondata/carbondata-streaming

for (int i = 0; i < measureCount; i++) {
 measureDataTypes[i] =
   dataFields[dimensionWithComplexCount + i].getColumn().getDataType();
origin: org.apache.carbondata/carbondata-processing

@Override public void initialize() throws IOException {
 super.initialize();
 // if logger is enabled then raw data will be required.
 RowConverterImpl rowConverter =
   new RowConverterImpl(configuration.getDataFields(), configuration, null);
 rowConverter.initialize();
 configuration.setCardinalityFinder(rowConverter);
 noDictionaryMapping =
   CarbonDataProcessorUtil.getNoDictionaryMapping(configuration.getDataFields());
 dataFieldsWithComplexDataType = new HashMap<>();
 convertComplexDataType(dataFieldsWithComplexDataType);
 dataTypes = new DataType[configuration.getDataFields().length];
 for (int i = 0; i < dataTypes.length; i++) {
  if (configuration.getDataFields()[i].getColumn().hasEncoding(Encoding.DICTIONARY)) {
   dataTypes[i] = DataTypes.INT;
  } else {
   dataTypes[i] = configuration.getDataFields()[i].getColumn().getDataType();
  }
 }
 orderOfData = arrangeData(configuration.getDataFields(), configuration.getHeader());
}
origin: org.apache.carbondata/carbondata-core

  .setColumnIndex(columnExpression.getCarbonColumn().getOrdinal());
msrColumnEvalutorInfo.setMeasure(columnExpression.getMeasure());
msrColumnEvalutorInfo.setType(columnExpression.getCarbonColumn().getDataType());
msrColEvalutorInfoList.add(msrColumnEvalutorInfo);
origin: org.apache.carbondata/carbondata-processing

DataType dataType = carbonColumn.getDataType();
if (DataTypes.isArrayType(dataType) || DataTypes.isMapType(dataType)) {
 List<CarbonDimension> listOfChildDimensions =
org.apache.carbondata.core.metadata.schema.table.columnCarbonColumngetDataType

Popular methods of CarbonColumn

  • getColName
  • hasEncoding
  • isComplex
  • getColumnSchema
  • isDimension
  • isMeasure
  • getOrdinal
  • getColumnId
  • getColumnIdentifier
  • <init>
  • getColumnProperties
  • getDefaultValue
  • getColumnProperties,
  • getDefaultValue,
  • getEncoder,
  • getSchemaOrdinal,
  • isInvisible,
  • isUseInvertedIndex,
  • setDateFormat,
  • setTimestampFormat,
  • setUseActualData

Popular in Java

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • setRequestProperty (URLConnection)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now