You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Anders Rune Jensen (Jira)" <ji...@apache.org> on 2020/04/18 21:05:00 UTC

[jira] [Updated] (ARROW-7738) [JS] Implement list contains predicate

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

Anders Rune Jensen updated ARROW-7738:
--------------------------------------
    Description: 
As far as I can see there is no way to check if a list contains a specific element.

My code is as follows:

 
{code:java}
var listChild = new arrow.Field('list[Utf8]', new arrow.Utf8())

var all = arrow.Table.new([
 arrow.DateVector.from(dates),
 arrow.Int32Vector.from(flumeseqs),
 arrow.Utf8Vector.from(keys),
 arrow.Vector.from({ values: authors, type: new arrow.Dictionary(new arrow.Utf8(), new arrow.Int32()) }),
 arrow.Int32Vector.from(sequences),
 arrow.Vector.from({ values: types, type: new arrow.Dictionary(new arrow.Utf8(), new arrow.Int32()) }),
 arrow.Vector.from({ values: links, type: new arrow.List(listChild) }),
 ], ["date", "flumeseq", "key", "author", "sequence", "type", "links"])
{code}
And I want to get all the items that has a specific element in the links section.

So something like:

 
{code:java}
var q2 = Array.from(
all.filter(
 arrow.predicate.col('links').contains('%GcvjVk+NLsjOB5Vd+vceGXEOeYmHoRA6lgXVJzPuMxw=.sha256')))
{code}
 

 

  was:
As far as I can see there is no way to check if a list contains a specific element.

My code is as follows:

 
{code:java}
var all = arrow.Table.new([
 arrow.DateVector.from(dates),
 arrow.Int32Vector.from(flumeseqs),
 arrow.Utf8Vector.from(keys),
 arrow.Vector.from({ values: authors, type: new arrow.Dictionary(new arrow.Utf8(), new arrow.Int32()) }),
 arrow.Int32Vector.from(sequences),
 arrow.Vector.from({ values: types, type: new arrow.Dictionary(new arrow.Utf8(), new arrow.Int32()) }),
 arrow.Vector.from({ values: links, type: new arrow.List(listChild) }),
 ], ["date", "flumeseq", "key", "author", "sequence", "type", "links"])
{code}
And I want to get all the items that has a specific element in the links section.

So something like:

 
{code:java}
var q2 = Array.from(
all.filter(
 arrow.predicate.col('links').contains('%GcvjVk+NLsjOB5Vd+vceGXEOeYmHoRA6lgXVJzPuMxw=.sha256')))
{code}
 

 


> [JS] Implement list contains predicate
> --------------------------------------
>
>                 Key: ARROW-7738
>                 URL: https://issues.apache.org/jira/browse/ARROW-7738
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: JavaScript
>    Affects Versions: 0.15.1
>            Reporter: Anders Rune Jensen
>            Priority: Minor
>
> As far as I can see there is no way to check if a list contains a specific element.
> My code is as follows:
>  
> {code:java}
> var listChild = new arrow.Field('list[Utf8]', new arrow.Utf8())
> var all = arrow.Table.new([
>  arrow.DateVector.from(dates),
>  arrow.Int32Vector.from(flumeseqs),
>  arrow.Utf8Vector.from(keys),
>  arrow.Vector.from({ values: authors, type: new arrow.Dictionary(new arrow.Utf8(), new arrow.Int32()) }),
>  arrow.Int32Vector.from(sequences),
>  arrow.Vector.from({ values: types, type: new arrow.Dictionary(new arrow.Utf8(), new arrow.Int32()) }),
>  arrow.Vector.from({ values: links, type: new arrow.List(listChild) }),
>  ], ["date", "flumeseq", "key", "author", "sequence", "type", "links"])
> {code}
> And I want to get all the items that has a specific element in the links section.
> So something like:
>  
> {code:java}
> var q2 = Array.from(
> all.filter(
>  arrow.predicate.col('links').contains('%GcvjVk+NLsjOB5Vd+vceGXEOeYmHoRA6lgXVJzPuMxw=.sha256')))
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)