业务场景中Hive解析Json常用案例

news2024/11/18 21:28:56

业务场景中Hive解析Json常用案例

json在线工具

  • json格式转换在线工具
https://tool.lu/json/

  • format格式互转:
// 格式化可以合并整行显示
{"name":"John Doe","age":35,"email":"john@example.com"}

// 格式化可以展开显示,示例数据更清晰
{
  "name": "John Doe",
  "age": 35,
  "email": "john@example.com"
}
  • 转化常用yaml格式

工具提供了各种跨格式转化

age: 35
email: john@example.com
name: 'John Doe'

根据json串自动生成生成 Java 类等功能也非常实用

示例准备

需要Hive环境

  • test测试表
-- 在Hive中建测试表
CREATE TABLE json_test_table (
    id INT,
    json_column STRING
) STORED AS TEXTFILE;

json_column 字段用来存储需要处理的 json 串

示例 1: 提取单个字段

假设 JSON 数据包含用户信息

{
  "name": "John Doe",
  "age": 35,
  "email": "john@example.com"
}
  • 样例数据
insert into json_test_table values (1,'{"name":"John Doe","age":35,"email":"john@example.com"}');

select * from json_test_table where id = 1;
+------+---------------------------------------------------------+
| id   | json_column                                             |
+------+---------------------------------------------------------+
|    1 | {"name":"John Doe","age":35,"email":"john@example.com"} |
+------+---------------------------------------------------------+

使用 get_json_object 函数从 JSON 中提取字段:

SELECT get_json_object(json_column, '$.name') AS name FROM json_test_table where id = 1;

+-----------+
|   name    |
+-----------+
| John Doe  |
+-----------+
1 row selected (19.655 seconds)


SELECT get_json_object(json_column, '$.name') AS name,get_json_object(json_column, '$.age') AS age FROM json_test_table where id = 1;
+-----------+------+
|   name    | age  |
+-----------+------+
| John Doe  | 35   |
+-----------+------+
1 row selected (19.396 seconds)

示例 2: 提取嵌套字段

在 JSON 数据中有嵌套字段的情况下:

{
  "user": {
    "name": "Alice",
    "address": {
      "city": "New York",
      "zipcode": "10001"
    }
  }
}
  • 样例数据
insert into json_test_table values (2,'{"user":{"name":"Alice","address":{"city":"New York","zipcode":"10001"}}}');

select * from json_test_table where id = 2;
+------+---------------------------------------------------------------------------+
| id   | json_column                                                               |
+------+---------------------------------------------------------------------------+
|    2 | {"user":{"name":"Alice","address":{"city":"New York","zipcode":"10001"}}} |
+------+---------------------------------------------------------------------------+

提取嵌套字段的值:

SELECT get_json_object(json_column, '$.user.name') AS user_name,
       get_json_object(json_column, '$.user.address.city') AS city
FROM json_test_table where id = 2;

+------------+-----------+
| user_name  |   city    |
+------------+-----------+
| Alice      | New York  |
+------------+-----------+
1 row selected (19.38 seconds)

示例 3: 提取数组中的值

假设 JSON 数据包含一个数组:

{
  "tags": ["apple", "banana", "orange"]
}
  • 样例数据
insert into json_test_table values (3,'{"tags":["apple","banana","orange"]}');

select * from json_test_table where id = 3;
+------+--------------------------------------+
| id   | json_column                          |
+------+--------------------------------------+
|    3 | {"tags":["apple","banana","orange"]} |
+------+--------------------------------------+

从数组中提取值:

SELECT get_json_object(json_column, '$.tags[0]') AS first_tag,
       get_json_object(json_column, '$.tags[1]') AS second_tag
FROM json_test_table where id = 3;

+------------+-------------+
| first_tag  | second_tag  |
+------------+-------------+
| apple      | banana      |
+------------+-------------+
1 row selected (18.488 seconds)

示例 4: 提取数组列表长度

获取数组的长度:

-- 复用 示例3中样例数据
select * from json_test_table where id = 3;
+------+--------------------------------------+
| id   | json_column                          |
+------+--------------------------------------+
|    3 | {"tags":["apple","banana","orange"]} |
+------+--------------------------------------+
-- 可以看到数组tags对应的值有3个


