-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
importccl: fix target column populating for AVRO
Target columns for AVRO are not properly populated when starting a job for IMPORT INTO. This hinders the ability for default expressions to be supported, and therefore this PR does that by extracting these information out from the AVRO schema to be populated into `importCtx`. It also extracts the columns present in the table but missing from the AVRO schema so that an error could be returned if strict validation is turned on, but when some columns in the table are not specified in the AVRO schema. The default values for each column follows the precendence: 1. Data of that column specified in an AVRO row; 2. Default value specified in AVRO schema: 3. Default value of a table. For example, say we have CREATE TABLE t (a INT, b INT DEFAULT 42) Consider, also, an Avro file myfile.avro. Then for each row: 1. If a value is present in column (b), then the value is used. 2. If the value is not present in column (b) but the AVRO schema specifies schema: (a, "INT", b, "INT", default: 20) then the default value of 20 is automatically populated into the Avro values, and we'll therefore use this default value 20 instead of 42. 3. If none of (1) and (2) holds, then the value 42 is used. Release note: None
- Loading branch information
anzoteh96
committed
Aug 18, 2020
1 parent
e66e787
commit cea198e
Showing
2 changed files
with
161 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters