congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HCatContext
Code IndexAdd Tabnine to your IDE (free)

How to use
HCatContext
in
org.apache.hive.hcatalog.common

Best Java code snippets using org.apache.hive.hcatalog.common.HCatContext (Showing top 13 results out of 315)

origin: apache/hive

@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
 Table table = phutil.getTable(location,
  hcatServerUri != null ? hcatServerUri : PigHCatUtil.getHCatServerUri(job),
  PigHCatUtil.getHCatServerPrincipal(job),
  // Pass job to initialize metastore conf overrides for embedded metastore case
  // (hive.metastore.uris = "").
  job);
 HCatSchema hcatTableSchema = HCatUtil.getTableSchemaWithPtnCols(table);
 try {
  PigHCatUtil.validateHCatTableSchemaFollowsPigRules(hcatTableSchema);
 } catch (IOException e) {
  throw new PigException(
   "Table schema incompatible for reading through HCatLoader :" + e.getMessage()
    + ";[Table schema was " + hcatTableSchema.toString() + "]"
   , PigHCatUtil.PIG_EXCEPTION_CODE, e);
 }
 storeInUDFContext(signature, HCatConstants.HCAT_TABLE_SCHEMA, hcatTableSchema);
 outputSchema = hcatTableSchema;
 return PigHCatUtil.getResourceSchema(hcatTableSchema);
}
origin: apache/hive

private static Object serializePrimitiveField(Object field,
  ObjectInspector fieldObjectInspector) {
 if (field == null) {
  return null;
 }
 Object f = ((PrimitiveObjectInspector) fieldObjectInspector).getPrimitiveJavaObject(field);
 if (f != null && HCatContext.INSTANCE.getConf().isPresent()) {
  Configuration conf = HCatContext.INSTANCE.getConf().get();
  if (f instanceof Boolean &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER,
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER_DEFAULT)) {
   return ((Boolean) f) ? 1 : 0;
  } else if (f instanceof Short &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Short) f);
  } else if (f instanceof Byte &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Byte) f);
  }
 }
 return f;
}
origin: org.spark-project.hive.hcatalog/hive-hcatalog-core

private static Object serializePrimitiveField(Object field,
  ObjectInspector fieldObjectInspector) {
 if (field == null) {
  return null;
 }
 Object f = ((PrimitiveObjectInspector) fieldObjectInspector).getPrimitiveJavaObject(field);
 if (f != null && HCatContext.INSTANCE.getConf().isPresent()) {
  Configuration conf = HCatContext.INSTANCE.getConf().get();
  if (f instanceof Boolean &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER,
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER_DEFAULT)) {
   return ((Boolean) f) ? 1 : 0;
  } else if (f instanceof Short &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Short) f);
  } else if (f instanceof Byte &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Byte) f);
  }
 }
 return f;
}
origin: apache/hive

@Override
public void setLocation(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
origin: org.apache.hive.hcatalog/hive-hcatalog-core

private static Object serializePrimitiveField(Object field,
  ObjectInspector fieldObjectInspector) {
 if (field == null) {
  return null;
 }
 Object f = ((PrimitiveObjectInspector) fieldObjectInspector).getPrimitiveJavaObject(field);
 if (f != null && HCatContext.INSTANCE.getConf().isPresent()) {
  Configuration conf = HCatContext.INSTANCE.getConf().get();
  if (f instanceof Boolean &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER,
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER_DEFAULT)) {
   return ((Boolean) f) ? 1 : 0;
  } else if (f instanceof Short &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Short) f);
  } else if (f instanceof Byte &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Byte) f);
  }
 }
 return f;
}
origin: org.apache.hive.hcatalog/hive-hcatalog-pig-adapter

@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
 Table table = phutil.getTable(location,
  hcatServerUri != null ? hcatServerUri : PigHCatUtil.getHCatServerUri(job),
  PigHCatUtil.getHCatServerPrincipal(job),
  // Pass job to initialize metastore conf overrides for embedded metastore case
  // (hive.metastore.uris = "").
  job);
 HCatSchema hcatTableSchema = HCatUtil.getTableSchemaWithPtnCols(table);
 try {
  PigHCatUtil.validateHCatTableSchemaFollowsPigRules(hcatTableSchema);
 } catch (IOException e) {
  throw new PigException(
   "Table schema incompatible for reading through HCatLoader :" + e.getMessage()
    + ";[Table schema was " + hcatTableSchema.toString() + "]"
   , PigHCatUtil.PIG_EXCEPTION_CODE, e);
 }
 storeInUDFContext(signature, HCatConstants.HCAT_TABLE_SCHEMA, hcatTableSchema);
 outputSchema = hcatTableSchema;
 return PigHCatUtil.getResourceSchema(hcatTableSchema);
}
origin: com.github.hyukjinkwon.hcatalog/hive-hcatalog-core

