Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

CREATE TABLE v8_trips_8i1u
(
ts BIGINT,
uuid STRING,
rider STRING,
driver STRING,
fare DOUBLE,
city STRING
) USING HUDI
PARTITIONED BY (city)
TBLPROPERTIES (
type = 'mor',
primaryKey = 'uuid',
preCombineField = 'ts',
'hoodie.metadata.enable' = 'false',
'hoodie.parquet.small.file.limit' = '0'
);

INSERT INTO v8_trips_8i1u
VALUES (1695159649087, '334e26e9-8355-45cc-97c6-c31daf0df330', 'rider-A', 'driver-K', 19.10, 'san_francisco'),
(1695091554788, 'e96c4396-3fad-413a-a942-4cb36106d721', 'rider-C', 'driver-M', 27.70, 'san_francisco'),
(1695046462179, '9909a8b1-2d15-4d3d-8ec9-efc48c536a00', 'rider-D', 'driver-L', 33.90, 'san_francisco'),
(1695332066204, '1dced545-862b-4ceb-8b43-d2a568f6616b', 'rider-E', 'driver-O', 93.50, 'san_francisco'),
(1695516137016, 'e3cf430c-889d-4015-bc98-59bdce1e530c', 'rider-F', 'driver-P', 34.15, 'sao_paulo'),
(1695376420876, '7a84095f-737f-40bc-b62f-6b69664712d2', 'rider-G', 'driver-Q', 43.40, 'sao_paulo'),
(1695173887231, '3eeb61f7-c2b0-4636-99bd-5d7a5a1d2c04', 'rider-I', 'driver-S', 41.06, 'chennai'),
(1695115999911, 'c8abbe79-8d89-47ea-b4ce-4d224bae5bfa', 'rider-J', 'driver-T', 17.85, 'chennai');

UPDATE v8_trips_8i1u
SET fare = 25.0
WHERE rider = 'rider-D';
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

CREATE TABLE v8_trips_8i3d
(
ts BIGINT,
uuid STRING,
rider STRING,
driver STRING,
fare DOUBLE,
city STRING
) USING HUDI
PARTITIONED BY (city)
TBLPROPERTIES (
type = 'mor',
primaryKey = 'uuid',
preCombineField = 'ts',
'hoodie.metadata.enable' = 'false',
'hoodie.parquet.small.file.limit' = '0'
);

INSERT INTO v8_trips_8i3d
VALUES (1695159649087, '334e26e9-8355-45cc-97c6-c31daf0df330', 'rider-A', 'driver-K', 19.10, 'san_francisco'),
(1695091554788, 'e96c4396-3fad-413a-a942-4cb36106d721', 'rider-C', 'driver-M', 27.70, 'san_francisco'),
(1695046462179, '9909a8b1-2d15-4d3d-8ec9-efc48c536a00', 'rider-D', 'driver-L', 33.90, 'san_francisco'),
(1695332066204, '1dced545-862b-4ceb-8b43-d2a568f6616b', 'rider-E', 'driver-O', 93.50, 'san_francisco'),
(1695516137016, 'e3cf430c-889d-4015-bc98-59bdce1e530c', 'rider-F', 'driver-P', 34.15, 'sao_paulo'),
(1695376420876, '7a84095f-737f-40bc-b62f-6b69664712d2', 'rider-G', 'driver-Q', 43.40, 'sao_paulo'),
(1695173887231, '3eeb61f7-c2b0-4636-99bd-5d7a5a1d2c04', 'rider-I', 'driver-S', 41.06, 'chennai'),
(1695115999911, 'c8abbe79-8d89-47ea-b4ce-4d224bae5bfa', 'rider-J', 'driver-T', 17.85, 'chennai');

DELETE FROM v8_trips_8i3d WHERE rider in ('rider-A', 'rider-C', 'rider-D');
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

