小编Ale*_*x L的帖子

如何将数据插入Hive中的Parquet表

我有简单的文本表(用","分隔),格式如下:

orderID INT, CustID INT, OrderTotal FLOAT, OrderNumItems INT, OrderDesc STRING
Run Code Online (Sandbox Code Playgroud)

我想将这些数据插入到Parquet表中:我使用以下方法创建了表:

CREATE TABLE parquet_test (orderID INT, CustID INT, OrderTotal FLOAT, 
OrderNumItems INT, OrderDesc STRING) 
ROW FORMAT SERDE 'parquet.hive.serde.ParquetHiveSerDe' stored as 
INPUTFORMAT 'parquet.hive.DeprecatedParquetInputFormat' 
OUTPUTFORMAT 'parquet.hive.DeprecatedParquetOutputFormat';
Run Code Online (Sandbox Code Playgroud)

但是当我试图使用时插入数据

insert overwrite table parquet_small_orders select * from small_orders;
Run Code Online (Sandbox Code Playgroud)

它失败.有什么想法吗?

hadoop hive parquet

6
推荐指数
2
解决办法
2万
查看次数

Microsoft MSAL - 获取多个范围的令牌

在 Azure Active Directory 中,我有一个应用程序需要在以下范围内使用 MicrosoftGraphAPI 和 SharePointAPI:

GraphAPI scopes:

"https://graph.microsoft.com/User.Read.All",
"https://graph.microsoft.com/Group.Read.All",
"https://graph.microsoft.com/Sites.Read.All",
"https://graph.microsoft.com/Calendars.Read.Shared",
"https://graph.microsoft.com/MailboxSettings.Read",
"https://graph.microsoft.com/Files.Read.All"
Run Code Online (Sandbox Code Playgroud)

SharePointAPI scopes:

"https://microsoft.sharepoint-df.com/AllSites.Read",
"https://microsoft.sharepoint-df.com/AllSites.FullControl",
"https://microsoft.sharepoint-df.com/User.Read.All"
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取该应用程序的令牌:

from msal import PublicClientApplication
AUTHORITY = 'https://login.microsoftonline.com/common'

scopes = [ "https://microsoft.sharepoint-df.com/AllSites.Read",
           "https://microsoft.sharepoint-df.com/AllSites.FullControl",
           "https://microsoft.sharepoint-df.com/User.Read.All"
           "https://graph.microsoft.com/User.Read.All",
           "https://graph.microsoft.com/Group.Read.All",
           "https://graph.microsoft.com/Sites.Read.All",
           "https://graph.microsoft.com/Calendars.Read.Shared",
           "https://graph.microsoft.com/MailboxSettings.Read",
           "https://graph.microsoft.com/Files.Read.All"
         ]

app = PublicClientApplication(client_id, authority=AUTHORITY)
flow = app.initiate_device_flow(scopes=scopes)
Run Code Online (Sandbox Code Playgroud)

但是在 WebUI 中批准该应用程序后,我收到以下错误:

'error_description': 'AADSTS28000: Provided value for the input parameter scope is not valid 
because it contains more than one resource. Scope https://graph.microsoft.com/Calendars.Read.Shared 
https://graph.microsoft.com/Files.Read.All https://graph.microsoft.com/Group.Read.All 

https://graph.microsoft.com/MailboxSettings.Read https://graph.microsoft.com/Sites.Read.All 

https://graph.microsoft.com/User.Read.All https://microsoft.sharepoint-df.com/AllSites.FullControl 
https://microsoft.sharepoint-df.com/AllSites.Read …
Run Code Online (Sandbox Code Playgroud)

sharepoint azure-ad-msal microsoft-graph-api

6
推荐指数
1
解决办法
1万
查看次数

如何禁用 Swing JTree 中的展开符号?

我正在 Swing 中工作,我想禁用某种类型节点上的展开(加号 [+])符号。

不知道该怎么做,因为我的节点不是叶子,我也无法使用setShowsRootHandles(仅适用于根)。

我指的是 JTree:假设我有这个结构:

--[+] 节点1

--[+] 节点2

当我加载这个结构时,我不想在节点2上看到[+]符号(因为它是一个特殊类型的节点)。但我也想通过使用特殊命令来扩展它。

我已经重写了 isLeaf() (来自 DefaultMutableTreeNode 的方法),因此当我处于特殊类型节点时它会设置为 TRUE,但是当我尝试扩展它时,它不会扩展,因为 isLeaf() = = 正确...

希望这会让事情变得更加清楚。

java swing expand jtree

5
推荐指数
1
解决办法
3816
查看次数

如何在 Scala 中定义和初始化矩阵

我有一个类,它具有二维数组作为私有成员 - k 行和 n 列(定义矩阵时不知道大小)。

我想使用一种特殊的方法初始化矩阵:initMatrix,它将设置矩阵中的行数和列数,并将所有数据初始化为 0。

我看到了一种通过以下方式初始化多维数组的方法:

  private var relationMatrix = Array.ofDim[Float](numOfRows,numOfCols)
Run Code Online (Sandbox Code Playgroud)

但是我如何定义它没有任何大小,然后再初始化它?

arrays scala matrix

5
推荐指数
1
解决办法
1万
查看次数

Scala 向量标量乘法

我正在 Apache Spark MLlib 中实现一些机器学习算法,我想将向量与标量相乘:

在此处输入图片说明

其中 u_i_j_m 是一个 Double 而 x_i 是一个向量

我尝试了以下方法:

import breeze.linalg.{ DenseVector => BDV, Vector => BV}
import org.apache.spark.mllib.linalg.{DenseVector, Vectors, Vector}
...

private def runAlgorithm(data: RDD[VectorWithNorm]): = {
    ...
    data.mapPartitions { data_ponts =>
        c = Array.fill(clustersNum)(BDV.zeros[Double](dim).asInstanceOf[BV[Double]])
        ...
        data_ponts.foreach { data_point =>
            ...
            u_i_j_m : Double = ....
            val temp= data_point.vector * u_i_j_m)
            // c(j) = temp
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

其中 VectorWithNorm 定义如下:

class VectorWithNorm(val vector: Vector, val norm: Double) extends Serializable {

    def this(vector: Vector) = …
Run Code Online (Sandbox Code Playgroud)

scala apache-spark apache-spark-mllib

4
推荐指数
1
解决办法
4288
查看次数

GoogleCloud BigQuery 异常处理

我正在尝试运行以下 GooleCould 的 BigQuery:

select REGEXP_REPLACE(SPLIT(site, "=")[OFFSET(1)], r'%\d+', ' ')
    from some_db
    where site = 'something'
    and STARTS_WITH(site, 'XXX')
Run Code Online (Sandbox Code Playgroud)

在执行过程中,我收到以下错误:

数组索引 1 越界(溢出)

当我使用 AWS Athena 时,我曾经使用try语句解决此类错误,但我找不到与 BigQuery 等效的任何内容。

我应该如何处理异常?

google-bigquery google-cloud-platform

4
推荐指数
1
解决办法
3879
查看次数

我在哪里可以找到 HEVC \ H.265 规范

我正在寻找 HEVC \ H.265 规范(特别是对于 hvc1 和 hvcC 原子),但我无法在线找到它们。

是否有免费的在线 HEVC 规范?

video h.265 hevc

3
推荐指数
2
解决办法
4739
查看次数

如何在C中设置uint8_t的3个低位

我想将 uint8_t 的 3 个下位设置为值 3。我尝试了以下操作:

uint8_t temp = some_value;
temp = temp & 0x3
Run Code Online (Sandbox Code Playgroud)

但这不起作用......

c bitwise-operators

1
推荐指数
1
解决办法
9845
查看次数