- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 spark scala 应用程序中运行 hive sql 查询,并在应用程序对存储在 s3 上的表执行查询时收到以下错误“No plan for HiveTableRelation”。这是代码:
package com.testapp.data
import org.apache.log4j.{Logger, Level}
import com.amazonaws.auth.{AWSCredentials, BasicSessionCredentials, DefaultAWSCredentialsProviderChain}
import play.api.libs.json.{JsObject, JsString, JsValue, Json}
import org.apache.spark._
import org.apache.spark.SparkContext._
import org.apache.spark.sql.SparkSession
import org.jets3t.service.S3Service
import scala.sys.process._
import java.io.File;
import org.apache.spark.sql.hive.HiveContext;
object TestEnrich {
def main(args: Array[String]) {
Logger.getRootLogger.setLevel(Level.INFO);
val controllerLogger = Logger.getLogger(this.getClass)
val dt = args(0);
val tm = args(1);
println(s"enrich request $dt, $tm")
val sparkConfig = new SparkConf()
.setAppName("enricher")
.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
.registerKryoClasses {
Array(
classOf[AWSCredentials],
classOf[BasicSessionCredentials],
classOf[DefaultAWSCredentialsProviderChain]
)
}
val sparkContext = SparkContext.getOrCreate(sparkConfig)
val spark = SparkSession.builder.config(sparkContext.getConf).enableHiveSupport().getOrCreate()
spark.sqlContext.setConf("spark.sql.caseSensitive", "true")
spark.sqlContext.setConf("javax.jdo.option.ConnectionURL", "xxxx")
spark.sqlContext.setConf("javax.jdo.option.ConnectionDriverName", "com.mysql.jdbc.Driver")
spark.sqlContext.setConf("javax.jdo.option.ConnectionUserName", "xxxx")
spark.sqlContext.setConf("javax.jdo.option.ConnectionPassword", "xxxx")
spark.sparkContext.hadoopConfiguration.set("fs.s3.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem")
spark.sparkContext.hadoopConfiguration.set("fs.s3.access.key", "xxxx");
spark.sparkContext.hadoopConfiguration.set("fs.s3.secret.key", "xxxx");
SparkSession.setDefaultSession(spark)
SparkSession.clearActiveSession()
import spark.sql;
import spark.implicits._;
val hiveContext = new org.apache.spark.sql.hive.HiveContext(spark.sparkContext);
import hiveContext._
hiveContext.sql("show databases").show();
hiveContext.sql("use production");
hiveContext.sql("show tables").show();
// error is thrown in next line
val data = hiveContext.sql(s"select * from raw_by_ts_events_nrt where dt='$dt' and tm='$tm' limit 5");
data.show();
sparkContext.stop()
}
}
CREATE TABLE hive.production.raw_by_ts_events_nrt (
ts bigint,
batchts bigint,
eventid varchar,
userid varchar,
...
dt varchar,
tm varchar
)
WITH (
external_location = 's3a://pb-prod-raw-by-ts-events-nrt/',
format = 'ORC',
partitioned_by = ARRAY['dt','tm']
)
18/08/28 06:50:05 INFO SessionState: Created local directory: /tmp/8efbfe25-22d0-43f2-8c65-9d4d27b1cb97_resources
18/08/28 06:50:05 INFO SessionState: Created HDFS directory: /tmp/hive/hadoop/8efbfe25-22d0-43f2-8c65-9d4d27b1cb97
18/08/28 06:50:05 INFO SessionState: Created local directory: /tmp/hadoop/8efbfe25-22d0-43f2-8c65-9d4d27b1cb97
18/08/28 06:50:05 INFO SessionState: Created HDFS directory: /tmp/hive/hadoop/8efbfe25-22d0-43f2-8c65-9d4d27b1cb97/_tmp_space.db
18/08/28 06:50:05 INFO HiveClientImpl: Warehouse location for Hive client (version 1.2.2) is hdfs:///user/spark/warehouse
18/08/28 06:50:06 INFO CodeGenerator: Code generated in 258.835732 ms
18/08/28 06:50:06 INFO CodeGenerator: Code generated in 15.359587 ms
+------------+
|databaseName|
+------------+
| default|
| production|
+------------+
18/08/28 06:50:06 INFO CodeGenerator: Code generated in 11.998794 ms
++
||
++
++
18/08/28 06:50:06 INFO CodeGenerator: Code generated in 22.778824 ms
18/08/28 06:50:06 INFO CodeGenerator: Code generated in 16.995158 ms
+----------+--------------------+-----------+
| database| tableName|isTemporary|
+----------+--------------------+-----------+
|production|raw_by_ts_events_nrt| false|
+----------+--------------------+-----------+
18/08/28 06:50:06 INFO ContextCleaner: Cleaned accumulator 1
18/08/28 06:50:06 INFO ContextCleaner: Cleaned accumulator 2
18/08/28 06:50:06 INFO ContextCleaner: Cleaned accumulator 0
18/08/28 06:50:07 WARN Utils: Truncated the string representation of a plan since it was too large. This behavior can be adjusted by setting 'spark.debug.maxToStringFields' in SparkEnv.conf.
Exception in thread "main" java.lang.AssertionError: assertion failed: No plan for HiveTableRelation `production`.`raw_by_ts_events_nrt`, org.apache.hadoop.hive.ql.io.orc.OrcSerde, [ts#26L, batchts#27L, eventid#28, userid#29, eventname#30, pageloaduid#31, deltatime#32, adaction#33, adduration#34, aderrordescription#35, adispreload#36, admoduleisloaded#37, adnetwork#38, adplacement#39, adplayer#40, adprogress#41, adrejectreason#42, adtag#43, adtargeting#44, adtype#45, aduuid#46, articlecanonicalurl#47, articleformat#48, articleid#49, ... 113 more fields], [dt#163, tm#164]
at scala.Predef$.assert(Predef.scala:170)
at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
at scala.collection.Iterator$class.foreach(Iterator.scala:893)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
at org.apache.spark.sql.execution.QueryExecution.sparkPlan$lzycompute(QueryExecution.scala:72)
at org.apache.spark.sql.execution.QueryExecution.sparkPlan(QueryExecution.scala:68)
at org.apache.spark.sql.execution.QueryExecution.executedPlan$lzycompute(QueryExecution.scala:77)
at org.apache.spark.sql.execution.QueryExecution.executedPlan(QueryExecution.scala:77)
at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3249)
at org.apache.spark.sql.Dataset.head(Dataset.scala:2484)
at org.apache.spark.sql.Dataset.take(Dataset.scala:2698)
at org.apache.spark.sql.Dataset.showString(Dataset.scala:254)
at org.apache.spark.sql.Dataset.show(Dataset.scala:723)
at org.apache.spark.sql.Dataset.show(Dataset.scala:682)
at org.apache.spark.sql.Dataset.show(Dataset.scala:691)
at com.playbuzz.data.TestEnrich$.main(TestEnrich.scala:90)
at com.playbuzz.data.TestEnrich.main(TestEnrich.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:894)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:198)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:228)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:137)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
最佳答案
如果您正在使用 spark-submit
你必须包括 spark.sql.catalogImplementation=hive
配置。像这样:
spark-submit --master yarn --deploy-mode cluster --conf spark.sql.catalogImplementation=hive yourApplication.jar
关于scala - java.lang.AssertionError : assertion failed: No plan for HiveTableRelation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52052179/
测试返回类型为 bool 的方法时。 你应该: expected = true; Assert.AreEqual(expected, actual); 或 Assert.IsTrue(actual);
我最近在编写新的 NUnit 测试时尝试使用 Assert.Equals() 方法。执行此方法时会抛出一个 AssertionException ,说明Assert.Equals 不应该用于断言。 乍
在 Chai 断言库中,当我们已经有了“assert.deepEqual()”时,“assert.equal()”有什么用"和 "assert.strictEqual()"用于严格和深度相等断言?还提
有没有办法断言 puppet 中的变量(或更具体地说,事实)具有特定值,如果没有则中止安装? 对于背景,情况如下: 在大多数情况下,我可以引用主机名,但有时我需要使用 IP 地址。例如,我们的日志收集
喜欢什么: Assert.That(obj.Foo, Is.EqualTo(true)) 或 Assert.True(obj.Foo) 对我来说,这两个断言是等价的,那么应该首选哪个? 最佳答案 在这
如何在 xUnit 中找到多个断言或软断言?我发现 Nunit 有以下能力,试图在 xUnit 中找到类似的选项。 Assert.Multiple(() => { Assert.AreEqua
有什么区别: Assert.Equals和 Assert.AreEqual Assert.NotNull和 Assert.IsNotNull ... ? 最佳答案 Assert.Equals 是一个对
我想写一个像这样工作的断言函数: //the following expression outputs "assertion failed" to std::err and then terminat
有人可以指出差异吗? 以上确实是我的问题,但是如果您也可以与他们分享您的经验以及您为什么使用其中一个。 最佳答案 它们只是两个不同的库,因此只需查看功能,尤其是报告功能,然后选择即可。 因为我是 的作
我无法找到断言 1 失败但断言 2 通过的原因: var a = Test.test1; var b = Test.test1; a.Should().BeSameAs(b); //1 Assert.
我正在为每个步骤使用 NUnit 断言运行自动化 BDD 步骤,即 Then And 我的 UI 测试。 NUnit 断言仅限于每个方法。这意味着如果方法中的断言失败,则不会运行其他步骤。 我正在考虑
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我只是在寻找一些示例,说明何时适合使用 Assert.Catch 或 Assert.Throws 断言单元测试中抛出的任何异常。我知道我也可以使用 ExpectedException,但我特别想知道“
Assert.AreEqual 和 Assert.AreSame 有什么区别? 最佳答案 这意味着 AreSame() 检查它们是否是完全相同的对象 - 如果引用指示内存中的相同对象。 AreEqua
在C#中,有什么区别 Assert.AreNotEqual 和 Assert.AreNotSame 最佳答案 这里给出的几乎所有答案都是正确的,但可能值得举个例子: public static str
我曾经在 NUnit 中使用过它们,它们非常有用。知道如何做类似的事情吗? 编辑,代码示例: bool condition = false;//would be nice not to have th
关于Arrange-Act-Assert的经典测试模式,我经常发现自己在 Act 之前添加了反断言。这样我就知道传递的断言确实是作为操作的结果传递的。 我认为它类似于红绿重构中的红色,只有当我在测试过
每当我创建断言时,Eclipse 都会建议我从这两个包之一导入它。 例如,当我尝试使用 assertArrayEquals() 比较数组时Eclipse 建议从其中之一导入它 org.junit.As
每当我创建断言时,Eclipse 都会建议我从这两个包之一导入它。 例如,当我尝试使用 assertArrayEquals() 比较数组时Eclipse 建议从其中之一导入它 org.junit.As
我是一名优秀的程序员,十分优秀!