SELECT size(split(get_json_object(json_column, '$.tags'), ',')) AS tags_length
FROM json_test_table
WHERE id = 3;

+--------------+
| tags_length  |
+--------------+
| 3            |
+--------------+
1 row selected (35.766 seconds)

示例 5:业务场景-解析公司基本信息案例

  • 假设JSON数据包含公司的基本信息,比如公司名称、注册资本等字段
{
  "company_name": "wangting_company",
  "registration": {
    "registered_capital": 1000000,
    "registered_date": "2020-01-01",
    "registered_address": "123 Main St, City"
  }
}

{"company_name":"wangting_company","registration":{"registered_capital":1000000,"registered_date":"2020-01-01","registered_address":"123 Main St, City"}}
-- 创建表
CREATE TABLE company_info (
    company_name STRING,
    registered_capital INT,
    registered_date STRING,
    registered_address STRING
) STORED AS TEXTFILE;

-- 转化插入数据
INSERT INTO company_info
SELECT
    get_json_object(json_data, '$.company_name') AS company_name,
    get_json_object(json_data, '$.registration.registered_capital') AS registered_capital,
    get_json_object(json_data, '$.registration.registered_date') AS registered_date,
    get_json_object(json_data, '$.registration.registered_address') AS registered_address
FROM
    (SELECT '{"company_name": "wangting_company", "registration": {"registered_capital": 1000000, "registered_date": "2020-01-01", "registered_address": "123 Main St, City"}}' AS json_data) t;
    
+----------------------------+----------------------------------+-------------------------------+----------------------------------+
| company_info.company_name  | company_info.registered_capital  | company_info.registered_date  | company_info.registered_address  |
+----------------------------+----------------------------------+-------------------------------+----------------------------------+
| wangting_company           | 1000000                          | 2020-01-01                    | 123 Main St, City                |
+----------------------------+----------------------------------+-------------------------------+----------------------------------+
1 row selected (0.411 seconds)

示例 6: 使用 LATERAL VIEW 解析数组

使用 LATERAL VIEWexplode 解析 JSON 数组:

-- 复用示例3样例数据
SELECT id, tag
FROM json_test_table
LATERAL VIEW explode(split(get_json_object(json_column, '$.tags'), ',')) exploded_tags AS tag
WHERE id = 3;

+-----+------------+
| id  |    tag     |
+-----+------------+
| 3   | ["apple"   |
| 3   | "banana"   |
| 3   | "orange"]  |
+-----+------------+
3 rows selected (17.318 seconds)

-- 仅展示解析数据,实际使用如需去除方括号,可以一并清洗

示例 7: 提取数组对象的值

如果数组包含对象,则提取对象的值:

{
  "users": [
    {
      "name": "Alice",
      "age": 28
    },
    {
      "name": "Bob",
      "age": 35
    }
  ]
}

{"users":[{"name":"Alice","age":28},{"name":"Bob","age":35}]}
  • 样例数据
insert into json_test_table values (7,'{"users":[{"name":"Alice","age":28},{"name":"Bob","age":35}]}');

select * from json_test_table where id = 7;
+------+---------------------------------------------------------------+
| id   | json_column                                                   |
+------+---------------------------------------------------------------+
|    7 | {"users":[{"name":"Alice","age":28},{"name":"Bob","age":35}]} |
+------+---------------------------------------------------------------+
SELECT get_json_object(json_column, '$.users[0].name') AS user1_name,
       get_json_object(json_column, '$.users[1].name') AS user2_name
FROM json_test_table where id = 7;

+-------------+-------------+
| user1_name  | user2_name  |
+-------------+-------------+
| Alice       | Bob         |
+-------------+-------------+
1 row selected (17.372 seconds)

示例 8: 处理日期

处理 JSON 中的日期字段:

{
  "event_date": "2023-11-21"
}

{"event_date":"2023-11-21"}
  • 样例数据
insert into json_test_table values (8,'{"event_date":"2023-11-21"}');

select * from json_test_table where id = 8;
+------+-----------------------------+
| id   | json_column                 |
+------+-----------------------------+
|    8 | {"event_date":"2023-11-21"} |
+------+-----------------------------+
SELECT get_json_object(json_column, '$.event_date') AS event_date
FROM json_test_table where id = 8;

