Skip to content

Commit

Permalink
Java format.
Browse files Browse the repository at this point in the history
Database widgets.
  • Loading branch information
jdunkerley committed May 5, 2023
1 parent 6526b2d commit b4cb90e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
14 changes: 11 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
Expand Up @@ -187,6 +187,7 @@ type Table
table.select_columns [-1, 0, 1] reorder=True

Icon: select_column
@columns Widget_Helpers.make_column_name_vector_selector
select_columns : Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector) -> Boolean -> Boolean -> Problem_Behavior -> Table ! No_Output_Columns | Missing_Input_Columns | Column_Indexes_Out_Of_Range
select_columns self (columns = [0]) (reorder = False) (error_on_missing_columns = True) (on_problems = Report_Warning) =
new_columns = self.columns_helper.select_columns selectors=columns reorder=reorder error_on_missing_columns=error_on_missing_columns on_problems=on_problems
Expand Down Expand Up @@ -239,6 +240,7 @@ type Table
Remove the first two columns and the last column.

table.remove_columns [-1, 0, 1]
@columns Widget_Helpers.make_column_name_vector_selector
remove_columns : Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector) -> Boolean -> Problem_Behavior -> Table ! No_Output_Columns | Missing_Input_Columns | Column_Indexes_Out_Of_Range
remove_columns self (columns = [0]) (error_on_missing_columns = False) (on_problems = Report_Warning) =
new_columns = self.columns_helper.remove_columns selectors=columns error_on_missing_columns=error_on_missing_columns on_problems=on_problems
Expand Down Expand Up @@ -294,6 +296,7 @@ type Table
Move the first column to back.

