| # 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. |
| |
| # Literal values are coerced to the type of their corresponding columns. |
| [default initial_logical_plan] |
| insert into test values (1, 2, 1.1, 1.3, 'foo', 'foo') |
| -- |
| TopLevelPlan |
| +-plan=InsertTuple |
| | +-input=TableReference[relation_name=Test,relation_alias=test] |
| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] |
| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] |
| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] |
| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] |
| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] |
| | | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] |
| | +-column_values= |
| | +-Literal[value=1,type=Int NULL] |
| | +-Literal[value=2,type=Long] |
| | +-Literal[value=1.10000002,type=Float] |
| | +-Literal[value=1.3,type=Double NULL] |
| | +-Literal[value=foo,type=Char(20)] |
| | +-Literal[value=foo,type=VarChar(20) NULL] |
| +-output_attributes= |
| +-[] |
| == |
| |
| insert into test values (1, 2, 1, 2, 'foo', 'foo') |
| -- |
| TopLevelPlan |
| +-plan=InsertTuple |
| | +-input=TableReference[relation_name=Test,relation_alias=test] |
| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] |
| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] |
| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] |
| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] |
| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] |
| | | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] |
| | +-column_values= |
| | +-Literal[value=1,type=Int NULL] |
| | +-Literal[value=2,type=Long] |
| | +-Literal[value=1,type=Float] |
| | +-Literal[value=2,type=Double NULL] |
| | +-Literal[value=foo,type=Char(20)] |
| | +-Literal[value=foo,type=VarChar(20) NULL] |
| +-output_attributes= |
| +-[] |
| == |
| |
| insert into test values (1, 2.1, 1, 2, 'foo', 'foo') |
| -- |
| ERROR: The assigned value for the column long_col has the type Double, which cannot be safely coerced to the column's type Long (1 : 29) |
| insert into test values (1, 2.1, 1, 2, 'foo', 'foo') |
| ^ |
| == |
| |
| insert into test values (1, 2, 1.1, 1.3, 'foofoofoofoofoofoofoofoofoofoo', 'foo') |
| -- |
| ERROR: The assigned value for the column char_col has the type VarChar(30), which cannot be safely coerced to the column's type Char(20) (1 : 42) |
| insert into test values (1, 2, 1.1, 1.3, 'foofoofoofoofoofoofoofoofoofo... |
| ^ |
| == |
| |
| insert into test values (1, 2, 1.1, 1.3, 'foo', 'foofoofoofoofoofoofoofoofoofoo') |
| -- |
| ERROR: The assigned value for the column vchar_col has the type VarChar(30), which cannot be safely coerced to the column's type VarChar(20) NULL (1 : 49) |
| ...into test values (1, 2, 1.1, 1.3, 'foo', 'foofoofoofoofoofoofoofoofoofo... |
| ^ |
| == |
| |
| insert into test values (1, 2, 3, 4, 'foo', 'foo', 'undefined_column') |
| -- |
| ERROR: The relation test has 6 columns, but 7 values are provided (1 : 13) |
| insert into test values (1, 2, 3, 4, 'foo'... |
| ^ |
| == |
| |
| insert into test values (1, 2, 1.1) |
| -- |
| ERROR: Must assign a non-NULL value to column char_col (1 : 13) |
| insert into test values (1, 2, 1.1) |
| ^ |
| == |
| |
| # The ommitted vchar_col value is NULL. |
| insert into test values (1, 1, 2, 1.1, 'char_foo') |
| -- |
| TopLevelPlan |
| +-plan=InsertTuple |
| | +-input=TableReference[relation_name=Test,relation_alias=test] |
| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] |
| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] |
| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] |
| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] |
| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] |
| | | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] |
| | +-column_values= |
| | +-Literal[value=1,type=Int NULL] |
| | +-Literal[value=1,type=Long] |
| | +-Literal[value=2,type=Float] |
| | +-Literal[value=1.1000000000000001,type=Double NULL] |
| | +-Literal[value=char_foo,type=Char(20)] |
| | +-Literal[value=NULL,type=VarChar(20) NULL] |
| +-output_attributes= |
| +-[] |
| == |
| |
| insert into test values (1, null, 1, 1, 'char_foo', 'vchar_foo') |
| -- |
| ERROR: The assigned value for the column long_col has the type Long NULL, which cannot be safely coerced to the column's type Long (1 : 29) |
| insert into test values (1, null, 1, 1, 'char_foo', 'vchar... |
| ^ |
| == |
| |
| insert into test values (null, 2, 1, 1, 'foo', 'foo') |
| -- |
| TopLevelPlan |
| +-plan=InsertTuple |
| | +-input=TableReference[relation_name=Test,relation_alias=test] |
| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL] |
| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long] |
| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float] |
| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL] |
| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)] |
| | | +-AttributeReference[id=5,name=vchar_col,relation=test,type=VarChar(20) NULL] |
| | +-column_values= |
| | +-Literal[value=NULL,type=Int NULL] |
| | +-Literal[value=2,type=Long] |
| | +-Literal[value=1,type=Float] |
| | +-Literal[value=1,type=Double NULL] |
| | +-Literal[value=foo,type=Char(20)] |
| | +-Literal[value=foo,type=VarChar(20) NULL] |
| +-output_attributes= |
| +-[] |
| == |
| |
| insert into undefined_table values (1, 2) |
| -- |
| ERROR: Unrecognized relation undefined_table (1 : 13) |
| insert into undefined_table values (1, 2) |
| ^ |