+-------------+
| event_date  |
+-------------+
| 2023-11-21  |
+-------------+
1 row selected (17.436 seconds)


SELECT id, CAST(get_json_object(json_column, '$.event_date') AS DATE) AS event_date,
       YEAR(CAST(get_json_object(json_column, '$.event_date') AS DATE)) AS event_year,
       MONTH(CAST(get_json_object(json_column, '$.event_date') AS DATE)) AS event_month
FROM json_test_table
WHERE id = 8;

+-----+-------------+-------------+--------------+
| id  | event_date  | event_year  | event_month  |
+-----+-------------+-------------+--------------+
| 8   | 2023-11-21  | 2023        | 11           |
+-----+-------------+-------------+--------------+
1 row selected (17.363 seconds)

示例 9: 提取布尔值

提取 JSON 中的布尔字段:

{
  "is_active": true
}

{"is_active":true}
  • 样例数据
insert into json_test_table values (9,'{"is_active":true}');

select * from json_test_table where id = 9;
+------+--------------------+
| id   | json_column        |
+------+--------------------+
|    9 | {"is_active":true} |
+------+--------------------+
SELECT get_json_object(json_column, '$.is_active') AS is_active
FROM json_test_table where id = 9;
+------------+
| is_active  |
+------------+
| true       |
+------------+
1 row selected (18.401 seconds)


--  使用WHERE子句根据布尔值进行条件过滤。
SELECT *
FROM json_test_table
WHERE get_json_object(json_column, '$.is_active') = 'true';

+---------------------+------------------------------+
| json_test_table.id  | json_test_table.json_column  |
+---------------------+------------------------------+
| 9                   | {"is_active":true}           |
+---------------------+------------------------------+
1 row selected (17.327 seconds)

示例 10: json_tuple计算 JSON 对象数量

计算 JSON 对象中包含的键值对数量:

SELECT json_tuple(json_column, 'name', 'age') AS (name, age)
FROM json_test_table;

+-----------+-------+
|   name    |  age  |
+-----------+-------+
| John Doe  | 35    |
| NULL      | NULL  |
| NULL      | NULL  |
| NULL      | NULL  |
| NULL      | NULL  |
| NULL      | NULL  |
+-----------+-------+
6 rows selected (17.344 seconds)

-- 只有id=1符合条件 不符合条件均为NULL

示例 11: 使用 json_tuple 提取值

从 JSON 对象中使用 json_tuple 提取多个字段:

{
  "name": "John",
  "age": 30,
  "address": "New York"
}

{"name":"John","age":30,"address":"New York"}
  • 样例数据
insert into json_test_table values (11,'{"name":"John","age":30,"address":"New York"}');

select * from json_test_table where id = 11;
+------+-----------------------------------------------+
| id   | json_column                                   |
+------+-----------------------------------------------+
|   11 | {"name":"John","age":30,"address":"New York"} |
+------+-----------------------------------------------+
SELECT json_tuple(json_column, 'name', 'age', 'address') AS (name, age, address)
FROM json_test_table where id = 11;

+-------+------+-----------+
| name  | age  |  address  |
+-------+------+-----------+
| John  | 30   | New York  |
+-------+------+-----------+
1 row selected (17.414 seconds)

示例 12: 提取数字字段

从 JSON 中提取数字字段:

{
  "count": 50
}

{"count":50}
  • 样例数据
insert into json_test_table values (12,'{"count":50}');

select * from json_test_table where id = 12;
+------+--------------+
| id   | json_column  |
+------+--------------+
|   12 | {"count":50} |
+------+--------------+
SELECT get_json_object(json_column, '$.count') AS count
FROM json_test_table where id = 12;

+--------+
| count  |
+--------+
| 50     |
+--------+
1 row selected (19.401 seconds)

示例 13: 使用 get_json_object 过滤数据

根据 JSON 中的字段值进行过滤:

SELECT *
FROM json_test_table
WHERE get_json_object(json_column, '$.age') > 30;

+---------------------+----------------------------------------------------+
| json_test_table.id  |            json_test_table.json_column             |
+---------------------+----------------------------------------------------+
| 1                   | {"name":"John Doe","age":35,"email":"john@example.com"} |
+---------------------+----------------------------------------------------+
1 row selected (18.402 seconds)