table.reorder_columns [0] position=Position.After_Other_Columns
@columns Widget_Helpers.make_column_name_vector_selector
reorder_columns : Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector) -> Position -> Boolean -> Problem_Behavior -> Table ! Missing_Input_Columns | Column_Indexes_Out_Of_Range
reorder_columns self (columns = [0]) (position = Position.Before_Other_Columns) (error_on_missing_columns = False) (on_problems = Report_Warning) =
new_columns = self.columns_helper.reorder_columns selectors=columns position=position error_on_missing_columns on_problems=on_problems
Expand Down Expand Up @@ -845,6 +848,7 @@ type Table
- If floating points values are present in the distinct columns, a
`Floating_Point_Equality` is reported according to the `on_problems`
setting.
@columns Widget_Helpers.make_column_name_vector_selector
distinct : Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector) -> Case_Sensitivity -> Boolean -> Problem_Behavior -> Table ! No_Output_Columns | Missing_Input_Columns | No_Input_Columns_Selected | Floating_Point_Equality
distinct self columns=self.column_names case_sensitivity=Case_Sensitivity.Default error_on_missing_columns=True on_problems=Report_Warning =
key_columns = self.columns_helper.select_columns selectors=columns reorder=True error_on_missing_columns=error_on_missing_columns on_problems=on_problems . catch No_Output_Columns _->
Expand Down Expand Up @@ -1341,6 +1345,7 @@ type Table
- If any column names in the new table are clashing, a
`Duplicate_Output_Column_Names` is reported according to the
`on_problems` setting.
@id_fields Widget_Helpers.make_column_name_vector_selector
transpose : Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector) -> Text -> Text -> Boolean -> Problem_Behavior -> Table ! No_Output_Columns | Missing_Input_Columns | Column_Indexes_Out_Of_Range | Duplicate_Output_Column_Names
transpose self id_fields=[] (name_field="Name") (value_field="Value") (error_on_missing_columns=True) (on_problems = Report_Warning) =
## Avoid unused arguments warning. We cannot rename arguments to `_`,
Expand Down Expand Up @@ -1383,7 +1388,9 @@ type Table
an `Unquoted_Delimiter`
- If there are more than 10 issues with a single column,
an `Additional_Warnings`.
@group_by Widget_Helpers.make_column_name_vector_selector
@name_column Widget_Helpers.make_column_name_selector
@values (Widget_Helpers.make_aggregate_column_selector include_group_by=False)
cross_tab : Aggregate_Column | Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector | Aggregate_Column) -> (Text | Integer | Column) -> Vector Aggregate_Column -> Problem_Behavior -> Table ! Missing_Input_Columns | Column_Indexes_Out_Of_Range | Invalid_Aggregate_Column | Floating_Point_Equality | Invalid_Aggregation | Unquoted_Delimiter | Additional_Warnings
cross_tab self group_by=[] name_column=self.column_names.first values=Aggregate_Column.Count (on_problems=Report_Warning) =
## Avoid unused arguments warning. We cannot rename arguments to `_`,
Expand All @@ -1395,6 +1402,7 @@ type Table
## Parsing values is not supported in database tables, the table has to be
loaded into memory first with `read`.
@type Widget_Helpers.parse_type_selector
@columns Widget_Helpers.make_column_name_vector_selector
parse : Text | Integer | Column_Selector | Vector (Text | Integer | Column_Selector) -> Value_Type | Auto -> Text | Data_Formatter -> Boolean -> Problem_Behavior -> Table
parse columns=(self.columns . filter (c-> c.value_type.is_text) . map .name) type=Auto format=Data_Formatter.Value error_on_missing_columns=True on_problems=Report_Warning =
## Avoid unused arguments warning. We cannot rename arguments to `_`,
Expand Down Expand Up @@ -1505,6 +1513,7 @@ type Table
will be named `<Input Column> <N>` where `N` is the number of the marked group.
If the new name is already in use it will be renamed following the normal
suffixing strategy.
@column Widget_Helpers.make_column_name_selector
parse_to_columns : Text | Integer -> Text -> Case_Sensitivity -> Boolean -> Problem_Behavior -> Table
parse_to_columns self column pattern="." case_sensitivity=Case_Sensitivity.Sensitive parse_values=True on_problems=Report_Error =
_ = [column, pattern, case_sensitivity, parse_values, on_problems]
Expand Down Expand Up @@ -1560,6 +1569,7 @@ type Table
If the backend does not support the requested target type, the closest
supported type is chosen and a `Inexact_Type_Coercion` problem is
reported.
@columns Widget_Helpers.make_column_name_vector_selector
cast : (Text | Integer | Column_Selector | Vector (Integer | Text | Column_Selector)) -> Value_Type -> Problem_Behavior -> Table ! Illegal_Argument | Inexact_Type_Coercion | Lossy_Conversion
cast self columns=[0] value_type=Value_Type.Char on_problems=Problem_Behavior.Report_Warning =
selected = self.select_columns columns
Expand Down Expand Up @@ -1599,9 +1609,7 @@ type Table
table = self.connection.read_statement sql
table.at column_name . at 0

## UNSTABLE

Returns a materialized dataframe containing rows of this table.
## Returns a materialized dataframe containing rows of this table.

Arguments:
- max_rows: specifies a maximum amount of rows to fetch; if not set, all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
import java.time.temporal.*;

public class Date_Period_Utils implements TimeUtilsBase {
private final static long NANOSECONDS_IN_DAY = 86_400_000_000_000L;
private static final long NANOSECONDS_IN_DAY = 86_400_000_000_000L;
public static TemporalAdjuster day_start =
(Temporal temporal) -> {
return temporal.isSupported(ChronoField.NANO_OF_DAY)
? temporal.with(ChronoField.NANO_OF_DAY, 0)
: temporal;
};

public static TemporalAdjuster day_end =
(Temporal temporal) -> {
return temporal.isSupported(ChronoField.NANO_OF_DAY)
? temporal.with(ChronoField.NANO_OF_DAY, NANOSECONDS_IN_DAY - 1)
: temporal;
};
public static TemporalAdjuster day_end =
(Temporal temporal) -> {
return temporal.isSupported(ChronoField.NANO_OF_DAY)
? temporal.with(ChronoField.NANO_OF_DAY, NANOSECONDS_IN_DAY - 1)
: temporal;
};

public static TemporalAdjuster quarter_start =
(Temporal temporal) -> {
Expand Down

0 comments on commit b4cb90e

Please sign in to comment.