CREATE TABLE v8_complexkeygen_hivestyle (
id INT,
name STRING,
isActive BOOLEAN,
intField INT,
longField LONG,
floatField FLOAT,
doubleField DOUBLE,
decimalField DECIMAL(10,5),
dateField DATE,
timestampField TIMESTAMP,
binaryField BINARY,
arrayField ARRAY<STRUCT<arr_struct_f1: STRING, arr_struct_f2: INT>>,
mapField MAP<STRING, STRUCT<map_field_value_struct_f1: DOUBLE, map_field_value_struct_f2: BOOLEAN>>,
structField STRUCT<
field1: STRING,
field2: INT,
child_struct: STRUCT<
child_field1: DOUBLE,
child_field2: BOOLEAN
>
>,
byteField BYTE,
shortField SHORT
)
USING HUDI
TBLPROPERTIES (
type = 'cow',
primaryKey = 'id,name',
preCombineField = 'longField',
'hoodie.metadata.enable' = 'false',
'hoodie.datasource.write.hive_style_partitioning' = 'true'
)
PARTITIONED BY (byteField, shortField);

INSERT INTO v8_complexkeygen_hivestyle VALUES
(1, 'Alice', true, 15000, 1234567890, 1.0, 3.14159, 12345.67890, CAST('2023-04-01' AS DATE), CAST('2023-04-01 12:01:00' AS TIMESTAMP), CAST('binary data' AS BINARY),
ARRAY(STRUCT('red', 100), STRUCT('blue', 200), STRUCT('green', 300)),
MAP('key1', STRUCT(123.456, true), 'key2', STRUCT(789.012, false)),
STRUCT('Alice', 30, STRUCT(123.456, true)),
10, 300
),
(2, 'Bob', false, 25000, 9876543210, 2.0, 2.71828, 67890.12345, CAST('2023-04-02' AS DATE), CAST('2023-04-02 13:02:00' AS TIMESTAMP), CAST('more binary data' AS BINARY),
ARRAY(STRUCT('yellow', 400), STRUCT('purple', 500)),
MAP('key3', STRUCT(234.567, true), 'key4', STRUCT(567.890, false)),
STRUCT('Bob', 40, STRUCT(789.012, false)),
20, 100
),
(3, 'Carol', true, 35000, 1928374650, 3.0, 1.41421, 11111.22222, CAST('2023-04-03' AS DATE), CAST('2023-04-03 14:03:00' AS TIMESTAMP), CAST('even more binary data' AS BINARY),
ARRAY(STRUCT('black', 600), STRUCT('white', 700), STRUCT('pink', 800)),
MAP('key5', STRUCT(345.678, true), 'key6', STRUCT(654.321, false)),
STRUCT('Carol', 25, STRUCT(456.789, true)),
10, 300
);

INSERT INTO v8_complexkeygen_hivestyle VALUES
(1, 'Alice', false, 15000, 1234567890, 1.0, 3.14159, 12345.67890, CAST('2023-04-01' AS DATE), CAST('2023-04-01 12:01:00' AS TIMESTAMP), CAST('binary data' AS BINARY),
ARRAY(STRUCT('red', 100), STRUCT('blue', 200), STRUCT('green', 300)),
MAP('key1', STRUCT(123.456, true), 'key2', STRUCT(789.012, false)),
STRUCT('Alice', 30, STRUCT(123.456, true)),
10, 300
),
(4, 'Diana', true, 45000, 987654321, 4.0, 2.468, 65432.12345, CAST('2023-04-04' AS DATE), CAST('2023-04-04 15:04:00' AS TIMESTAMP), CAST('new binary data' AS BINARY),
ARRAY(STRUCT('orange', 900), STRUCT('gray', 1000)),
MAP('key7', STRUCT(456.789, true), 'key8', STRUCT(123.456, false)),
STRUCT('Diana', 50, STRUCT(987.654, true)),
30, 100
);
Binary file not shown.
30 changes: 30 additions & 0 deletions crates/test/data/sample_table/cow/v8_empty.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

