这是我们的设置 - 我们有Hive在另一台机器上使用MySQL作为Metastore.我可以启动Hive命令行shell并创建一个表并对其进行描述.但是当我登录到用作Metastore的其他机器时,我无法在MySQL上看到Hive表的详细信息.
这里有蜂巢命令 -
hive> create table student(name STRING, id INT);
OK
Time taken: 7.464 seconds
hive> describe student;
OK
name string
id int
Time taken: 0.408 seconds
hive>
Run Code Online (Sandbox Code Playgroud)
接下来,我登录到安装了MySQL的机器,这个MySQL用作Hive Metastore.我使用"Metastore"数据库.但是,如果我想列出表格,我无法看到我在Hive中创建的表格或表格信息.
如何在Metastore中查看Hive表信息?
所以我正在编写一个非常小而简单的程序,它将一个数字作为输入,将其转换为十六进制,然后一次打印出两个字符。
对于某些数字,它会在输出前打印出 ffffff。
这是我的代码:
//Convert the input to an unsigned int
unsigned int a = strtoul (argv[1], NULL, 0);
//Convert the unsigned int to a char pointer
char* c = (char*) &a;
//Print out the char two at a time
for(int i = 0; i < 4; i++){
printf("%02x ", c[i]);
}
Run Code Online (Sandbox Code Playgroud)
大多数输出都很好,看起来像这样:
./hex_int 1
01 00 00 00
Run Code Online (Sandbox Code Playgroud)
但是对于某些数字,输出如下所示:
./hex_int 100000
ffffffa0 ffffff86 01 00
Run Code Online (Sandbox Code Playgroud)
如果您删除所有 f,则转换是正确的,但我无法弄清楚为什么它仅在某些输入上执行此操作。
谁有想法?
我有一个任务,找到这个代码错误的原因.
#include <stdlib.h>
#include <stdio.h>
#define fail(a) ((test == 0 || test == a) ? fail##a() : 0)
#define N (10)
int a[N] = { 1 };
int* b = &a[0];
void fail1()
{
printf("a[0] = %d\n", a[0]);
printf("b[0] = %d\n", b[0]);
printf("*b = %d\n", *b);
*b = 2;
a[N] = 3;
printf("*b = %d\n", *b);
}
...
int main(int argc, char **argv)
{
int test = 0;
if (argc > 1) {
sscanf(argv[1], "%d", &test);
printf("doing test %d\n", test); …Run Code Online (Sandbox Code Playgroud) 在此代码中,在为前两个scanf函数提供输入之后.输出自动显示.我学习了这种形式的scanf for string.但它并没有特别等待它.有什么建议 ?
#include <stdio.h>
int main()
{
int p;
int q;
char kog[50];
scanf("%d",&p);
scanf("%d",&q);
scanf("%50[^ ]s",kog);
printf("%d %d %s",p,q,kog);
return 0;
}
Run Code Online (Sandbox Code Playgroud)