[jira] [Updated] (PIG-5404) FLATTEN infers wrong datatype

2020-10-13 Thread Koji Noguchi (Jira)


 [ 
https://issues.apache.org/jira/browse/PIG-5404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Koji Noguchi updated PIG-5404:
--
Attachment: pig-5404-v01.patch

Sorry for the delay.
 Issue mentioned on this jira actually had two separate issues.
 * Describe not showing the correct schema.
 * Join failing with "join statement has datatype double which is incompatible 
with type of corresponding column in earlier relation"

Former was less critical since it was only happening for "describe". 
 Uploaded a patch for this in PIG-5243.

Latter, it's a critical bug. 
 Issue was, when ForEach with as-clause was referenced by more than one 
relation, type-cast foreach was only inserted to one of the relation and not 
the others. 
 As a result, remaining relations were getting an incorrect schema.

Attaching a patch that inserts typecast to all the remaining relations.

[~daijy], can you review this jira and PIG-5243 for us ?

> FLATTEN infers wrong datatype
> -
>
> Key: PIG-5404
> URL: https://issues.apache.org/jira/browse/PIG-5404
> Project: Pig
>  Issue Type: Bug
>  Components: impl
>Affects Versions: 0.17.0
>Reporter: Bruno Pusztahazi
>Assignee: Koji Noguchi
>Priority: Blocker
>  Labels: datatypes, flatten
> Attachments: pig-5404-v01.patch
>
>
> In version 0.12 (checked out branch-0.12) the following code works as 
> expected:
> With the following input file test.csv:
>  
> {code:java}
> John_5,18,4.0F
> Mary_6,19,3.8F
> Bill_7,20,3.9F
> Joe_8,18,3.8F{code}
>  
>  
> {code:java}
> A = LOAD 'test.csv' USING PigStorage (',') AS 
> (name:chararray,age:int,gpr:float);
> B = FOREACH A GENERATE FLATTEN(STRSPLIT(name,'_')) as 
> (name1:chararray,name2:chararray),age,gpr;
> DESCRIBE B;{code}
> and produces the following output:
>  
> {code:java}
> B: {name1: chararray,name2: chararray,age: int,gpr: float}
> {code}
> This is the expected output as the result of flatten is defined as chararrays.
>  
> When using version 0.17 (checkout out branch-0.17) the code produces:
> {code:java}
> B: {name1: bytearray,name2: bytearray,age: int,gpr: float}
> {code}
> This shows that somehow FLATTEN inferred wrong data types (bytearray instead 
> of chararay).
>  
> Using explicit casting as a workaround on 0.17:
> {code:java}
> B1 = FOREACH B GENERATE (chararray)name1,(chararray)name2,age,gpr;
> DESCRIBE B1;{code}
> produces
> {code:java}
> B1: {name1: chararray,name2: chararray,age: int,gpr: float}
> {code}
> This time with the expected data types.
>  
> The plan explain show some strange cast operators that are not really used 
> (or at least the actual data types are wrong):
> {code:java}
> #---
> # New Logical Plan:
> #---
> B: (Name: LOStore Schema: 
> name1#121:chararray,name2#122:chararray,age#105:int,gpr#106:float)
> |
> |---B: (Name: LOForEach Schema: 
> name1#121:chararray,name2#122:chararray,age#105:int,gpr#106:float)
>     |   |
>     |   (Name: LOGenerate[false,false,false,false] Schema: 
> name1#121:chararray,name2#122:chararray,age#105:int,gpr#106:float)ColumnPrune:OutputUids=[121,
>  105, 122, 106]ColumnPrune:InputUids=[121, 105, 122, 106]
>     |   |   |
>     |   |   (Name: Cast Type: chararray Uid: 121)
>     |   |   |
>     |   |   |---name1:(Name: Project Type: bytearray Uid: 121 Input: 0 
> Column: 0)
>     |   |   |
>     |   |   (Name: Cast Type: chararray Uid: 122)
>     |   |   |
>     |   |   |---name2:(Name: Project Type: bytearray Uid: 122 Input: 1 
> Column: 0)
>     |   |   |
>     |   |   age:(Name: Project Type: int Uid: 105 Input: 2 Column: 0)
>     |   |   |
>     |   |   gpr:(Name: Project Type: float Uid: 106 Input: 3 Column: 0)
>     |   |
>     |   |---(Name: LOInnerLoad[0] Schema: name1#121:bytearray)
>     |   |
>     |   |---(Name: LOInnerLoad[1] Schema: name2#122:bytearray)
>     |   |
>     |   |---(Name: LOInnerLoad[2] Schema: age#105:int)
>     |   |
>     |   |---(Name: LOInnerLoad[3] Schema: gpr#106:float)
>     |
>     |---B: (Name: LOForEach Schema: 
> name1#135:bytearray,name2#136:bytearray,age#105:int,gpr#106:float)
>         |   |
>         |   (Name: LOGenerate[true,false,false] Schema: 
> name1#135:bytearray,name2#136:bytearray,age#105:int,gpr#106:float)
>         |   |   |
>         |   |   (Name: UserFunc(org.apache.pig.builtin.STRSPLIT) Type: tuple 
> Uid: 132)
>         |   |   |
>         |   |   |---(Name: Cast Type: chararray Uid: 104)
>         |   |   |   |
>         |   |   |   |---name:(Name: Project Type: bytearray Uid: 104 Input: 0 
> Column: (*))
>         |   |   |
>         |   |   |---(Name: Constant Type: chararray Uid: 131)
>         |   |   |
>         |   |   (Name: Cast Type: int Uid: 105)
>         |   |   |
>         |   |   |---age:(Name: Project Type: bytearray

[jira] Subscription: PIG patch available

2020-10-13 Thread jira
Issue Subscription
Filter: PIG patch available (36 issues)

Subscriber: pigdaily

Key Summary
PIG-5380SortedDataBag hitting ConcurrentModificationException or producing 
incorrect output in a corner-case 
https://issues.apache.org/jira/browse/PIG-5380
PIG-5377Move supportsParallelWriteToStoreLocation from StoreFunc to 
StoreFuncInterfce
https://issues.apache.org/jira/browse/PIG-5377
PIG-5369Add llap-client dependency
https://issues.apache.org/jira/browse/PIG-5369
PIG-5360Pig sets working directory of input file systems causes exception 
thrown
https://issues.apache.org/jira/browse/PIG-5360
PIG-5338Prevent deep copy of DataBag into Jython List
https://issues.apache.org/jira/browse/PIG-5338
PIG-5323Implement LastInputStreamingOptimizer in Tez
https://issues.apache.org/jira/browse/PIG-5323
PIG-5273_SUCCESS file should be created at the end of the job
https://issues.apache.org/jira/browse/PIG-5273
PIG-5256Bytecode generation for POFilter and POForeach
https://issues.apache.org/jira/browse/PIG-5256
PIG-5160SchemaTupleFrontend.java is not thread safe, cause PigServer thrown 
NPE in multithread env
https://issues.apache.org/jira/browse/PIG-5160
PIG-5115Builtin AvroStorage generates incorrect avro schema when the same 
pig field name appears in the alias
https://issues.apache.org/jira/browse/PIG-5115
PIG-5106Optimize when mapreduce.input.fileinputformat.input.dir.recursive 
set to true
https://issues.apache.org/jira/browse/PIG-5106
PIG-5081Can not run pig on spark source code distribution
https://issues.apache.org/jira/browse/PIG-5081
PIG-5080Support store alias as spark table
https://issues.apache.org/jira/browse/PIG-5080
PIG-5057IndexOutOfBoundsException when pig reducer processOnePackageOutput
https://issues.apache.org/jira/browse/PIG-5057
PIG-5029Optimize sort case when data is skewed
https://issues.apache.org/jira/browse/PIG-5029
PIG-4926Modify the content of start.xml for spark mode
https://issues.apache.org/jira/browse/PIG-4926
PIG-4913Reduce jython function initiation during compilation
https://issues.apache.org/jira/browse/PIG-4913
PIG-4849pig on tez will cause tez-ui to crash,because the content from 
timeline server is too long. 
https://issues.apache.org/jira/browse/PIG-4849
PIG-4750REPLACE_MULTI should compile Pattern once and reuse it
https://issues.apache.org/jira/browse/PIG-4750
PIG-4684Exception should be changed to warning when job diagnostics cannot 
be fetched
https://issues.apache.org/jira/browse/PIG-4684
PIG-4656Improve String serialization and comparator performance in 
BinInterSedes
https://issues.apache.org/jira/browse/PIG-4656
PIG-4598Allow user defined plan optimizer rules
https://issues.apache.org/jira/browse/PIG-4598
PIG-4551Partition filter is not pushed down in case of SPLIT
https://issues.apache.org/jira/browse/PIG-4551
PIG-4539New PigUnit
https://issues.apache.org/jira/browse/PIG-4539
PIG-4515org.apache.pig.builtin.Distinct throws ClassCastException
https://issues.apache.org/jira/browse/PIG-4515
PIG-4373Implement PIG-3861 in Tez
https://issues.apache.org/jira/browse/PIG-4373
PIG-4323PackageConverter hanging in Spark
https://issues.apache.org/jira/browse/PIG-4323
PIG-4313StackOverflowError in LIMIT operation on Spark
https://issues.apache.org/jira/browse/PIG-4313
PIG-4002Disable combiner when map-side aggregation is used
https://issues.apache.org/jira/browse/PIG-4002
PIG-3952PigStorage accepts '-tagSplit' to return full split information
https://issues.apache.org/jira/browse/PIG-3952
PIG-3911Define unique fields with @OutputSchema
https://issues.apache.org/jira/browse/PIG-3911
PIG-3877Getting Geo Latitude/Longitude from Address Lines
https://issues.apache.org/jira/browse/PIG-3877
PIG-3873Geo distance calculation using Haversine
https://issues.apache.org/jira/browse/PIG-3873
PIG-3668COR built-in function when atleast one of the coefficient values is 
NaN
https://issues.apache.org/jira/browse/PIG-3668
PIG-3587add functionality for rolling over dates
https://issues.apache.org/jira/browse/PIG-3587
PIG-1804Alow Jython function to implement Algebraic and/or Accumulator 
interfaces
https://issues.apache.org/jira/browse/PIG-1804

You may edit this subscription at:
https://issues.apache.org/jira/secure/EditSubscription!default.jspa?subId=16328&filterId=12322384