I found in a specific case spanner's ROUND() function returns unexpected value.
Here's what I found.
SELECT ROUND(34.092135, 8)
> 34.092135
SELECT ROUND(34.092136, 8)
> 34.092135999999996 // this is supposed to return 34.092136
SELECT ROUND(34.092137, 8)
> 34.092137
I found these queries work the same with BigQuery.
Is there any misassumption on my side, or if not, how can I make it work correctly?
Thanks.
The issue seems to be there for both Cloud Spanner and BigQuery. Tried with different values but the issue seems to be for a particular set of inputs i.e. it is showing the unexpected result for values 33.092136, 34.092136, 35.092136, ........., 62.092136, 63.092136. Before 33.092136 and from 64.092136 onwards the issue seems to be not there. Also I tried with Cloud SQL(MySQL) and the issue is not there.
I have created an issue in Public Issue Tracker for the same. I would suggest you star the issue so that you will get notified whenever there is any update on the created issue.
Related
The BigQuery release notes for July 13th 2020 announced that the ASSERT statement is now available.
I was trying it out with my data but couldn't get it to work. Issue seems to be that my data is in EU location, as opposed to US. The release notes and page make no mention of ASSERT being region specific so I'm unsure if I'm using it wrong or this is a bug.
To test I created two datasets, dataset_eu and dataset_us, in the relevant locations. In each I made the same table called inputs from the following query:
SELECT 'foo' AS x
UNION ALL
SELECT 'bar' AS x
Querying the US dataset with a processing location of US runs fine.
ASSERT (SELECT COUNT(*) FROM dataset_us.inputs) > 0 AS 'No rows'
However querying the EU dataset with a processing location of EU runs gives an Unsupported statement ASSERT error.
ASSERT (SELECT COUNT(*) FROM dataset_eu.inputs) > 0 AS 'No rows'
I did also try including project prefix but still got error.
This seems to be a bug/limitation on BigQuery side. I'm also facing the same issue while testing this new feature.
I've created a public issue in the IssueTracker.
FTR: This is even easier to reproduce. Execute the following query with different "processing location" in the "query options":
ASSERT TRUE
EDIT: Since today, it is working. It seems that Google resolved the issue!
I'm executing the following SQL query:
SELECT doc.cmis:description, doc.cmis:name
FROM cmis:document doc
WHERE IN_FOLDER(doc,'folderID')
This result in something like below:
doc.cmis:description = "this is description"
doc.cmis:name = "fileName"
Now, if I add following statements, it returns zero result:
and doc.cmis:description = 'this is description'
However, if I modify and-statement with following, it works:
and doc.cmis:description like '%'
If I add one character (but not two interestingly...) as below, it also works:
and doc.cmis:description like '%t%'
It's very interesting to note that and-statement work very well with doc.cmis:name (as well as other properties).
Does anyone have clue as to why this strange / mysterious behavior is occurring?
The specifications delegate to the implementer if the cmis:description is queryable or not.
Anyway, which Alfresco version are you using ? There was an issue/bug time ago, but this should be solved: The cmis:description field should be queryable, although I don't know if it's fixed in enterprise or community.
By the way, I am currently using Alfresco Community 4.2.f and I have the same problem.
I was using activejdbc 1.4.9 and the following sample code was running just fine
Client client = new Client();
client.save();
Assert.assertNotNull(client.getId());
Since I upgraded to 1.4.12, client.getId() is always returning null when save is inserting a new record. i.e. id is not getting refreshed.
Did anyone notice this as well? Do I have to do anything different using this version to get the newly created id?
I cannot confirm this with the version 1.4.12. For instance, I wrote this example: https://github.com/javalite/simple-example/blob/new_id. Check out code in the Main.java. As you can see, the code is identical to yours, but on line 21, it prints out a real value of the new ID.
If you can put together a simple example that replicates your issue, I will take a look.
EDIT:
Now that you provided more info in comments below, the problem is with you setting the ID to empty string: "". Because the ID is not null anymore, the method save() uses update rather than insert. The update then uses the value of ID to update an "existing" record, and, as a result does not do anything. Messing with ID value is possible but not advised. Please see this for more information: http://javalite.io/surrogate_primary_keys
I have tried every where all examples I came across but still have the same problem error 'htmlentities() expects parameter 1 to be string, array given'
I need to select count from the database and would like to use the raw select as i will have more flexibility on it but any point towards the right direction will be appreciated here is what i have been doing'
$totalOpen = DB::table('dam')
->select(array('dam.*', DB::raw('COUNT(dam.mivisjobid) as followers')))
->join('miviswf','miviswf.mivisid','=','dam.mivisjobid')
->whereRaw( 'miviswf.mivisid=dam.mivisjobid')
->whereIn('miviswf.Status', $inputIds) // pass an array
->orderBy('miviswf.datetimesubmitted', 'ASC');'
and i get this error 'htmlentities() expects parameter 1 to be string, object given (View: '
Try with this, don't use array inside the select method
->select('dam.*', DB::raw('COUNT(dam.mivisjobid) as followers'))
for reference:
https://laravel.com/docs/5.2/queries#selects
This worked fine
DB::table(' dam')
->count();
I am trying to save a view in BigQuery, and keep getting the same error:
Failed to create view. Unexpected. Please try again.
The query is as follows:
SELECT
interaction.id AS Interaction.ID,
interaction.author.name AS Interaction.Author.Name,
interaction.author.username AS Interaction.Author.Username,
interaction.content AS Interaction.Content,
interaction.created_at_timestamp AS Interaction.Created_At_Timestamp,
klout.score AS Klout.Score,
twitter.geo.latitude AS Twitter.Geo.Latitude,
twitter.geo.longitude AS Twitter.Geo.Longitude,
twitter.media.expanded_url AS Twitter.Media.ExpandedUrl,
twitter.media.type AS Twitter.Media.Type,
twitter.place.country AS Twitter.Place.Country,
twitter.user.followers_count AS Twitter.User.Followers,
twitter.user.friends_count AS Twitter.User.Friends,
twitter.user.listed_count AS Twitter.User.Listed,
twitter.retweet.count AS Twitter.Retweet.Count
FROM
[**DATASET_NAME_OMITTED**.main_table]
WHERE
(interaction.id IS NOT NULL)
AND (interaction.created_at_timestamp IS NOT NULL)
AND (interaction.created_at_timestamp >= DATE_ADD(USEC_TO_TIMESTAMP(UTC_USEC_TO_HOUR(NOW())), -1, "DAY"))
AND (interaction.created_at_timestamp < USEC_TO_TIMESTAMP(UTC_USEC_TO_HOUR(NOW())))
The query validates, and runs without any problems:
Valid: This query will process 203 MB when run.
I did notice that the twitter.media is of type REPEATED RECORD. That said, removing twitter.media.* fields does not fix the issue.
I have been able to successfully save other views with the same timestamp restrictions and naming conventions. Attempting to save this one consistently fails.
For context: This table is populated by DataSift via their BigQuery connector (default, catch-all schema).
This is really weird.
I ran an experiment and pulled out each of the alias operations, and it worked.
I then slowly added some of them back in, and again; it continued working. However it seems that certain aliases do not want to work (I have no idea why).
I ended up with the following, which contains most of your aliases, and seems to work as expected:
SELECT
interaction.id AS Interaction.ID,
interaction.author.name AS Interaction.Author.Name,
interaction.author.username AS Interaction.Author.Username,
interaction.content AS Interaction.Content,
interaction.created_at_timestamp AS Interaction.Created_At_Timestamp,
klout.score AS Klout.Score,
twitter.geo.latitude AS Twitter.Geo.Latitude,
twitter.geo.longitude AS Twitter.Geo.Longitude,
twitter.media.expanded_url,
twitter.media.type AS Twitter.Media.Type,
twitter.place.country AS Twitter.Place.Country,
twitter.user.followers_count,
twitter.user.friends_count,
twitter.user.listed_count,
twitter.retweet.count AS Twitter.Retweet.Count
FROM [**DATASET_NAME_OMITTED**.main_table]
WHERE
(interaction.id IS NOT NULL)
AND (interaction.created_at_timestamp IS NOT NULL)
AND (interaction.created_at_timestamp >= DATE_ADD(USEC_TO_TIMESTAMP(UTC_USEC_TO_HOUR(NOW())), -1, "DAY"))
AND (interaction.created_at_timestamp < USEC_TO_TIMESTAMP(UTC_USEC_TO_HOUR(NOW())))
What seems really weird is that there is no pattern between what will, and will not work. The twitter.user.* fields are integers, but will not accept aliases, however the integer field klout.score field does accept an integer.