create table v8_empty (
id INT,
name STRING,
isActive BOOLEAN
)
USING HUDI
TBLPROPERTIES (
type = 'cow',
primaryKey = 'id',
'hoodie.metadata.enable' = 'false'
);
Binary file added crates/test/data/sample_table/cow/v8_empty.zip
Binary file not shown.
80 changes: 80 additions & 0 deletions crates/test/data/sample_table/cow/v8_nonpartitioned.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

CREATE TABLE v8_nonpartitioned (
id INT,
name STRING,
isActive BOOLEAN,
byteField BYTE,
shortField SHORT,
intField INT,
longField LONG,
floatField FLOAT,
doubleField DOUBLE,
decimalField DECIMAL(10,5),
dateField DATE,
timestampField TIMESTAMP,
binaryField BINARY,
arrayField ARRAY<STRUCT<arr_struct_f1: STRING, arr_struct_f2: INT>>, -- Array of structs
mapField MAP<STRING, STRUCT<map_field_value_struct_f1: DOUBLE, map_field_value_struct_f2: BOOLEAN>>, -- Map with struct values
structField STRUCT<
field1: STRING,
field2: INT,
child_struct: STRUCT<
child_field1: DOUBLE,
child_field2: BOOLEAN
>
>
)
USING HUDI
TBLPROPERTIES (
type = 'cow',
primaryKey = 'id',
preCombineField = 'longField',
'hoodie.metadata.enable' = 'false'
);

INSERT INTO v8_nonpartitioned VALUES
(1, 'Alice', true, 1, 300, 15000, 1234567890, 1.0, 3.14159, 12345.67890, CAST('2023-04-01' AS DATE), CAST('2023-04-01 12:01:00' AS TIMESTAMP), CAST('binary data' AS BINARY),
ARRAY(STRUCT('red', 100), STRUCT('blue', 200), STRUCT('green', 300)),
MAP('key1', STRUCT(123.456, true), 'key2', STRUCT(789.012, false)),
STRUCT('Alice', 30, STRUCT(123.456, true))
),
(2, 'Bob', false, 0, 100, 25000, 9876543210, 2.0, 2.71828, 67890.12345, CAST('2023-04-02' AS DATE), CAST('2023-04-02 13:02:00' AS TIMESTAMP), CAST('more binary data' AS BINARY),
ARRAY(STRUCT('yellow', 400), STRUCT('purple', 500)),
MAP('key3', STRUCT(234.567, true), 'key4', STRUCT(567.890, false)),
STRUCT('Bob', 40, STRUCT(789.012, false))
),
(3, 'Carol', true, 1, 200, 35000, 1928374650, 3.0, 1.41421, 11111.22222, CAST('2023-04-03' AS DATE), CAST('2023-04-03 14:03:00' AS TIMESTAMP), CAST('even more binary data' AS BINARY),
ARRAY(STRUCT('black', 600), STRUCT('white', 700), STRUCT('pink', 800)),
MAP('key5', STRUCT(345.678, true), 'key6', STRUCT(654.321, false)),
STRUCT('Carol', 25, STRUCT(456.789, true))
);

INSERT INTO v8_nonpartitioned VALUES
(1, 'Alice', false, 1, 300, 15000, 1234567890, 1.0, 3.14159, 12345.67890, CAST('2023-04-01' AS DATE), CAST('2023-04-01 12:01:00' AS TIMESTAMP), CAST('binary data' AS BINARY),
ARRAY(STRUCT('red', 100), STRUCT('blue', 200), STRUCT('green', 300)),
MAP('key1', STRUCT(123.456, true), 'key2', STRUCT(789.012, false)),
STRUCT('Alice', 30, STRUCT(123.456, true))
),
(4, 'Diana', true, 1, 500, 45000, 987654321, 4.0, 2.468, 65432.12345, CAST('2023-04-04' AS DATE), CAST('2023-04-04 15:04:00' AS TIMESTAMP), CAST('new binary data' AS BINARY),
ARRAY(STRUCT('orange', 900), STRUCT('gray', 1000)),
MAP('key7', STRUCT(456.789, true), 'key8', STRUCT(123.456, false)),
STRUCT('Diana', 50, STRUCT(987.654, true))
);
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

