我正在运行以下spark-java代码.
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.hive.HiveContext;
import org.apache.spark.sql.DataFrame;
import org.apache.spark.sql.SQLContext;
import org.apache.hadoop.fs.*;
public class Resource{
public static void main(String[] args) {
SparkConf conf = new SparkConf().setAppName("cust data");
JavaSparkContext jsc = new JavaSparkContext(conf);
HiveContext hiveSQLContext = new org.apache.spark.sql.hive.HiveContext(jsc.sc());
DataFrame df = hiveSQLContext.sql(" select * from emprecord");
df.registerTempTable("mytempTable");//creating temptable
hiveSQLContext.sql("create table xyz as select * from mytempTable");//inserting into hie table
jsc.close(
}
}
Run Code Online (Sandbox Code Playgroud)
[harsha@hdp-poc1 SparkworkingJars]$ javac -cp $CLASSPATH Resource.java
warning: /home/harsha/SparkworkingJars/spark-core_2.11- 1.6.1.jar(org/apache/spark/api/java/JavaSparkContextVarargsWorkaround.class): major version 51 is newer than 50, the …Run Code Online (Sandbox Code Playgroud) 这与我在oracle DB中创建视图时获取错误的问题有关
我尝试了下面的内容,但在第6行获取了重复的错误列
CREATE VIEW ReturnCode90
AS
SELECT t.ret_code,
TO_CHAR (t.creation_dt, 'DD-MON-YYYY HH24:MI:SS') Created_Date,
CURRENT_TIMESTAMP Curr_tmp,
t.*
FROM buff.log t
WHERE t.ret_Code = '90'
order by t.creation_dt desc;
Run Code Online (Sandbox Code Playgroud)