question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table column with maked data drops mask

See original GitHub issue

[EDIT]: See https://github.com/astropy/astropy/issues/8816#issuecomment-500598908 for a more direct example of the bug.


import numpy as np
from astropy.table import Table
data = np.ma.masked_greater(np.arange(5), 3)
tab = Table({'data': [data]})
mtab = Table({'data': [data]}, masked=True)
data, tab['data'][0], mtab['data'][0]

gives:

(masked_array(data=[0, 1, 2, 3, --],
              mask=[False, False, False, False,  True],
        fill_value=999999),
 array([0, 1, 2, 3, 4]),
 masked_BaseColumn(data=[0, 1, 2, 3, 4],
                   mask=[False, False, False, False, False],
             fill_value=999999))

So neither the table, nor the masked table respects the mask of the input data and silently converts the array to use the “data behind the mask”.

CC:@taldcroft

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
hamogucommented, Jun 11, 2019

@pllim Don’t worry. I’ve been programming with @taldcroft for almost one decade now. I’m just joking. I know he takes me serious.

1reaction
pllimcommented, Jun 10, 2019

For now, workaround seems to be:

>>> mtab['data'][0].mask = data.mask
>>> mtab['data'][0]
masked_BaseColumn(data=[0, 1, 2, 3, --],
                  mask=[False, False, False, False,  True],
            fill_value=999999)

FWIW, it works as expected without the square brackets:

>>> mtab = Table({'data': data}, masked=True)
>>> mtab 
<Table masked=True length=5>
 data
int64
-----
    0
    1
    2
    3
   --
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic Data Masking - SQL Server | Microsoft Learn
Users with SELECT permission on a table can view the table data. Columns that are defined as masked, will display the masked data....
Read more >
Dynamic Data Masking – Altering the masked column
How to alter/drop a masked column? Dynamic Data Masking can be implemented in new tables or even existing tables in your database.
Read more >
DROP MASKED | SqlHints.com
Dynamic data masking functions/rule can be defined on the table columns for which we need the masked out-put in the query result.
Read more >
Dynamic Data Masking In SQL Server - SQLShack
The default mask, masks complete values in the specified column. To specify a mask for a particular column, you have to use the...
Read more >
Db2 12 - Security - Column mask - IBM
A column mask is a database object that describes a specific column access ... group, or role can receive the masked values that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found