SELECT *
FROM json_test_table
WHERE get_json_object(json_column, '$.age') > 10;

+---------------------+----------------------------------------------------+
| json_test_table.id  |            json_test_table.json_column             |
+---------------------+----------------------------------------------------+
| 1                   | {"name":"John Doe","age":35,"email":"john@example.com"} |
| 11                  | {"name":"John","age":30,"address":"New York"}      |
+---------------------+----------------------------------------------------+
2 rows selected (17.298 seconds)

示例 14: 处理空值

处理 JSON 数据中可能的空值:

{
  "status": null
}

{"status":null}
  • 样例数据
insert into json_test_table values (14,'{"status":null}');

select * from json_test_table where id = 14;
+------+-----------------+
| id   | json_column     |
+------+-----------------+
|   14 | {"status":null} |
+------+-----------------+
SELECT get_json_object(json_column, '$.status') AS status
FROM json_test_table where id = 14;

+---------+
| status  |
+---------+
| NULL    |
+---------+
1 row selected (17.345 seconds)


--  使用IS NULL或IS NOT NULL来检查字段是否为空
SELECT id, json_column
FROM json_test_table
WHERE id = 14 AND get_json_object(json_column, '$.status') IS NULL;

+-----+------------------+
| id  |   json_column    |
+-----+------------------+
| 14  | {"status":null}  |
+-----+------------------+
1 row selected (17.47 seconds)



-- 使用CASE语句对NULL值进行处理或者转换为其他值。
SELECT id, CASE WHEN get_json_object(json_column, '$.status') IS NULL THEN 'No Status' ELSE get_json_object(json_column, '$.status') END AS status
FROM json_test_table
WHERE id = 14;

+-----+------------+
| id  |   status   |
+-----+------------+
| 14  | No Status  |
+-----+------------+
1 row selected (17.31 seconds)

示例 15: 使用 get_json_object 判断是否存在字段

判断 JSON 是否包含特定字段:

SELECT 
  CASE WHEN get_json_object(json_column, '$.name') IS NOT NULL THEN 'Exists' ELSE 'Not Exists' END AS field_status
FROM json_test_table;
+---------------+
| field_status  |
+---------------+
| Exists        |
| Not Exists    |
| Exists        |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
+---------------+


SELECT 
  CASE WHEN get_json_object(json_column, '$.age') IS NOT NULL THEN 'Exists' ELSE 'Not Exists' END AS field_status
FROM json_test_table;

+---------------+
| field_status  |
+---------------+
| Exists        |
| Not Exists    |
| Exists        |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
+---------------+


SELECT 
  CASE WHEN get_json_object(json_column, '$.aaaaaaaaa') IS NOT NULL THEN 'Exists' ELSE 'Not Exists' END AS field_status
FROM json_test_table;

+---------------+
| field_status  |
+---------------+
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
| Not Exists    |
+---------------+
9 rows selected (17.337 seconds)

示例 16: 提取多层嵌套对象的值

从多层嵌套的 JSON 对象中提取值:

{
  "user": {
    "details": {
      "name": "Alice",
      "age": 30
    }
  }
}

{"user":{"details":{"name":"Alice","age":30}}}
  • 样例数据
insert into json_test_table values (16,'{"user":{"details":{"name":"Alice","age":30}}}');

select * from json_test_table where id = 16;
+------+------------------------------------------------+
| id   | json_column                                    |
+------+------------------------------------------------+
|   16 | {"user":{"details":{"name":"Alice","age":30}}} |
+------+------------------------------------------------+
SELECT 
  get_json_object(json_column, '$.user.details.name') AS user_name,
  get_json_object(json_column, '$.user.details.age') AS user_age
FROM json_test_table where id = 16;

+------------+-----------+
| user_name  | user_age  |
+------------+-----------+
| Alice      | 30        |
+------------+-----------+
1 row selected (16.253 seconds)

示例 17: 提取嵌套对象数组的值

从嵌套的对象数组中提取值:

{
  "employees": [
    {
      "name": "Alice",
      "department": "HR"
    },
    {
      "name": "Bob",
      "department": "Engineering"
    }
  ]
}

