Skip to content

Commit

Permalink
proxify columns
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jan 16, 2023
1 parent ac0772f commit 474ecf9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Data.Array_Proxy.Array_Proxy
import Standard.Base.Error.Common.Index_Out_Of_Bounds
import Standard.Base.Error.Common.Type_Error
import Standard.Base.Error.File_Error.File_Error
Expand Down Expand Up @@ -535,13 +536,17 @@ type Table

Returns the vector of columns contained in this table.
columns : Vector Column
columns self = self.internal_columns . map self.make_column
columns self = Vector.from_polyglot_array <|
Array_Proxy.new self.internal_columns.length i->
self.make_column (self.internal_columns.at i)

## UNSTABLE

Returns the vector of column names contained in this table.
column_names : Vector Text
column_names self = self.internal_columns . map _.name
column_names self = Vector.from_polyglot_array <|
Array_Proxy.new self.internal_columns.length i->
self.internal_columns.at i . name

## Returns a vector of rows contained in this table.

Expand Down Expand Up @@ -805,7 +810,7 @@ type Table
`Report_Unmatched`, which behaves like `True` - unmatched columns are
kept and padded with `Nothing`, but a problem is reported.
- allow_type_widening: Specifies if the resulting column type should be
adjusted to fit columns from all arguments. If `True`, a common type
adjusted to fit columns from all arguments. If `True`, a common type
will be chosen for each column (see "Unifying Column Types" below).
If `False`, the resulting column type will be the same as in the first
table containing the column. In this case, all columns that are
Expand Down
10 changes: 7 additions & 3 deletions distribution/lib/Standard/Table/0.0.0-dev/src/Data/Table.enso
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from Standard.Base import all
import Standard.Base.Data.Index_Sub_Range as Index_Sub_Range_Module
import Standard.Base.Data.Array_Proxy.Array_Proxy
import Standard.Base.Data.Index_Sub_Range as Index_Sub_Range_Module
import Standard.Base.Data.Ordering.Comparator
import Standard.Base.Error.Common.Index_Out_Of_Bounds
import Standard.Base.Error.Common.No_Such_Method
Expand Down Expand Up @@ -975,13 +975,17 @@ type Table

example_columns = Examples.inventory_table.columns
columns : Vector
columns self = Vector.from_polyglot_array self.java_table.getColumns . map Column.Value
columns self = Vector.from_polyglot_array <|
Array_Proxy.new self.java_table.getColumns.length i->
Column.Value (self.java_table.getColumns.at i)

## UNSTABLE

Returns the vector of column names contained in this table.
column_names : Vector Text
column_names self = Vector.from_polyglot_array self.java_table.getColumns . map _.getName
column_names self = Vector.from_polyglot_array <|
Array_Proxy.new self.java_table.getColumns.length i->
self.java_table.getColumns.at i . getName

## Returns a vector of rows contained in this table.

Expand Down

0 comments on commit 474ecf9

Please sign in to comment.