|
| 1 | +-- Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +-- or more contributor license agreements. See the NOTICE file |
| 3 | +-- distributed with this work for additional information |
| 4 | +-- regarding copyright ownership. The ASF licenses this file |
| 5 | +-- to you under the Apache License, Version 2.0 (the |
| 6 | +-- "License"); you may not use this file except in compliance |
| 7 | +-- with the License. You may obtain a copy of the License at |
| 8 | +-- |
| 9 | +-- http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +-- |
| 11 | +-- Unless required by applicable law or agreed to in writing, |
| 12 | +-- software distributed under the License is distributed on an |
| 13 | +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +-- KIND, either express or implied. See the License for the |
| 15 | +-- specific language governing permissions and limitations |
| 16 | +-- under the License. |
| 17 | + |
| 18 | +-- ConfigMatrix: parquet.enable.dictionary=false,true |
| 19 | + |
| 20 | +statement |
| 21 | +CREATE TABLE test_slice(arr array<int>, s int, l int) USING parquet |
| 22 | + |
| 23 | +statement |
| 24 | +INSERT INTO test_slice VALUES |
| 25 | + (array(1, 2, 3, 4, 5), 2, 3), |
| 26 | + (array(1, 2, 3, 4, 5), 1, 5), |
| 27 | + (array(1, 2, 3, 4, 5), 1, 10), |
| 28 | + (array(1, 2, 3, 4, 5), 3, 0), |
| 29 | + (array(1, 2, 3, 4, 5), -2, 2), |
| 30 | + (array(1, 2, 3, 4, 5), -10, 2), |
| 31 | + (array(1, 2, 3, 4, 5), 10, 2), |
| 32 | + (array(1, NULL, 3, NULL, 5), 1, 5), |
| 33 | + (array(), 1, 3), |
| 34 | + (NULL, 1, 3), |
| 35 | + (array(1, 2, 3), NULL, 2), |
| 36 | + (array(1, 2, 3), 1, NULL) |
| 37 | + |
| 38 | +-- column array, column start, column length |
| 39 | +query |
| 40 | +SELECT slice(arr, s, l) FROM test_slice |
| 41 | + |
| 42 | +-- column array, literal start and length |
| 43 | +query |
| 44 | +SELECT slice(arr, 2, 2) FROM test_slice |
| 45 | + |
| 46 | +-- column array, negative literal start |
| 47 | +query |
| 48 | +SELECT slice(arr, -1, 1) FROM test_slice |
| 49 | + |
| 50 | +-- string element type |
| 51 | +statement |
| 52 | +CREATE TABLE test_slice_string(arr array<string>) USING parquet |
| 53 | + |
| 54 | +statement |
| 55 | +INSERT INTO test_slice_string VALUES |
| 56 | + (array('a', 'b', 'c', 'd')), |
| 57 | + (array('é', '日本', '', 'x')), |
| 58 | + (array('a', NULL, 'c')), |
| 59 | + (NULL) |
| 60 | + |
| 61 | +query |
| 62 | +SELECT slice(arr, 1, 2) FROM test_slice_string |
0 commit comments