{"employees":[{"name":"Alice","department":"HR"},{"name":"Bob","department":"Engineering"}]}
  • 样例数据
insert into json_test_table values (17,'{"employees":[{"name":"Alice","department":"HR"},{"name":"Bob","department":"Engineering"}]}');

select * from json_test_table where id = 17;
+------+----------------------------------------------------------------------------------------------+
| id   | json_column                                                                                  |
+------+----------------------------------------------------------------------------------------------+
|   17 | {"employees":[{"name":"Alice","department":"HR"},{"name":"Bob","department":"Engineering"}]} |
+------+----------------------------------------------------------------------------------------------+
SELECT 
  get_json_object(json_column, '$.employees[0].name') AS employee1_name,
  get_json_object(json_column, '$.employees[1].name') AS employee2_name
FROM json_test_table where id = 17;

+-----------------+-----------------+
| employee1_name  | employee2_name  |
+-----------------+-----------------+
| Alice           | Bob             |
+-----------------+-----------------+
1 row selected (17.273 seconds)

示例 18: 提取数组对象的多个值

取数组对象的多个值

从数组对象中提取多个值:

{
  "items": [
    {
      "id": 1,
      "name": "Item 1"
    },
    {
      "id": 2,
      "name": "Item 2"
    }
  ]
}

{"items":[{"id":1,"name":"Item 1"},{"id":2,"name":"Item 2"}]}
  • 样例数据
insert into json_test_table values (18,'{"items":[{"id":1,"name":"Item 1"},{"id":2,"name":"Item 2"}]}');

select * from json_test_table where id = 18;
+------+---------------------------------------------------------------+
| id   | json_column                                                   |
+------+---------------------------------------------------------------+
|   18 | {"items":[{"id":1,"name":"Item 1"},{"id":2,"name":"Item 2"}]} |
+------+---------------------------------------------------------------+
SELECT 
  get_json_object(json_column, '$.items[0].id') AS item1_id,
  get_json_object(json_column, '$.items[0].name') AS item1_name,
  get_json_object(json_column, '$.items[1].id') AS item2_id,
  get_json_object(json_column, '$.items[1].name') AS item2_name
FROM json_test_table where id = 18;

+-----------+-------------+-----------+-------------+
| item1_id  | item1_name  | item2_id  | item2_name  |
+-----------+-------------+-----------+-------------+
| 1         | Item 1      | 2         | Item 2      |
+-----------+-------------+-----------+-------------+
1 row selected (17.386 seconds)

示例19: json_serde解析映射数据文件的使用介绍

  • json_serde库提供了一种在Hive中直接将JSON格式的数据解析成表的方式,可简化处理流程。

如果现在有一个json文件:

[app@ali-wangting wangt]$ cat wangt.json

{"name":"wangting01","age":21,"email":"wangting01@example.com"}
{"name":"wangting02","age":22,"email":"wangting02@example.com"}
{"name":"wangting03","age":23,"email":"wangting03@example.com"}
{"name":"wangting04","age":24,"email":"wangting04@example.com"}
{"name":"wangting05","age":25,"email":"wangting05@example.com"}
{"name":"wangting06","age":26,"email":"wangting06@example.com"}
{"name":"wangting07","age":27,"email":"wangting07@example.com"}
{"name":"wangting08","age":28,"email":"wangting08@example.com"}

现在希望建立一张表,使得表可以直接映射上数据文件

  • hive中建表
CREATE TABLE IF NOT EXISTS wangt_666_json(
  name string,
  age int,
  email string
)
ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
stored as textfile;


desc wangt_json_table;
+-----------+------------+--------------------+
| col_name  | data_type  |      comment       |
+-----------+------------+--------------------+
| name      | string     | from deserializer  |
| age       | int        | from deserializer  |
| email     | string     | from deserializer  |
+-----------+------------+--------------------+
  • 将json文件上传至建表对应hdfs路径
[app@ali-wangting wangt]$ hdfs dfs -ls /user/hive/warehouse/wangt.db/wangt_666_json/
[app@ali-wangting wangt]$ hdfs dfs -put wangt.json /user/hive/warehouse/wangt.db/wangt_666_json/
[app@ali-wangting wangt]$ hdfs dfs -ls /user/hive/warehouse/wangt.db/wangt_666_json/
Found 1 items
-rwxrwx--x+  2 hive hive        512 2023-12-04 16:38 /user/hive/warehouse/wangt.db/wangt_666_json/wangt.json

