Skip to content

Conversation

@kantuni
Copy link
Collaborator

@kantuni kantuni commented Jan 19, 2021

Since there some name conflicts in the midst of the integration, the names used are not final and are subject to change.

Change list (back):

  • Added new proto message - namely, Arrow.proto. It will replace ArrowTable.proto when the integration is complete.
  • Added beta table element to Element.proto.
  • Added ArrowMixin class that provides st.beta_table, and its marshalling functions.
  • Added data_frame_to_bytes and bytes_to_data_frame to type_util.

Change list (front):

  • Added support to .mjs files to our webpack config (it's required by the apache-arrow module).
  • Added apache-arrow dependency to package.json.
  • Added BetaTable component to render new table elements.
  • Used styled components from Table.tsx.
  • Added new wrapper (Arrow.ts) with helper functions for Arrow tables.

P.S. All tests are ready, but in order not to spook the reviewer, they will be presented in the next PR.

@kantuni kantuni requested a review from a team January 19, 2021 18:55
Copy link
Contributor

@karriebear karriebear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got lazy and didn't look up the apache arrow documentation. It would be helpful for the review if you could include the structure of the table produced. I had to keep scrolling up and down to remember what each item was. I'll take a deeper look tomorrow but wanted to get you these comments for now. Also need to go through arrow.py

The only thing critical is the try/except for the import pyarrow. When you do the final review, you should try testing on python 3.9 as well to make sure we can install and run streamlit hello

import Alert from "components/elements/Alert/"
import { getAlertKind } from "components/elements/Alert/Alert"
import { Kind } from "components/shared/AlertContainer"
import BetaTable from "components/elements/BetaTable/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something that really matters but you only really have to include beta in streamlit/__init__.py. It's just the API that needs to mention beta. All these things are internal so we don't have to call it out as beta here

A dataframe to convert.
"""
import pyarrow as pa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this in a try/except since it is a conditional dependency.

dataRows: number
dataColumns: number
rows: number
columns: number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially more of a problem when reading through without any typing information but could we rename these so its obvious they're numbers? When I saw these variables in use after they've been destructured, I had assumed these were the actual data of rows, cols, etc. If we don't destructure them it would probably be fine but destructuring is awesome.

const isMultiIndex = this.schema.column_indexes.length > 1
return unzip(
this.schema.columns
.map(column => column.field_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't really need this map. I assume columns should not get expensive so it's probably fine

Comment on lines +150 to +151
?.get(rowIndex)
?.toString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important at all but I find the ? on the new line confusing when it's modifying the previous line. My initial thought was this was supposed to be a ternary statement.

throw new Error("Column index is out of range.")
}

const isBlankCell = rowIndex < headerRows && columnIndex < headerColumns
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a header cell instead but I'm not sure why this would be blank unless this is the cell where the row header and column header meets?


switch (type) {
case "blank": {
return <th key={columnIndex} className={classNames}></th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work for a header column?


return (
<StyledTableContainer data-testid="stTable">
{tableStyles && <style>{tableStyles}</style>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anyway to convert this to a styled component? I'm guessing this is a string of CSS?

akrolsmir added a commit to akrolsmir/streamlit that referenced this pull request Jan 22, 2021
akrolsmir added a commit that referenced this pull request Jan 26, 2021
* Refactor: remove "_proto" from "data_frame_proto.py"

See #2136

Shouldn't conflict with Henrikh's in-flight #2612

* Actually rename files >.>
@stale
Copy link

stale bot commented Mar 8, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 8, 2021
@stale stale bot closed this Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants