Tabnine Logo
HCatCreateTableDesc$Builder.partCols
Code IndexAdd Tabnine to your IDE (free)

How to use
partCols
method
in
org.apache.hive.hcatalog.api.HCatCreateTableDesc$Builder

Best Java code snippets using org.apache.hive.hcatalog.api.HCatCreateTableDesc$Builder.partCols (Showing top 2 results out of 315)

origin: apache/hive

@Test
public void testPartitionSchema() throws Exception {
 try {
  HCatClient client = HCatClient.create(new Configuration(hcatConf));
  final String dbName = "myDb";
  final String tableName = "myTable";
  client.dropDatabase(dbName, true, HCatClient.DropDBMode.CASCADE);
  client.createDatabase(HCatCreateDBDesc.create(dbName).build());
  List<HCatFieldSchema> columnSchema = Arrays.asList(new HCatFieldSchema("foo", Type.INT, ""),
    new HCatFieldSchema("bar", Type.STRING, ""));
  List<HCatFieldSchema> partitionSchema = Arrays.asList(new HCatFieldSchema("dt", Type.STRING, ""),
    new HCatFieldSchema("grid", Type.STRING, ""));
  client.createTable(HCatCreateTableDesc.create(dbName, tableName, columnSchema).partCols(partitionSchema).build());
  HCatTable table = client.getTable(dbName, tableName);
  List<HCatFieldSchema> partitionColumns = table.getPartCols();
  assertArrayEquals("Didn't get expected partition-schema back from the HCatTable.",
    partitionSchema.toArray(), partitionColumns.toArray());
  client.dropDatabase(dbName, false, HCatClient.DropDBMode.CASCADE);
 }
 catch (Exception unexpected) {
  LOG.error("Unexpected exception!", unexpected);
  assertTrue("Unexpected exception! " + unexpected.getMessage(), false);
 }
}
origin: apache/oozie

public void createTable(String db, String table, String partitionCols) throws Exception {
  List<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
  cols.add(new HCatFieldSchema("userid", Type.INT, "userid"));
  cols.add(new HCatFieldSchema("viewtime", Type.BIGINT, "view time"));
  cols.add(new HCatFieldSchema("pageurl", Type.STRING, "page url visited"));
  cols.add(new HCatFieldSchema("ip", Type.STRING, "IP Address of the User"));
  ArrayList<HCatFieldSchema> ptnCols = new ArrayList<HCatFieldSchema>();
  for (String partitionCol : partitionCols.split(",")) {
    ptnCols.add(new HCatFieldSchema(partitionCol, Type.STRING, null));
  }
  // Remove this once NotificationListener is fixed and available in HCat snapshot
  Map<String, String> tblProps = new HashMap<String, String>();
  tblProps.put(HCatConstants.HCAT_MSGBUS_TOPIC_NAME, "hcat." + db + "." + table);
  HCatCreateTableDesc tableDesc = HCatCreateTableDesc.create(db, table, cols).fileFormat("textfile")
      .partCols(ptnCols).tblProps(tblProps ).build();
  hcatClient.createTable(tableDesc);
  List<String> tables = hcatClient.listTableNamesByPattern(db, "*");
  assertTrue(tables.contains(table));
}
org.apache.hive.hcatalog.apiHCatCreateTableDesc$BuilderpartCols

Javadoc

Partition cols.

Popular methods of HCatCreateTableDesc$Builder

  • <init>
  • serdeParam
    used for setting arbitrary SerDe parameter
  • build
    Builds the HCatCreateTableDesc.
  • fileFormat
    File format.
  • tblProps
    Tbl props.
  • collectionItemsTerminatedBy
    See row_format element of CREATE_TABLE DDL for Hive.
  • escapeChar
    See row_format element of CREATE_TABLE DDL for Hive.
  • fieldsTerminatedBy
    See row_format element of CREATE_TABLE DDL for Hive.
  • linesTerminatedBy
    See row_format element of CREATE_TABLE DDL for Hive.
  • mapKeysTerminatedBy
    See row_format element of CREATE_TABLE DDL for Hive.
  • nullDefinedAs
    See row_format element of CREATE_TABLE DDL for Hive.
  • nullDefinedAs

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JOptionPane (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • From CI to AI: The AI layer in your organization
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