热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.hadoop.mapreduce.lib.db.DBConfiguration.getOutputFieldNames()方法的使用及代码示例

本文整理了Java中org.apache.hadoop.mapreduce.lib.db.DBConfiguration.getOutputFieldNames()方法

本文整理了Java中org.apache.hadoop.mapreduce.lib.db.DBConfiguration.getOutputFieldNames()方法的一些代码示例,展示了DBConfiguration.getOutputFieldNames()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DBConfiguration.getOutputFieldNames()方法的具体详情如下:
包路径:org.apache.hadoop.mapreduce.lib.db.DBConfiguration
类名称:DBConfiguration
方法名:getOutputFieldNames

DBConfiguration.getOutputFieldNames介绍

暂无

代码示例

代码示例来源:origin: io.hops/hadoop-mapreduce-client-core

/** {@inheritDoc} */
public RecordWriter getRecordWriter(TaskAttemptContext context)
throws IOException {
DBConfiguration dbCOnf= new DBConfiguration(context.getConfiguration());
String tableName = dbConf.getOutputTableName();
String[] fieldNames = dbConf.getOutputFieldNames();

if(fieldNames == null) {
fieldNames = new String[dbConf.getOutputFieldCount()];
}

try {
Connection cOnnection= dbConf.getConnection();
PreparedStatement statement = null;
DatabaseMetaData dbMeta = connection.getMetaData();
this.dbProductName = dbMeta.getDatabaseProductName().toUpperCase();
statement = connection.prepareStatement(
constructQuery(tableName, fieldNames));
return new DBRecordWriter(connection, statement);
} catch (Exception ex) {
throw new IOException(ex.getMessage());
}
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/** {@inheritDoc} */
public RecordWriter getRecordWriter(TaskAttemptContext context)
throws IOException {
DBConfiguration dbCOnf= new DBConfiguration(context.getConfiguration());
String tableName = dbConf.getOutputTableName();
String[] fieldNames = dbConf.getOutputFieldNames();

if(fieldNames == null) {
fieldNames = new String[dbConf.getOutputFieldCount()];
}

try {
Connection cOnnection= dbConf.getConnection();
PreparedStatement statement = null;
statement = connection.prepareStatement(
constructQuery(tableName, fieldNames));
return new DBRecordWriter(connection, statement);
} catch (Exception ex) {
throw new IOException(ex.getMessage());
}
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-core

/** {@inheritDoc} */
public RecordWriter getRecordWriter(TaskAttemptContext context)
throws IOException {
DBConfiguration dbCOnf= new DBConfiguration(context.getConfiguration());
String tableName = dbConf.getOutputTableName();
String[] fieldNames = dbConf.getOutputFieldNames();

if(fieldNames == null) {
fieldNames = new String[dbConf.getOutputFieldCount()];
}

try {
Connection cOnnection= dbConf.getConnection();
PreparedStatement statement = null;
statement = connection.prepareStatement(
constructQuery(tableName, fieldNames));
return new DBRecordWriter(connection, statement);
} catch (Exception ex) {
throw new IOException(ex.getMessage());
}
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-core

/** {@inheritDoc} */
public RecordWriter getRecordWriter(TaskAttemptContext context)
throws IOException {
DBConfiguration dbCOnf= new DBConfiguration(context.getConfiguration());
String tableName = dbConf.getOutputTableName();
String[] fieldNames = dbConf.getOutputFieldNames();

if(fieldNames == null) {
fieldNames = new String[dbConf.getOutputFieldCount()];
}

try {
Connection cOnnection= dbConf.getConnection();
PreparedStatement statement = null;
statement = connection.prepareStatement(
constructQuery(tableName, fieldNames));
return new DBRecordWriter(connection, statement);
} catch (Exception ex) {
throw new IOException(ex.getMessage());
}
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapred

/** {@inheritDoc} */
public RecordWriter getRecordWriter(TaskAttemptContext context)
throws IOException {
DBConfiguration dbCOnf= new DBConfiguration(context.getConfiguration());
String tableName = dbConf.getOutputTableName();
String[] fieldNames = dbConf.getOutputFieldNames();

if(fieldNames == null) {
fieldNames = new String[dbConf.getOutputFieldCount()];
}

try {
Connection cOnnection= dbConf.getConnection();
PreparedStatement statement = null;
statement = connection.prepareStatement(
constructQuery(tableName, fieldNames));
return new DBRecordWriter(connection, statement);
} catch (Exception ex) {
throw new IOException(ex.getMessage());
}
}

代码示例来源:origin: org.apache.hadoop/hadoop-mapred-test

public void testSetOutput() throws IOException {
Job job = Job.getInstance(new Configuration());
DBOutputFormat.setOutput(job, "hadoop_output", fieldNames);

DBConfiguration dbCOnf= new DBConfiguration(job.getConfiguration());
String actual = format.constructQuery(dbConf.getOutputTableName()
, dbConf.getOutputFieldNames());

assertEquals(expected, actual);

job = Job.getInstance(new Configuration());
dbCOnf= new DBConfiguration(job.getConfiguration());
DBOutputFormat.setOutput(job, "hadoop_output", nullFieldNames.length);
assertNull(dbConf.getOutputFieldNames());
assertEquals(nullFieldNames.length, dbConf.getOutputFieldCount());

actual = format.constructQuery(dbConf.getOutputTableName()
, new String[dbConf.getOutputFieldCount()]);

assertEquals(nullExpected, actual);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

public void testSetOutput() throws IOException {
Job job = Job.getInstance(new Configuration());
DBOutputFormat.setOutput(job, "hadoop_output", fieldNames);

DBConfiguration dbCOnf= new DBConfiguration(job.getConfiguration());
String actual = format.constructQuery(dbConf.getOutputTableName()
, dbConf.getOutputFieldNames());

assertEquals(expected, actual);

job = Job.getInstance(new Configuration());
dbCOnf= new DBConfiguration(job.getConfiguration());
DBOutputFormat.setOutput(job, "hadoop_output", nullFieldNames.length);
assertNull(dbConf.getOutputFieldNames());
assertEquals(nullFieldNames.length, dbConf.getOutputFieldCount());

actual = format.constructQuery(dbConf.getOutputTableName()
, new String[dbConf.getOutputFieldCount()]);

assertEquals(nullExpected, actual);
}

推荐阅读
  • 本文介绍了在sqoop1.4.*版本中,如何实现自定义分隔符的方法及步骤。通过修改sqoop生成的java文件,并重新编译,可以满足实际开发中对分隔符的需求。具体步骤包括修改java文件中的一行代码,重新编译所需的hadoop包等。详细步骤和编译方法在本文中都有详细说明。 ... [详细]
  • Java在运行已编译完成的类时,是通过java虚拟机来装载和执行的,java虚拟机通过操作系统命令JAVA_HOMEbinjava–option来启 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 重入锁(ReentrantLock)学习及实现原理
    本文介绍了重入锁(ReentrantLock)的学习及实现原理。在学习synchronized的基础上,重入锁提供了更多的灵活性和功能。文章详细介绍了重入锁的特性、使用方法和实现原理,并提供了类图和测试代码供读者参考。重入锁支持重入和公平与非公平两种实现方式,通过对比和分析,读者可以更好地理解和应用重入锁。 ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • 图像因存在错误而无法显示 ... [详细]
  • 设计模式——模板方法模式的应用和优缺点
    本文介绍了设计模式中的模板方法模式,包括其定义、应用、优点、缺点和使用场景。模板方法模式是一种基于继承的代码复用技术,通过将复杂流程的实现步骤封装在基本方法中,并在抽象父类中定义模板方法的执行次序,子类可以覆盖某些步骤,实现相同的算法框架的不同功能。该模式在软件开发中具有广泛的应用价值。 ... [详细]
author-avatar
相信奇迹的发生
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有