# 也可以通过hive的sql命令行直接load数据文件
load data local inpath '/home/wangt/wangt.json' into table wangt_666_json;
  • 查看表数据验证
select * from wangt_666_json;
+----------------------+---------------------+-------------------------+
| wangt_666_json.name  | wangt_666_json.age  |  wangt_666_json.email   |
+----------------------+---------------------+-------------------------+
| wangting01           | 21                  | wangting01@example.com  |
| wangting02           | 22                  | wangting02@example.com  |
| wangting03           | 23                  | wangting03@example.com  |
| wangting04           | 24                  | wangting04@example.com  |
| wangting05           | 25                  | wangting05@example.com  |
| wangting06           | 26                  | wangting06@example.com  |
| wangting07           | 27                  | wangting07@example.com  |
| wangting08           | 28                  | wangting08@example.com  |
+----------------------+---------------------+-------------------------+
8 rows selected (0.5 seconds)

可以看到数据文件8行记录,成功映射对应了hive中wangt_666_json表的8条数据

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1283244.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

vm net 方式 静态ip配置访问主机IP和外网

1、win 11 安装vm,镜像文件 F:\software\VMwork\CentOS-7-x86_64-Everything-1804.iso 2、配置网络 net 方式 3、右击网络--》属性---》更改适配器设置--》vmnet8 属性 如果没有vm1、vm8 虚拟机编辑---》虚拟机网络编辑器-->还原默认设置 注意:这…

ONLYOFFICE 协作空间 2.0 现已发布:新增公共房间、插件、重新分配数据、RTL 界面等功能

更新后的 ONLYOFFICE 协作空间新增诸多实用功能,全平台实现多项优化功能。请继续阅读,了解所有更新。 ONLYOFFICE 协作空间是什么 ONLYOFFICE 协作空间是一款开源效率平台,让您与同事、团队成员、客户、合作伙伴、承包商、赞助商和其他第三方…

大学生如何搭建自己的网站

这篇是我在大一的时候,写过的一篇文章。 前言 作为一名大学生,我觉得搭建个人网站很有意义。 这篇博客讲述的是这个寒假,我是如何从零到搭建好个人网站的过程。我提供的主要是具体的思路,也附带了一些零零散散的细节。时间跨度…

GVIM 配置 for begin/end class/endclass 等配对

有时候我们的代码很长,或者结构比较复杂,多个if/else 或者begin/end 快嵌套,为了阅读方便,利用gvim插件实现块跳转还是很有实用性的,下面的.vimrc的配置,简单方便。 使用方式: 将光标定位到块头…

全球与中国汽车电力电子市场:增长趋势、竞争格局与前景展望

目前,世界各国都致力于转向更环保、更永续的传统交通替代方案。 电动车满足所有要求,因为它们具有零废气排放、改善空气品质、减少温室气体排放并创造更清洁、更健康的环境。此外,电动车的运作成本比传统内燃机驱动的汽车低,因为…

HTML5+CSS3+Vue小实例:饮料瓶造型文字旋转特效

实例:饮料瓶造型文字旋转特效 技术栈:HTML+CSS+Vue 效果: 源码: 【HTML】【JS】 <!DOCTYPE html> <html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="viewport" …

linux 内核regulator

问题 在sys文件系统下没有生成cpu 调频的相关节点。 日志对比 [ 3.588745] cpu cpu4: Looking up cpu-supply from device tree [ 3.588753] cpu cpu4: Failed to get reg [ 3.588791] cpu cpu4: Looking up cpu-supply from device tree [ 3.588808] Failed to i…

React 笔记 jsx

严格约定&#xff1a;React 组件必须以大写字母开头&#xff0c;而 HTML 标签则必须是小写字母。 React JSX JSX 是由 React 推广的 JavaScript 语法扩展。 用于表达组件的 特殊语法的 js 函数 要求标签必须闭合&#xff1b;返回的组件必须包裹在一个父标签内&#xff1b; …

Python使用cURL库下载文件