private static Object serializePrimitiveField(Object field,
  ObjectInspector fieldObjectInspector) {
 if (field == null) {
  return null;
 }
 Object f = ((PrimitiveObjectInspector) fieldObjectInspector).getPrimitiveJavaObject(field);
 if (f != null && HCatContext.INSTANCE.getConf().isPresent()) {
  Configuration conf = HCatContext.INSTANCE.getConf().get();
  if (f instanceof Boolean &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER,
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER_DEFAULT)) {
   return ((Boolean) f) ? 1 : 0;
  } else if (f instanceof Short &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Short) f);
  } else if (f instanceof Byte &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Byte) f);
  }
 }
 return f;
}
origin: com.cloudera.recordservice/recordservice-hcatalog-pig-adapter

@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
 Table table = phutil.getTable(location,
  hcatServerUri != null ? hcatServerUri : PigHCatUtil.getHCatServerUri(job),
  PigHCatUtil.getHCatServerPrincipal(job),
  // Pass job to initialize metastore conf overrides for embedded metastore case
  // (hive.metastore.uris = "").
  job);
 HCatSchema hcatTableSchema = HCatUtil.getTableSchemaWithPtnCols(table);
 try {
  PigHCatUtil.validateHCatTableSchemaFollowsPigRules(hcatTableSchema);
 } catch (IOException e) {
  throw new PigException(
   "Table schema incompatible for reading through HCatLoader :" + e.getMessage()
    + ";[Table schema was " + hcatTableSchema.toString() + "]"
   , PigHCatUtil.PIG_EXCEPTION_CODE, e);
 }
 storeInUDFContext(signature, HCatConstants.HCAT_TABLE_SCHEMA, hcatTableSchema);
 outputSchema = hcatTableSchema;
 return PigHCatUtil.getResourceSchema(hcatTableSchema);
}
origin: com.facebook.presto.hive/hive-apache

private static Object serializePrimitiveField(Object field,
  ObjectInspector fieldObjectInspector) {
 if (field == null) {
  return null;
 }
 Object f = ((PrimitiveObjectInspector) fieldObjectInspector).getPrimitiveJavaObject(field);
 if (f != null && HCatContext.INSTANCE.getConf().isPresent()) {
  Configuration conf = HCatContext.INSTANCE.getConf().get();
  if (f instanceof Boolean &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER,
    HCatConstants.HCAT_DATA_CONVERT_BOOLEAN_TO_INTEGER_DEFAULT)) {
   return ((Boolean) f) ? 1 : 0;
  } else if (f instanceof Short &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Short) f);
  } else if (f instanceof Byte &&
   conf.getBoolean(
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION,
    HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION_DEFAULT)) {
   return new Integer((Byte) f);
  }
 }
 return f;
}
origin: com.github.hyukjinkwon.hcatalog/hive-hcatalog-pig-adapter

@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
 Table table = phutil.getTable(location,
  hcatServerUri != null ? hcatServerUri : PigHCatUtil.getHCatServerUri(job),
  PigHCatUtil.getHCatServerPrincipal(job),
  // Pass job to initialize metastore conf overrides for embedded metastore case
  // (hive.metastore.uris = "").
  job);
 HCatSchema hcatTableSchema = HCatUtil.getTableSchemaWithPtnCols(table);
 try {
  PigHCatUtil.validateHCatTableSchemaFollowsPigRules(hcatTableSchema);
 } catch (IOException e) {
  throw new PigException(
   "Table schema incompatible for reading through HCatLoader :" + e.getMessage()
    + ";[Table schema was " + hcatTableSchema.toString() + "]"
   , PigHCatUtil.PIG_EXCEPTION_CODE, e);
 }
 storeInUDFContext(signature, HCatConstants.HCAT_TABLE_SCHEMA, hcatTableSchema);
 outputSchema = hcatTableSchema;
 return PigHCatUtil.getResourceSchema(hcatTableSchema);
}
origin: com.cloudera.recordservice/recordservice-hcatalog-pig-adapter

@Override
public void setLocation(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
 UDFContext udfContext = UDFContext.getUDFContext();
origin: com.github.hyukjinkwon.hcatalog/hive-hcatalog-pig-adapter

@Override
public void setLocation(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
origin: org.apache.hive.hcatalog/hive-hcatalog-pig-adapter

@Override
public void setLocation(String location, Job job) throws IOException {
 HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
  .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);
org.apache.hive.hcatalog.commonHCatContext

Javadoc

HCatContext is a singleton that provides global access to configuration data.

HCatalog provides a variety of functionality that users can configure at runtime through configuration properties. Available configuration properties are defined in HCatConstants. HCatContext allows users to enable optional functionality by setting properties in a provided configuration.

HCatalog users (MR apps, processing framework adapters) should set properties in a configuration that has been provided to #setConf(org.apache.hadoop.conf.Configuration) to enable optional functionality. The job configuration must be used to ensure properties are passed to the backend MR tasks.

HCatalog developers should enable optional functionality by checking properties from #getConf(). Since users are not obligated to set a configuration, optional functionality must provide a sensible default.

Most used methods

  • getConf
    Get the configuration, if there is one. Users are not required to setup HCatContext unless they wish
  • setConf
    Use the given configuration for optional behavior. Keys exclusive to an existing config are set in t

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • setScale (BigDecimal)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Kernel (java.awt.image)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Top Vim 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