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

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

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

origin: apache/hive

try {
 HCatCreateTableDesc tableDesc = HCatCreateTableDesc
  .create(null, tableName, cols).fileFormat("rcfile").build();
 client.createTable(tableDesc);
} catch (Exception exp) {
 client.dropTable(null, newName, true);
 HCatCreateTableDesc tableDesc2 = HCatCreateTableDesc
  .create(null, newName, cols).fileFormat("rcfile").build();
 client.createTable(tableDesc2);
 HCatTable newTable = client.getTable(null, newName);
origin: apache/hive

@Test
public void testCreateTableLike() throws Exception {
 HCatClient client = HCatClient.create(new Configuration(hcatConf));
 String tableName = "tableone";
 String cloneTable = "tabletwo";
 client.dropTable(null, tableName, true);
 client.dropTable(null, cloneTable, true);
 ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
 cols.add(new HCatFieldSchema("id", Type.INT, "id columns"));
 cols.add(new HCatFieldSchema("value", Type.STRING, "id columns"));
 HCatCreateTableDesc tableDesc = HCatCreateTableDesc
  .create(null, tableName, cols).fileFormat("rcfile").build();
 client.createTable(tableDesc);
 // create a new table similar to previous one.
 client.createTableLike(null, tableName, cloneTable, true, false, null);
 List<String> tables = client.listTableNamesByPattern(null, "table*");
 assertTrue(tables.size() == 2);
 client.close();
}
origin: apache/hive

cols.add(new HCatFieldSchema("value", Type.STRING, "value comment"));
HCatCreateTableDesc tableDesc = HCatCreateTableDesc
 .create(db, tableOne, cols).fileFormat("rcfile").build();
client.createTable(tableDesc);
HCatTable table1 = client.getTable(db, tableOne);
 tableThree, cols).fileFormat("orcfile").build();
client.createTable(tableDesc3);
HCatTable table3 = client.getTable(db, tableThree);
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));
}
origin: apache/oozie

public void createTable(String db, String table) 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"));
  // 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")
      .tblProps(tblProps ).build();
  hcatClient.createTable(tableDesc);
  List<String> tables = hcatClient.listTableNamesByPattern(db, "*");
  assertTrue(tables.contains(table));
}
origin: apache/hive

try {
 HCatCreateTableDesc tableDesc = HCatCreateTableDesc
  .create(null, tableName, cols).fileFormat("rcfile").build();
 client.createTable(tableDesc);
 client.dropTable(null, newName, true);
 HCatCreateTableDesc tableDesc2 = HCatCreateTableDesc
  .create(null, newName, cols).fileFormat("rcfile").build();
 client.createTable(tableDesc2);
 HCatTable newTable = client.getTable(null, newName);
origin: apache/hive

@Test
public void testRenameTable() throws Exception {
 HCatClient client = HCatClient.create(new Configuration(hcatConf));
 String tableName = "temptable";
 String newName = "mytable";
 client.dropTable(null, tableName, true);
 client.dropTable(null, newName, true);
 ArrayList<HCatFieldSchema> cols = new ArrayList<HCatFieldSchema>();
 cols.add(new HCatFieldSchema("id", Type.INT, "id columns"));
 cols.add(new HCatFieldSchema("value", Type.STRING, "id columns"));
 HCatCreateTableDesc tableDesc = HCatCreateTableDesc
  .create(null, tableName, cols).fileFormat("rcfile").build();
 client.createTable(tableDesc);
 client.renameTable(null, tableName, newName);
 try {
  client.getTable(null, tableName);
 } catch (HCatException exp) {
  assertTrue("Unexpected exception message: " + exp.getMessage(),
    exp.getMessage().contains("NoSuchObjectException while fetching table"));
 }
 HCatTable newTable = client.getTable(null, newName);
 assertTrue(newTable != null);
 assertTrue(newTable.getTableName().equals(newName));
 client.close();
}
org.apache.hive.hcatalog.apiHCatCreateTableDesc$BuilderfileFormat

Javadoc

File format.

Popular methods of HCatCreateTableDesc$Builder

  • <init>
  • serdeParam
    used for setting arbitrary SerDe parameter
  • build
    Builds the HCatCreateTableDesc.
  • partCols
    Partition cols.
  • 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

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for WebStorm
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