Python使用cURL库下载文件 cURL库是一个功能强大的工具&#xff0c;可以用于在Python中下载文件。以下是一个简单的Python程序&#xff0c;使用cURL库实现文件下载功能&#xff1a; import subprocess def download_file(url, output_path): command [curl, -o, …

开启全新消费革命——消费增值,让每一笔消费变成财富!

你是否厌倦了仅仅购买物品或享受服务后便一无所有的消费方式&#xff1f;现在&#xff0c;消费增值的概念将彻底改变你的消费观念&#xff01;通过参与消费增值&#xff0c;你的每一笔消费都将变得更有价值&#xff01; 消费增值是一种全新的消费理念&#xff0c;它让你在购物的…

前后端验证码分析(字母计算)

样式&#xff1a; 前端&#xff1a; login.vue <template> <view class"normal-login-container"> <view class"login-form-content"> <view class"input-item flex align-center"> <view class"iconfont ic…

SpringBootApplication注解保姆级带你如何应对面试官

SpringBootApplication注解保姆级带你如何应对面试官 一介绍 在Java Spring Boot框架中&#xff0c;SpringBootApplication注解是一个组合注解&#xff0c;它由以下三个注解组成&#xff1a;SpringBootConfiguration&#xff0c;EnableAutoConfiguration和ComponentScan。 这…

绿色建筑革新,气膜球馆成为城市锻炼新热点

近年来&#xff0c;全民健身设施蓬勃发展&#xff0c;个性化球场设计逐渐取代了传统模式&#xff0c;其中备受欢迎的是新潮的绿色建筑——气膜室内球馆。这种创新的建筑形式不仅适用于传统的篮球、足球、羽毛球等常规运动&#xff0c;还可以容纳冰壶、滑雪等更为复杂的活动&…

MySQL入门实战:安装与配置基础

MySQL是一个开源的关系型数据库管理系统&#xff0c;由瑞典MySQL AB公司开发&#xff0c;目前已经被Sun Microsystems公司收购。MySQL是一个非常流行的数据库管理系统&#xff0c;它的特点是轻量级、高性能、易于使用和高度可扩展。 MySQL是一个基于客户端/服务器的系统&#…

浅谈基于能耗评价指标的医院智能配电能效管理分析

摘要&#xff1a;目的&#xff1a;为了更好地推进医院能源管理工作&#xff0c;主要利用空调系统分项能耗对上海7所三甲医院能源管理工作存在的问题进行分析。方法&#xff1a;Pearson系数被用作分析影响因素与医院总能耗的关联程度&#xff0c;再利用单位面积总能耗和空调系统…

基于Gradio的快速搭建AI算法可视化Web界面部署教程

基于Gradio的快速搭建AI算法可视化Web界面部署教程 1 Gradio简介1.1 视图框架1.2 Gradio介绍 2 功能模块2.1 概述2.2 模块介绍2.2.1 gradio.File() 上传文件2.2.2 gradio.Slider() 配置滑动条2.2.3 gr.Textbox() 文本框2.2.4 gradio.Dropdown() 建立下拉列表2.2.5 gradio.inter…

分享80个菜单导航JS特效,总有一款适合您

分享80个菜单导航JS特效&#xff0c;总有一款适合您 80个菜单导航JS特效下载链接&#xff1a;https://pan.baidu.com/s/1NgNc759Kg1of_8vR7kaj6A?pwd6666 提取码&#xff1a;6666 Python采集代码下载链接&#xff1a;采集代码.zip - 蓝奏云 学习知识费力气&#xff0c;…

面向对象及编程

C语言是一门面向过程的编程语言&#xff0c; C、Java这些编程语言都是面向对象。 分门别类&#xff1a;抽取事物的共性&#xff0c;将相似事物归纳为一个类别 面向的对象的核心概念&#xff1a; 类&#xff1a;就是一个事物的类别 |--属性 …

数据结构和算法专题---1、数据结构和算法概述

本文会系统性的介绍算法的概念、复杂度&#xff0c;后续会更新算法思想以及常见的失效算法、限流算法、调度算法、定时算法等&#xff0c;辅助大家快速学习算法和数据结构知识。 概念 数据结构 概述 数据结构是计算机存储、组织数据的方式。数据结构是指相互之间存在一种或…