CREATE TABLE v8_simplekeygen_hivestyle_no_metafields (
id INT,
name STRING,
isActive BOOLEAN,
shortField SHORT,
intField INT,
longField LONG,
floatField FLOAT,
doubleField DOUBLE,
decimalField DECIMAL(10,5),
dateField DATE,
timestampField TIMESTAMP,
binaryField BINARY,
arrayField ARRAY<STRUCT<arr_struct_f1: STRING, arr_struct_f2: INT>>, -- Array of structs
mapField MAP<STRING, STRUCT<map_field_value_struct_f1: DOUBLE, map_field_value_struct_f2: BOOLEAN>>, -- Map with struct values
structField STRUCT<
field1: STRING,
field2: INT,
child_struct: STRUCT<
child_field1: DOUBLE,
child_field2: BOOLEAN
>
>,
byteField BYTE
)
USING HUDI
TBLPROPERTIES (
type = 'cow',
primaryKey = 'id',
preCombineField = 'longField',
'hoodie.metadata.enable' = 'false',
'hoodie.datasource.write.hive_style_partitioning' = 'true',
'hoodie.datasource.write.drop.partition.columns' = 'false',
'hoodie.populate.meta.fields' = 'false'
)
PARTITIONED BY (byteField);

INSERT INTO v8_simplekeygen_hivestyle_no_metafields VALUES
(1, 'Alice', false, 300, 15000, 1234567890, 1.0, 3.14159, 12345.67890, CAST('2023-04-01' AS DATE), CAST('2023-04-01 12:01:00' AS TIMESTAMP), CAST('binary data' AS BINARY),
ARRAY(STRUCT('red', 100), STRUCT('blue', 200), STRUCT('green', 300)),
MAP('key1', STRUCT(123.456, true), 'key2', STRUCT(789.012, false)),
STRUCT('Alice', 30, STRUCT(123.456, true)),
10
),
(2, 'Bob', false, 100, 25000, 9876543210, 2.0, 2.71828, 67890.12345, CAST('2023-04-02' AS DATE), CAST('2023-04-02 13:02:00' AS TIMESTAMP), CAST('more binary data' AS BINARY),
ARRAY(STRUCT('yellow', 400), STRUCT('purple', 500)),
MAP('key3', STRUCT(234.567, true), 'key4', STRUCT(567.890, false)),
STRUCT('Bob', 40, STRUCT(789.012, false)),
20
),
(3, 'Carol', true, 200, 35000, 1928374650, 3.0, 1.41421, 11111.22222, CAST('2023-04-03' AS DATE), CAST('2023-04-03 14:03:00' AS TIMESTAMP), CAST('even more binary data' AS BINARY),
ARRAY(STRUCT('black', 600), STRUCT('white', 700), STRUCT('pink', 800)),
MAP('key5', STRUCT(345.678, true), 'key6', STRUCT(654.321, false)),
STRUCT('Carol', 25, STRUCT(456.789, true)),
10
),
(4, 'Diana', true, 500, 45000, 987654321, 4.0, 2.468, 65432.12345, CAST('2023-04-04' AS DATE), CAST('2023-04-04 15:04:00' AS TIMESTAMP), CAST('new binary data' AS BINARY),
ARRAY(STRUCT('orange', 900), STRUCT('gray', 1000)),
MAP('key7', STRUCT(456.789, true), 'key8', STRUCT(123.456, false)),
STRUCT('Diana', 50, STRUCT(987.654, true)),
30
);
Binary file not shown.
Loading
Loading