kyuubi/python/scripts/make_one_row_complex.sh
Cheng Pan f8c7b93f55
[KYUUBI #5686][FOLLOWUP] Rename pyhive to python
# 🔍 Description

This is the follow-up of #5686, renaming `./pyhive` to `./python`, and also adding `**/python/*` to RAT exclusion list temporarily.

"PyHive" may not be a suitable name after being part of Apache Kyuubi, let's use a generic dir name `python`, and discuss the official name later(we probably keep the code at `./python` eventually).

## Types of changes 🔖

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

Recover RAT checked.

---

# Checklist 📝

- [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes #6279 from pan3793/pyhive-1.

Closes #5686

42d338e71 [Cheng Pan] [KYUUBI #5686][FOLLOWUP] Rename pyhive to python

Authored-by: Cheng Pan <chengpan@apache.org>
Signed-off-by: Cheng Pan <chengpan@apache.org>
2024-04-09 20:30:02 +08:00

65 lines
1.4 KiB
Bash
Executable File

#!/bin/bash -eux
COLUMNS='
`boolean` BOOLEAN,
`tinyint` TINYINT,
`smallint` SMALLINT,
`int` INT,
`bigint` BIGINT,
`float` FLOAT,
`double` DOUBLE,
`string` STRING,
`timestamp` TIMESTAMP,
`binary` BINARY,
`array` ARRAY<int>,
`map` MAP<int, int>,
`struct` STRUCT<a: int, b: int>,
`union` UNIONTYPE<int, string>,
`decimal` DECIMAL(10, 1)
'
hive -e "
set mapred.job.tracker=local;
DROP TABLE IF EXISTS one_row_complex;
DROP TABLE IF EXISTS one_row_complex_null;
CREATE TABLE one_row_complex ($COLUMNS);
CREATE TABLE one_row_complex_null ($COLUMNS);
INSERT OVERWRITE TABLE one_row_complex SELECT
true,
127,
32767,
2147483647,
9223372036854775807,
0.5,
0.25,
'a string',
0,
'123',
array(1, 2),
map(1, 2, 3, 4),
named_struct('a', 1, 'b', 2),
create_union(0, 1, 'test_string'),
0.1
FROM one_row;
INSERT OVERWRITE TABLE one_row_complex_null SELECT
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
IF(false, array(1, 2), null),
IF(false, map(1, 2, 3, 4), null),
IF(false, named_struct('a', 1, 'b', 2), null),
IF(false, create_union(0, 1, 'test_string'), null),
null
FROM one_row;
"
# Note: using IF(false, ...) above to work around https://issues.apache.org/jira/browse/HIVE-4022
# The problem is that a "void" type cannot be inserted into a complex type field.